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
Thanks Rob, yes I did try adding dashes, slashes and spaces in between the Year/Month/Day and that does resolve the dates.
However I was wondering is there a way I could identify records older than 90 days without converting MyDate (YYYYMMDD) to a date? I tried a couple of things:
I passed a symbolic jcl value to the carla step and called it THRESH. I then created these Carla statements but it didn't produce any records
SYMBOLIC num thresh=&thresh <-- In the sysprint this does resolve SYMBOLIC num thresh=20251203
and then I added a select statement, select mydate<thresh-90, but it didn't identify any records. So this didn't work.
So then I just tried a select statement referencing the jcl symbolic value: select mydate<&thresh-90. And in the sysrpint it shows it did resolve the value "select mydate<20251203-90" but I received CKR0412 12 String longer than expected size 10 at SYSIN line 14.
Is there a way I could pass today's date as a jcl symbolic value and then use it to do math with in the carla step (e.g. mydate<&thresh-90)?
------------------------------
Scott Lahner
------------------------------