View previous topic :: View next topic
|
Author |
Message |
mframe-guy
New User
Joined: 03 Dec 2020 Posts: 6 Location: India
|
|
|
|
I have a requirement where the date in the input file which is stored in PD format has to be compared with a specific date and replaced with that date if the input date is lesser than the given date.
the layout of the input file starts like this and this is the first field of the input file.
05 X-KEY-1.
10 X-EFF-DATE PIC S9(09) COMP-3.
So, I have used the below code to achieve this in my JCL
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=(1,5,PD,LE,20201111),
OVERLAY=(1:C'20201111'))
but the overridden output gets stored in the ZONED DECIMAL format instead of Packed decimal format. Could you please suggest me how to replace the date - '20201111' in PD format in the output file. |
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
If this is a constant, the simple way is, to specify the packed decimal as its hex value.
Code: |
...OVERLAY=(1:X’020201111C’) |
|
|
Back to top |
|
|
sergeyken
Senior Member
Joined: 29 Apr 2008 Posts: 2023 Location: USA
|
|
|
|
Probably, the packed constant P’20201111’ should work, too.
Just never tried it. |
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
I would suggest to use JPn if you have a constant date. If the Date changes in future then only JCL changes.
Code: |
// SET DATE1='20201111'
//S1 EXEC PGM=SORT,PARM='JP1"&DATE1"'
//*
//SORTIN DD *
TEST REC
//SORTOUT DD DSN=OUTPUT DSN
//SYSUDUMP DD SYSOUT=*
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC OVERLAY=(81:JP1,81,8,ZD,PD,LENGTH=5)
/* |
|
|
Back to top |
|
|
Rohit Umarjikar
Global Moderator
Joined: 21 Sep 2010 Posts: 3053 Location: NYC,USA
|
|
|
|
sergeyken wrote: |
Probably, the packed constant P’20201111’ should work, too.
Just never tried it. |
Not worked for me. |
|
Back to top |
|
|
mframe-guy
New User
Joined: 03 Dec 2020 Posts: 6 Location: India
|
|
|
|
Rohit, your option has worked for me. Thank you Sergey and Rohit for your inputs |
|
Back to top |
|
|
|