I am using Carla to read an input file with two fields (A numeric field which is a date and a text field) see below. I would like to select records based on the date and be able to use the TODAY keyword. But I am not having any luck converting the numeric field to a valid date.
Input File:
20251202 RECORD12
20251102 RECORD11
20251002 RECORD10
20250902 RECORD9
20250802 RECORD8
20250702 RECORD7
20250602 RECORD6
20250502 RECORD5
20250402 RECORD4
20250302 RECORD3
20250202 RECORD2
20250102 RECORD1
I am trying to convert the numeric field to a date using Carla
deftype type=$input
alloc type=$input dd=INPUT
newlist type=$INPUT DD=OUTREC
def date8(date,8,'Date8') as ,
convert(substr(record,1,8),datetime,date)
def date10($date,10,'Date10') as ,
convert(substr(record,1,8),datetime,date)
def mydate(8,'MyDate') as substr(record,1,8)
def text(8,'MyRecord') as substr(record,10,8)
select date8<today-30
sortlist,
date8 date10 mydate text
Output file: Note the dates should be for example 02Jan25 and 2025-01-02 but they are converting to Jan 10th 2025.
Date8 Date10 MyDate MyRecord
10Jan25 2025-01-10 20250102 RECORD1
20Jan25 2025-01-20 20250202 RECORD2
30Jan25 2025-01-30 20250302 RECORD3
9Feb25 2025-02-09 20250402 RECORD4
19Feb25 2025-02-19 20250502 RECORD5
1Mar25 2025-03-01 20250602 RECORD6
11Mar25 2025-03-11 20250702 RECORD7
21Mar25 2025-03-21 20250802 RECORD8
31Mar25 2025-03-31 20250902 RECORD9
10Apr25 2025-04-10 20251002 RECORD10
20Apr25 2025-04-20 20251102 RECORD11
30Apr25 2025-04-30 20251202 RECORD12
Also is there a way to convert a Carla date to this format YYYYMMDD without / or - ?
For Example, 22Apr25 convert to 20250422
------------------------------
Scott Lahner
------------------------------