|
View previous topic :: View next topic
|
| Author |
Message |
tecnokrat Warnings : 1 Active User

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
| Code: |
INREC IFTHEN=(WHEN=(1,4,CH,EQ,X'00',OR,1,4,CH,EQ,X'40'),
OVERLAY=(1:Y'DATE2'-1)) |
The sort card throws a syntax error for using Y'DATE2'-1. |
|
| Back to top |
|
 |
Abid Hasan
New User
Joined: 25 Mar 2013 Posts: 88 Location: India
|
|
|
|
Hello,
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
------------------------
|
|
|
| Back to top |
|
 |
tecnokrat Warnings : 1 Active User

Joined: 22 May 2009 Posts: 160 Location: Bangalore
|
|
|
|
Abid, its true the DATE2-1 yielded me the ccyymm and not yymm format.
I tried the overlay option to reformat the date2-1 values and the desired result is achieved
| Code: |
| OVERLAY=(31:DATE2-1,1:33,4)) |
Thank you !! |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|