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 single file into two files

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> JCL & VSAM
View previous topic :: :: View next topic  
Author Message
anil.sahukari

New User


Joined: 11 Mar 2010
Posts: 5
Location: Chennai

PostPosted: Fri Jul 29, 2011 8:34 am    Post subject: Split single file into two files
Reply with quote

Hi,

I have one file and don't know the number of records..

I just need to split the single file into two files.. I don't have any condition or criteria to split the file.. Could u pls help how can be resolved in JCL ?
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 9:21 am    Post subject:
Reply with quote

Hello and welcome to the forum,

You need to do a more thorough job explaining what you want to do . . .

Or, just WHAT does "split" mean to you - there are multiple ways to "split" data, depending on what the actual goal is.

Why does this need to be split? How will it be used

You cannot do this (whatever it is) with "jcl" - some utility or program must be used. The only thng jcl does is to invoke programs - it does not "work with" data.

So, when you explain what you want to do, someone may have a suggestion that will help.
Back to top
View user's profile Send private message
surya anem

New User


Joined: 20 Dec 2007
Posts: 54
Location: Hyderabad

PostPosted: Fri Jul 29, 2011 9:34 am    Post subject: Reply to: Split single file into two files
Reply with quote

Hi Anil,

As dick scherrer was saying we need more information on how you want to split the files
Do you want to divide them as equally as possible or do you want to write a first n records to one files and the rest to other??

Assuming that you want to divide the files as equally as possible, you can achieve this using DFSORT with the following sysin card

Code:
 OPTION COPY
 OUTFIL FNAMES=(FIRST,SECOND),SPLIT


Where FIRST and SECOND are ddnames of the first file and second file respectively after the division.

Thanks,
Surya
Back to top
View user's profile Send private message
anil.sahukari

New User


Joined: 11 Mar 2010
Posts: 5
Location: Chennai

PostPosted: Fri Jul 29, 2011 11:36 am    Post subject: Thank you...
Reply with quote

Hi Surya,

That is gr8.. Your assumption is perfect and it's working fine !!!
Back to top
View user's profile Send private message
Nic Clouston

Global Moderator


Joined: 10 May 2007
Posts: 1715
Location: UK

PostPosted: Fri Jul 29, 2011 11:38 am    Post subject:
Reply with quote

Just a note - gr8 is not a word. If you mean great then write great - this is a forum not an sms service.
Back to top
View user's profile Send private message
Mahi_e

New User


Joined: 10 Dec 2010
Posts: 43
Location: hyderabad

PostPosted: Fri Jul 29, 2011 1:14 pm    Post subject: Reply to: Split single file into two files
Reply with quote

Questions in this forum has to be some what clearly

Guessing can't be done exactly..........

because Guess will always be Guess. if you have to get exact answers then your question should be in full fledged.

Anyway good Question icon_biggrin.gif
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 7913
Location: Bellevue, IA

PostPosted: Fri Jul 29, 2011 2:39 pm    Post subject:
Reply with quote

Quote:
I just need to split the single file into two files.. I don't have any condition or criteria to split the file.. Could u pls help how can be resolved in JCL ?
Based upon your "requirement", this job will do the trick:
Code:
// EXEC PGM=IDCAMS
//SYSOUT DD SYSOUT=*
//SYSPRINT DD SYSOUT=*
//INFILE DD DISP=SHR,DSN=...
//OUTFILE1 DD DISP=...
//OUTFILE2 DD DISP=...
//SYSIN DD *
  REPRO IFILE(INFILE) OFILE(OUTFILE1) COUNT(1)
  REPRO IFILE(INFILE) OFILE(OUTFILE2) SKIP(1)
/*
and you now have two files -- one with one record, the other with all the rest of the records.
Back to top
View user's profile Send private message
Bill Woodger

DFSORT Moderator


Joined: 09 Mar 2011
Posts: 7228

PostPosted: Fri Jul 29, 2011 3:22 pm    Post subject: Reply to: Split single file into two files
Reply with quote

Anil,

You will of course include an "empty" dataset in your test data, won't you? Or did you finish your testing already, since "it's working fine !!!"?
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 7:44 pm    Post subject:
Reply with quote

Hello,

I'm still curious why a split of this type is desired icon_confused.gif

Most often related "stuff" is kept in the same file. For example, usually all ofthe information for a particular customer/unit/whatever is needed together not in separate files.

Hopefully, this split will not introduce more issues than solutions. . .
Back to top
View user's profile Send private message
Anuj Dhawan

Senior Member


Joined: 22 Apr 2006
Posts: 6258
Location: Mumbai, India

PostPosted: Tue Aug 02, 2011 2:03 pm    Post subject:
Reply with quote

dick scherrer wrote:
Hopefully, this split will not introduce more issues than solutions. . .
Yep, who knows? And the way requirement is posed it does not seem a production problem - -may be just some intermediate step for a performance testing where code needs to be tested with different loads in input. Also, you don't even know if in the two-output files, first will contain the first half of the input and second will contain the second half of the input OR alternate records from input distributed between two outputs, because there had been no follow up on the solutions provided yet!
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Tue Aug 02, 2011 7:34 pm    Post subject: Reply to: Split single file into two files
Reply with quote

Hi Anuj,

Quote:
because there had been no follow up on the solutions provided yet!
This is way too common.

Not only does it leave the participants wondering, but is rather inconsiderate. . .

d
Back to top
View user's profile Send private message
enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10202
Location: italy

PostPosted: Tue Aug 02, 2011 7:53 pm    Post subject: Reply to: Split single file into two files
Reply with quote

since there were no criteria

the solution
Code:
 OPTION COPY
 OUTFIL FNAMES=(FIRST,SECOND),SPLIT
worked, and ts was satisfie
Quote:
That is gr8.. Your assumption is perfect and it's working fine !!!
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 High CPU consumption Job using IAM fi... aswinir JCL & VSAM 8 Thu Dec 01, 2016 8:28 pm
No new posts Add PD field from 2nd file to PD in 1st Sushant Garje DFSORT/ICETOOL 6 Thu Dec 01, 2016 4:32 pm
No new posts File Aid to File Manager conversion murali3955 IBM Tools 4 Thu Nov 24, 2016 3:41 pm
No new posts How to convert the VBM file to VB or... Sulabh Agrawal JCL & VSAM 4 Fri Nov 18, 2016 1:04 pm
No new posts CICS Roll back partially - Need to re... dwijadas CICS 4 Wed Nov 16, 2016 4:30 pm


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