Page 2 of 2

Re: Matches keyword write the

PostPosted: Fri Oct 24, 2014 9:57 am
by deva_048
I have used the below code and got the expected output mentioned in the above post.. But only one clarification when i tried to generate sequence number in jcl control card the sequence number is generated like below: (Looks like the sequence number generated from bottom to top) Can any one tell me why it is generating from bottom to top) ?
AAAA001|0003
AAAA001|0002
AAAA001|0001

 SORT FIELDS=(1,7,CH,A,81,4,ZD,D)                                     
 INREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,4,ZD,RESTART=(1,7))),     
       IFTHEN=(WHEN=GROUP,BEGIN=(81,4,ZD,EQ,1),PUSH=(85:40,5))       
 OUTREC OVERLAY=(81:SEQNUM,4,ZD,RESTART=(1,7),40:85,5)               
 OUTFIL INCLUDE=(81,4,ZD,EQ,1),BUILD=(1,80)                           
/*

Re: Matches keyword write the

PostPosted: Fri Oct 24, 2014 12:00 pm
by BillyBoyo
You''ve generated the sequence number in INREC, which runs before the SORT. So, unless the data is already in the same order as the SORT key, you sequence numbers will not be in order.

You can't tell SORT what order to do things in. You can code SORT before INREC but INREC will always run first.

You can add your sequence number instead in OUTREC or in OUTFIL.

Re: Matches keyword write the

PostPosted: Sun Oct 26, 2014 4:11 am
by NicC
i tried to generate sequence number in jcl control card

No you didn't. No such thing as a 'jcl control card'. It was a SORT control card which is why you posted the sort control cards.