Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
Hariprasad_Pargunan,
The following DFSORT JCL will give you the desired results. Since there are 3 different codes to check , the unique combinations will be 3 factorial which is 6. so we check for the 6 possible values and write out the records
Code:
//STEP0100 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
0001 YY YN NY
0002 NY YY YY
0003 YN NY YY
0004 YY YY YN
0005 YN YN YN
0006 YY YY YY
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
INREC IFTHEN=(WHEN=INIT,BUILD=(1,13,C'111')),
IFTHEN=(WHEN=(06,2,CH,EQ,C'YY'),OVERLAY=(14:C'0'),HIT=NEXT),
IFTHEN=(WHEN=(09,2,CH,EQ,C'YY'),OVERLAY=(15:C'0'),HIT=NEXT),
IFTHEN=(WHEN=(12,2,CH,EQ,C'YY'),OVERLAY=(16:C'0'))
Both the SORT cards are woking perfectly. Thank you so much.
Actually I tried the second option given by Skolusu in slightly different way but I got error in my SORT card.
I have used the HIT=NEXT function in "IFTHEN BUILD" control statement which results in error. But using HIT=NEXT along with OVERLAY didnt throw any error. Could you please explain me about this constraint?
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
Quote:
Actually I tried the second option given by Skolusu in slightly different way but I got error in my SORT card.
I have used the HIT=NEXT function in "IFTHEN BUILD" control statement which results in error.
HIT=NEXT is allowed with BUILD.
There are several IFTHEN BUILD clauses, so it's not clear what you changed or what error you received. Please show the specific IFTHEN clause you changed and the //SYSOUT messages you received including the error message.
WER901I **WARNING** SYNCSORT 1.3.1.0 WILL EXPIRE IN 48 DAYS
WER268A OUTFIL STATEMENT : SYNTAX ERROR
WER211B SYNCSMF CALLED BY SYNCSORT; RC=0000
WER449I SYNCSORT GLOBAL DSM SUBSYSTEM ACTIVE
Your Shop is using Syncsort and not DFSORT.
Please get the mannual from your syncsort support guys and check for the commands,Almost all the DFSORT cmnds works with syncsort but still you need to check with the syncsort support.