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
 

 

Split record in differents files depending on key

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DFSORT/ICETOOL
View previous topic :: :: View next topic  
Author Message
elmister

New User


Joined: 27 Nov 2005
Posts: 14

PostPosted: Tue Feb 23, 2010 1:09 am    Post subject: Split record in differents files depending on key
Reply with quote

Hi, I need to do the following:

I have a input file like this:

000001
000001
000001
000002
000002
000003
000004
000004
000005
000005
000005
000005
000006

I want this information splited in three files, but without the split the records with the same key, like following:

output file 1:
000001
000001
000001
000004
000004


output file 2:
000002
000002
000005
000005
000005
000005



output file 3:
000003
000006

So I want all the records with the same key in the same output file, not one record with key 000001 in the output file1, output file2, etc..
Back to top
View user's profile Send private message

Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Feb 23, 2010 11:45 am    Post subject:
Reply with quote

Below sortstep will give you desired result.
I have assumed LRECL=80,RECFM=FB.
Do the changes accordingly if required.
Code:

//S1    EXEC  PGM=SORT     
//SORTIN DD *               
000001                     
000001                     
000001                     
000002                     
000002                     
000003                     
000004                     
000004                     
000005                     
000005                     
000005                     
000005                     
000006                     
//SORTOF1 DD SYSOUT=*       
//SORTOF2 DD SYSOUT=*       
//SORTOF3 DD SYSOUT=*       
//SYSOUT    DD  SYSOUT=*                                             
//SYSIN    DD  *
  SORT FIELDS=(1,6,CH,A)                                           
  OUTREC IFTHEN=(WHEN=INIT,OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,6))),
       IFTHEN=(WHEN=GROUP,BEGIN=(81,8,ZD,EQ,1),PUSH=(89:ID=8)),   
       IFTHEN=(WHEN=NONE,OVERLAY=(97:89,8,ZD,MOD,+3,ZD,LENGTH=1)) 
  OUTFIL FNAMES=SORTOF1,INCLUDE=(97,1,ZD,EQ,1),BUILD=(1,80)       
  OUTFIL FNAMES=SORTOF2,INCLUDE=(97,1,ZD,EQ,2),BUILD=(1,80)       
  OUTFIL FNAMES=SORTOF3,SAVE,BUILD=(1,80)                         
/*                                                                 
Back to top
View user's profile Send private message
elmister

New User


Joined: 27 Nov 2005
Posts: 14

PostPosted: Tue Feb 23, 2010 3:32 pm    Post subject: Reply to: Split record in differents files depending on key
Reply with quote

Many thanks. Its working like I want.
Back to top
View user's profile Send private message
Escapa

Senior Member


Joined: 16 Feb 2007
Posts: 1399
Location: IL, USA

PostPosted: Tue Feb 23, 2010 3:50 pm    Post subject:
Reply with quote

You are Welcome.. icon_biggrin.gif
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 Adding big TEXT lines to each record ... bshkris SYNCSORT 4 Sat May 06, 2017 1:40 am
No new posts Unable to create multiple files using... mbattu COBOL Programming 3 Fri May 05, 2017 5:35 pm
This topic is locked: you cannot edit posts or make replies. Merge two files and update Trailer re... Yashashri JCL & VSAM 1 Thu May 04, 2017 12:54 pm
No new posts Dynamic split of files under groups sril.krishy DFSORT/ICETOOL 4 Mon Apr 17, 2017 1:09 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