I have a requirement to split an input file into multiple files using SYNCSORT or FILEAID. Input file will look like this:
Input file:
E1 Rec1
E1 Rec2
E1 Rec3
E2 Rec4
E2 Rec5
E3 Rec6
E3 Rec7
E3 Rec8
E3 Rec9
I want to split this input file into 3 different output files as:
Output file 1:
E1 Rec1
E1 Rec2
E1 Rec3
Output file 2:
E2 Rec4
E2 Rec5
Output file 1:
E3 Rec6
E3 Rec7
E3 Rec8
E3 Rec9
I can't use STARTREC and ENDREC options as records numbers will vary each time. Same reason for SPLIT option.
Any help on this would be great.
Thanks & Regards,
Himanshu
P.S. I will definitely post the answer if I got the answer in the mean time
Its very easy to split a file using file-aid. No need to write any JCL for that
Just follow the following process to split a file
1) go to option 3.3 in file aid
2) specify your from and to file name
3) Then give selection criteria usage as 'T'
4) Then it will take you to the next screen where it will have 3 options
5) choose the first one 'OPTION'
6) Then in the following screen u can have your own criteria to select records e.g forward or backward, no of records to skip, no of records to select etc....
Specify Selection Criteria Options:
Start at the following record key
(both blank for start of dataset)
Starting record key ===>
- OR - OR at the following RBA or RRN
Starting RBA or RRN ===>
Initial records to skip ===> 0 then skip this many records
Subsequent Selection Interval: then repeat the following
Records to select ===> 1 - select this many records
Records to skip ===> 0 - then skip this many records
until
Number of records to search ===> ALL you have read this many records
Number of records to select ===> ALL or selected this many records
SEQ/VSAM processing direction ===> F (F = Forward; B = Backward)
Joined: 14 Mar 2007 Posts: 8797 Location: Welsh Wales
hsiva2003
Unfortunately FileAid is not installed in every site, whereas a sort product is. This may work for you but is no guarantee that it will work for a site without FileAid.