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

Split records into different file


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
Himanshu Khatri

New User


Joined: 11 Jun 2007
Posts: 15
Location: Pune

PostPosted: Fri Jul 31, 2009 12:30 pm
Reply with quote

Hi,

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 icon_lol.gif
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 31, 2009 1:24 pm
Reply with quote

What is the RECFM and LRECL of the input file.
Where are the keys in the file, what length and format.

Have you read the SYNCSORT manual for INCLUDE and OMIT statements, which will give you what you need.
Back to top
View user's profile Send private message
hsiva2003

New User


Joined: 22 Feb 2005
Posts: 10
Location: Chennai

PostPosted: Fri Jul 31, 2009 1:49 pm
Reply with quote

Hi,

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....

File-AID -------------- Selection Criteria Options ------------------------
COMMAND ===>

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)

Use ENTER to return to selection criteria menu

This should solve your problem.

Cheers
Sivaramakrishnan
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Fri Jul 31, 2009 1:56 pm
Reply with quote

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.
Back to top
View user's profile Send private message
hsiva2003

New User


Joined: 22 Feb 2005
Posts: 10
Location: Chennai

PostPosted: Fri Jul 31, 2009 2:30 pm
Reply with quote

Hi,

Anyways the query says

"I have a requirement to split an input file into multiple files using SYNCSORT or FILEAID"

so my response could work I believe...

Cheers.
Sivaramakrishnan
Back to top
View user's profile Send private message
Rambhupal.chaudari

New User


Joined: 30 Mar 2007
Posts: 25
Location: Hyderabad

PostPosted: Fri Jul 31, 2009 3:04 pm
Reply with quote

Hi Himanshu,

try this below code, hope this will help u.
all recs, with E1 writes in to 1st file... E2 2nd file... etc.....

//SORTOF01 DD DSN=dataset1,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SORTOF02 DD DSN=dataset2,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
//SORTOF03 DD DSN=dataset3,
// DISP=(NEW,CATLG,DELETE),UNIT=SYSDA,
// SPACE=(CYL,(1,4),RLSE),
// DCB=(RECFM=FB,LRECL=80,BLKSIZE=0)
.
.
.

//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=01,INCLUDE=(1,2,CH,EQ,C'E1')
OUTFIL FILES=02,INCLUDE=(1,2,CH,EQ,C'E2')
OUTFIL FILES=03,INCLUDE=(1,2,CH,EQ,C'E3')
/*
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 -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Compare 2 files and retrive records f... DFSORT/ICETOOL 3
No new posts Compare 2 files(F1 & F2) and writ... JCL & VSAM 8
No new posts FTP VB File from Mainframe retaining ... JCL & VSAM 8
No new posts Extract the file name from another fi... DFSORT/ICETOOL 6
No new posts How to split large record length file... DFSORT/ICETOOL 10
Search our Forums:

Back to Top