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 How to change 'K' or 'M' use Sort vice_versa DFSORT/ICETOOL 5 Thu May 18, 2017 7:11 am
No new posts Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
This topic is locked: you cannot edit posts or make replies. SORT trick needed bshkris SYNCSORT 6 Tue May 02, 2017 4:35 am
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm
No new posts Sort Large record length cmsmoon DFSORT/ICETOOL 14 Tue Apr 11, 2017 5:49 pm


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