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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 15 Thu Dec 01, 2016 8:28 pm
No new posts How to update a portion of text in a ... Bill Woodger DFSORT/ICETOOL 25 Wed Nov 09, 2016 9:41 pm
No new posts Match or compare two files in VB Format anatol DFSORT/ICETOOL 14 Thu Nov 03, 2016 7:41 pm
No new posts How to split the records using the am... vnktrrd DFSORT/ICETOOL 24 Fri Oct 28, 2016 7:33 pm
This topic is locked: you cannot edit posts or make replies. How to use 2 input files in control c... Gunapala CN DFSORT/ICETOOL 23 Thu Oct 13, 2016 3:42 pm


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