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

Split single file into two files


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
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
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

Moderator Emeritus


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

PostPosted: Fri Jul 29, 2011 9:21 am
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
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
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: 2455
Location: Hampshire, UK

PostPosted: Fri Jul 29, 2011 11:38 am
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
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: 8696
Location: Dubuque, Iowa, USA

PostPosted: Fri Jul 29, 2011 2:39 pm
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

Moderator Emeritus


Joined: 09 Mar 2011
Posts: 7309
Location: Inside the Matrix

PostPosted: Fri Jul 29, 2011 3:22 pm
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

Moderator Emeritus


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

PostPosted: Fri Jul 29, 2011 7:44 pm
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

Superior Member


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

PostPosted: Tue Aug 02, 2011 2:03 pm
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

Moderator Emeritus


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

PostPosted: Tue Aug 02, 2011 7:34 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10872
Location: italy

PostPosted: Tue Aug 02, 2011 7:53 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
No new posts Access to non cataloged VSAM file JCL & VSAM 18
Search our Forums:

Back to Top