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

Split record in differents files depending on key


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
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
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
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
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
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts FINDREP - Only first record from give... DFSORT/ICETOOL 3
No new posts Compare only first records of the fil... SYNCSORT 7
Search our Forums:

Back to Top