|
View previous topic :: View next topic
|
| Author |
Message |
GaganGarg
Active User

Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Hi,
I am using the following JCL:
| Code: |
//S1 EXEC PGM=SORT
//SYSOUT DD SYSOUT=*
//SORTIN DD *
111
111
111
111
222
222
333
444
444
555
666
666
666
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=(1,30,CH,A),EQUALS
INREC IFOUTLEN=74,
IFTHEN=(WHEN=INIT,
OVERLAY=(71:SEQNUM,7,ZD,RESTART=(1,4))),
IFTHEN=(WHEN=GROUP,BEGIN=(71,7,ZD,EQ,1),END=(71,7,ZD,EQ,4),
PUSH=(71:ID=7)),
IFTHEN=(WHEN=INIT,BUILD=(1,70,71:71,7,ZD,TO=ZD,LENGTH=4))
/*
|
Here it is giving the o/p like:
| Code: |
COMMAND INPUT ===> SCROLL ===> CSR
********************************* TOP OF DATA **********************************
111 0001
111 0001
111 0001
111 0001
222 0002
222 0002
333 0003
444 0004
444 0004
555 0005
666 0006
666 0006
666 0006
******************************** BOTTOM OF DATA ********************************
|
But I need the o/p in the following way:
| Code: |
COMMAND INPUT ===> SCROLL ===> CSR
********************************* TOP OF DATA **********************************
111 0001
111 0001
111 0001
111 0001
222 0002
222 0002
333 0003
444 0004
444 0004
555 0001
666 0001
666 0002
666 0002
******************************** BOTTOM OF DATA ********************************
|
In other words, I want the SEQNUM to restart from 0001 once the seqnum reaches to 0004. Can anybody please help me out and suggest how to acheive this? I will be very thankful
Thanks |
|
| Back to top |
|
 |
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
Gagangarg,
Use the following DFSORT control cards. I am not sure as to why you are sorting. If your aim to assign the seqnum after sorting then you need to use OUTREC instead of INREC.
| Code: |
//SYSIN DD *
SORT FIELDS=COPY
INREC IFOUTLEN=74,
IFTHEN=(WHEN=INIT,OVERLAY=(75:SEQNUM,4,ZD,RESTART=(1,4))),
IFTHEN=(WHEN=GROUP,BEGIN=(75,4,ZD,EQ,1),PUSH=(71:ID=4)),
IFTHEN=(WHEN=(71,4,ZD,GT,4),
OVERLAY=(71:71,4,ZD,MOD,+4,EDIT=(TTTT)),HIT=NEXT),
IFTHEN=(WHEN=(71,4,ZD,EQ,0),OVERLAY=(71:C'0004'))
//* |
|
|
| Back to top |
|
 |
GaganGarg
Active User

Joined: 31 Mar 2010 Posts: 134 Location: India
|
|
|
|
Thanks Skolusu. It worked like a charm. Thanks for the timely help.  |
|
| Back to top |
|
 |
|
|
 |
All times are GMT + 6 Hours |
|