Joined: 22 May 2009 Posts: 160 Location: Bangalore
Hi,
I have been using the DATE2 field for formatting in the sort card for Overlay.
The condition is to overlay the date field in the file with previous month and year of YYMM format but the overlay option is unable to hold the Y'DATE2'-1
The format: Y'DATE2'-1, is allowed in INCLUDE/OMIT conditions but not for date insertions. Also, even if it did yield the date, it would be in ccyymm format and not yymm as you're expecting.
Instead, a solution can be (assuming an LRECL 30, as you haven't specified it):
Code:
000011 //SORTIN DD *
000012 DUMMY RECORD
00004CEDDE4DCCDDC
00000444480953694
----------------------------------
000013 /*
000014 //SORTOUT DD SYSOUT=*
000015 //SYSIN DD *
000016 *
000017 * ASSUMPTION: LRECL OF 30 TO BE SET FOR THE FINAL OUTPUT.
000018 *
000019 INREC IFOUTLEN=30,
000020 *
000021 * PERFORM THE CONDITIONAL CHECK FOR LOW-VALUES/SPACES DURING INREC
000022 * PROCESSING.
000023 *
000024 IFTHEN=(WHEN=(1,4,CH,EQ,X'00',OR,1,4,CH,EQ,X'40'),
000025 *
000026 * TEMPORARILY EXTEND THE RECORD BY 4 6 BYTES OF 'DATE2-1', THEN PAD THIS
000027 * SAME VALUE TO THE FIRST 4 BYTES IN 4Y2T FORMAT.
000028 *
000029 OVERLAY=(31:DATE2-1,1:33,4))
000030 *
000031 * NOW THAT THE RECORD IS READY, WRITE IT TO OUTPUT.
000032 *
000033 SORT FIELDS=COPY
000034 /*
The output:
Code:
000001 1701 DUMMY RECORD
FFFF4CEDDE4DCCDDC
17010444480953694
------------------------