Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm
No new posts Compare VSAM files using DFSORT pshongal DFSORT/ICETOOL 5 Thu Nov 23, 2017 10:24 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us