View previous topic :: View next topic
|
Author |
Message |
Senthilkumar k Warnings : 1 New User
Joined: 07 May 2009 Posts: 51 Location: Chennai
|
|
|
|
I have requirement like below, could anyone help me write a sort for this,
Input files
--------------
2020
1010
4040
Output should be like below,
2020001
2020002
.
.
.
2020999
1010001
1010002
.
.
.
1010999
4040001
4040002
.
.
.
4040999 |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Senthilkumar k,
Assuming input file of FB, try this untested...
Code: |
//STEP01 EXEC PGM=SORT
//SORTIN DD *
2020
1010
4040
/*
//SORTOUT DD SYSOUT=*
//SYSIN DD *
OPTION COPY
OUTFIL OUTREC=(1,4,SEQNUM,3,ZD),REPEAT=999
/*
//SYSOUT DD SYSOUT=*
//* |
Thanks, |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi,
you should change it to this to restart the sequence
Code: |
OUTFIL OUTREC=(1,4,SEQNUM,3,ZD,RESTART=(1,4)),REPEAT=999
|
Gerry |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Gerry,
Shouldn't restart be ONLY required, had OP requested highest seqnum, for a single record,other/less than 999?
Since for 3 byte,after 999, seqnum would restart by itself, I didn't account for RESTART.
Please correct me If I am wrong.
Thanks, |
|
Back to top |
|
|
gcicchet
Senior Member
Joined: 28 Jul 2006 Posts: 1702 Location: Australia
|
|
|
|
Hi sqlcode1,
after 999 it will result in 000 not 001.
Gerry |
|
Back to top |
|
|
sqlcode1
Active Member
Joined: 08 Apr 2010 Posts: 577 Location: USA
|
|
|
|
Gerry,
Yeah..thanks for the correction.
Thanks, |
|
Back to top |
|
|
Senthilkumar k Warnings : 1 New User
Joined: 07 May 2009 Posts: 51 Location: Chennai
|
|
|
|
Thanks Gerry and sqlcode, its worked fine. |
|
Back to top |
|
|
|