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 records into different file

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
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    Post subject: Split records into different file
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: 8593
Location: Back in jolly old England

PostPosted: Fri Jul 31, 2009 1:24 pm    Post subject:
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    Post subject: Re: Split records into different file
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: 8593
Location: Back in jolly old England

PostPosted: Fri Jul 31, 2009 1:56 pm    Post subject:
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    Post subject:
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    Post subject: Reply to: Split records into different file
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    IBMMAINFRAMES.com Support Forums -> JCL & VSAM All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Changing of LRECL of a file abdulrafi DFSORT/ICETOOL 2 Fri Mar 24, 2017 3:25 pm
No new posts splitting a file abdulrafi DFSORT/ICETOOL 4 Fri Mar 24, 2017 11:51 am
No new posts Receive a file using PCOMM macro Harald.v.K IBM Tools 0 Thu Mar 23, 2017 6:50 pm
No new posts Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 pm
No new posts Formatting VB File Learncoholic DFSORT/ICETOOL 3 Mon Mar 20, 2017 12:29 pm


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