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

Splitting file based on KEY and Generating multiple files


IBM Mainframe Forums -> DFSORT/ICETOOL
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Thu May 06, 2010 5:41 pm
Reply with quote

Can we Splitt the file based on KEY and Generate multiple files?

Inputfile : Fileformat VB and LRECL is 3000, Key position is 22 (18 + 4 RDW), and key length is 10 bytes


Code:
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX3333333333ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX3333333333ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX3333333333ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX5555555555ZZZZZZZZZZZZZZZZZZZZZ


i need to have this file to be split into couple of files based on the key, if key count matches to 2, those records needs to be written to one file

FILE1
Code:
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX1111111111ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX2222222222ZZZZZZZZZZZZZZZZZZZZZ


FILE2:

Code:
XXXXXXXXXXXXXXXXX3333333333ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX3333333333ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX3333333333ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ
XXXXXXXXXXXXXXXXX4444444444ZZZZZZZZZZZZZZZZZZZZZ


FILE3:
Code:
XXXXXXXXXXXXXXXXX5555555555ZZZZZZZZZZZZZZZZZZZZZ
Back to top
View user's profile Send private message
Escapa

Senior Member


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

PostPosted: Thu May 06, 2010 7:03 pm
Reply with quote

How many maximum number of different keys can be there?
Back to top
View user's profile Send private message
Mazahar

New User


Joined: 11 Dec 2007
Posts: 82
Location: hyderabad

PostPosted: Thu May 06, 2010 7:06 pm
Reply with quote

Quote:
How many maximum number of different keys can be there?
_________________
-Sambhaji


five output files are maximum, which mean 10 keys are maximum
Back to top
View user's profile Send private message
Skolusu

Senior Member


Joined: 07 Dec 2007
Posts: 2205
Location: San Jose

PostPosted: Thu May 06, 2010 9:25 pm
Reply with quote

mazahar,

The following DFSORT JCL will give you the desired results

Code:

//STEP0100 EXEC PGM=SORT                                               
//SYSOUT   DD SYSOUT=*                                                 
//SORTIN   DD DSN=your input VB file,DISP=SHR
//OUT1     DD SYSOUT=*                                                 
//OUT2     DD SYSOUT=*                                                 
//OUT3     DD SYSOUT=*                                                 
//OUT4     DD SYSOUT=*                                                 
//OUT5     DD SYSOUT=*                                                 
//SYSIN    DD *                                                       
 SORT FIELDS=COPY                                                     
 INREC IFTHEN=(WHEN=INIT,BUILD=(1,4,SEQNUM,8,ZD,RESTART=(22,10),2X,5)),
 IFTHEN=(WHEN=GROUP,BEGIN=(5,8,ZD,EQ,1),PUSH=(13:ID=2))   
           
 OUTFIL FNAMES=OUT1,BUILD=(1,4,15),INCLUDE=(13,2,ZD,LE,2)             
 OUTFIL FNAMES=OUT2,BUILD=(1,4,15),                                   
 INCLUDE=(13,2,ZD,GT,2,AND,13,2,ZD,LE,4)                               
 OUTFIL FNAMES=OUT3,BUILD=(1,4,15),                                   
 INCLUDE=(13,2,ZD,GT,4,AND,13,2,ZD,LE,6)                               
 OUTFIL FNAMES=OUT4,BUILD=(1,4,15),                                   
 INCLUDE=(13,2,ZD,GT,6,AND,13,2,ZD,LE,8)                               
 OUTFIL FNAMES=OUT5,BUILD=(1,4,15),SAVE                               
//*
Back to top
View user's profile Send private message
View previous topic : : View next topic  
Post new topic   Reply to topic All times are GMT + 6 Hours
Forum Index -> DFSORT/ICETOOL

 


Similar Topics
Topic Forum Replies
No new posts Joining files with intermittent heade... SYNCSORT 1
No new posts Format data from multiple records usi... SYNCSORT 4
No new posts IGYPG3178-I when compiling a pgm read... COBOL Programming 6
No new posts INPFIL FILES, FNAMES examples SYNCSORT 7
No new posts FileAid move data from two files to o... Compuware & Other Tools 5
Search our Forums:


Back to Top