IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to add seqnum using SORT


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Mon Sep 06, 2010 11:35 pm
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Sep 07, 2010 3:58 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Sep 07, 2010 4:34 am
Reply with quote

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
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Sep 07, 2010 6:22 am
Reply with quote

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
View user's profile Send private message
gcicchet

Senior Member


Joined: 28 Jul 2006
Posts: 1702
Location: Australia

PostPosted: Tue Sep 07, 2010 6:25 am
Reply with quote

Hi sqlcode1,

after 999 it will result in 000 not 001.


Gerry
Back to top
View user's profile Send private message
sqlcode1

Active Member


Joined: 08 Apr 2010
Posts: 577
Location: USA

PostPosted: Tue Sep 07, 2010 6:29 am
Reply with quote

Gerry,

Yeah..thanks for the correction.

Thanks,
Back to top
View user's profile Send private message
Senthilkumar k
Warnings : 1

New User


Joined: 07 May 2009
Posts: 51
Location: Chennai

PostPosted: Tue Sep 07, 2010 11:10 am
Reply with quote

Thanks Gerry and sqlcode, its worked fine.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Need to set RC4 through JCL SORT DFSORT/ICETOOL 5
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts JCL sort card - get first day and las... JCL & VSAM 9
No new posts Sort First/last record of a subset th... DFSORT/ICETOOL 7
No new posts how to calculate SUM value for VB fil... DFSORT/ICETOOL 1
Search our Forums:

Back to Top