Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to add seqnum using SORT

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
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    Post subject: How to add seqnum using SORT
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: 578
Location: USA

PostPosted: Tue Sep 07, 2010 3:58 am    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Sep 07, 2010 4:34 am    Post subject:
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: 578
Location: USA

PostPosted: Tue Sep 07, 2010 6:22 am    Post subject:
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: 1703
Location: Australia

PostPosted: Tue Sep 07, 2010 6:25 am    Post subject:
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: 578
Location: USA

PostPosted: Tue Sep 07, 2010 6:29 am    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Innovations in Your Mainframe Sort Arun Raj PC Guides & IT News 4 Wed Mar 15, 2017 10:38 pm
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts SORT requirement sjiraga COBOL Programming 6 Thu Mar 09, 2017 9:11 pm
No new posts SORT to append Month and YEAR in MMYY... tisamf DFSORT/ICETOOL 1 Wed Mar 08, 2017 4:46 pm
No new posts JCL sort Match and NoMatch rakeshsekar1987 SYNCSORT 2 Thu Feb 02, 2017 10:26 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us