View previous topic :: View next topic
|
Author |
Message |
anil.sahukari
New User
Joined: 11 Mar 2010 Posts: 5 Location: Chennai
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
surya anem
New User
Joined: 20 Dec 2007 Posts: 54 Location: Hyderabad
|
|
|
|
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 |
|
|
anil.sahukari
New User
Joined: 11 Mar 2010 Posts: 5 Location: Chennai
|
|
|
|
Hi Surya,
That is gr8.. Your assumption is perfect and it's working fine !!! |
|
Back to top |
|
|
Nic Clouston
Global Moderator
Joined: 10 May 2007 Posts: 2455 Location: Hampshire, UK
|
|
|
|
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 |
|
|
Mahi_e
New User
Joined: 10 Dec 2010 Posts: 43 Location: hyderabad
|
|
|
|
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 |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
Bill Woodger
Moderator Emeritus
Joined: 09 Mar 2011 Posts: 7309 Location: Inside the Matrix
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
I'm still curious why a split of this type is desired
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 |
|
|
Anuj Dhawan
Superior Member
Joined: 22 Apr 2006 Posts: 6250 Location: Mumbai, India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
enrico-sorichetti
Superior Member
Joined: 14 Mar 2007 Posts: 10872 Location: italy
|
|
|
|
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 |
|
|
|