View previous topic :: View next topic
|
Author |
Message |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Hi,
I have an input file having 100 records. I want to split it into 3 output files.I am able to do that with the SPLIT option shown below.
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FILES=(01,02,03),SPLIT
/*
|
But I need 3 more output files with the count of records in the splitted files.
Is it possible in a single step? I am using SYNCSORT FOR Z/OS 1.2
Thanks,
Arun |
|
Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
arcvns wrote: |
But I need 3 more output files with the count of records in the splitted files. |
So you need 6 files total - 3 having the data records and the other 3 only containing the count of a data file? |
|
Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Alissa,
You are absolutely right.
Right now I have to find the record count of each file separately which makes the job bulky with increasing number of split files.
Thanks,
Arun |
|
Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Are there always 100 records in the input file? Is this constant? |
|
Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
Also, what is the RECFM and LRECL of the input file? |
|
Back to top |
|
 |
Alissa Margulies
SYNCSORT Support
Joined: 25 Jul 2007 Posts: 496 Location: USA
|
|
|
|
I do not believe this can be accomplished in a single pass of the data.
However, if the numer of records can be included within each split outfil instead of in separate datasets, then it can be done. |
|
Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Alissa,
Thanks for your quick response.
LRECL is 253 and the input record count is variable.
Thanks,
Arun |
|
Back to top |
|
 |
prabhu118 Currently Banned New User
Joined: 11 Feb 2008 Posts: 14 Location: Chennai
|
|
|
|
there is was to split a file into more than 1 output files each having similar number of records.
ur req is
input has - 100 records right?
and u want to split it into 3 output files?
U can uses ICETOOL which will identify number of records in input file and spilt it accordingly into 3 output files
1st outut file - will contain 1st 33 records
2nd - will contain 2nd 33 records (i.e from 34th to 66th)
3rd will contain last 34 records.
since the tool itself will generate the number of input record counts...u o not have to worry any more to manually go and identify the number of records...
if i have got ur requirement correct..please let me know??? |
|
Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Prabhu,
Quote: |
input has - 100 records right? |
LRECL is 253 and the input record count is variable
Quote: |
U can uses ICETOOL which will identify number of records in input file and spilt it accordingly into 3 output files |
With a simple sort card as given in my previous post, I am able to split the input file.
Quote: |
u o not have to worry any more to manually go and identify the number of records... |
It is particular to my requirement that I need the record counts in separate files which is later fed into another process
Thanks,
Arun |
|
Back to top |
|
 |
prabhu118 Currently Banned New User
Joined: 11 Feb 2008 Posts: 14 Location: Chennai
|
|
|
|
yes you can get the record count in separate file
please find the details below
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=.....input file/
/T1 DD DSN=...total count in input file give some datasets name here
// UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,CATLG,DELETE),
// DCB=(LRECL=500,RECFM=FB,BLKSIZE=0)
//C1 DD DSN=...total count in each of the spillted outputs
// UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,CATLG,DELETE),
// DCB=(LRECL=80,RECFM=FB,BLKSIZE=0)
//CTL3CNTL DD *
OUTFIL FNAMES=(OUT01,OUT02,OUT03),
( .. since we are splitting into three we will be giving till out03... if say we have to split into 7 files we have to give till out07)
// DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
//OUT01 DD DSN=....split output1
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)
//OUT02 DD DSN=....split output2
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)
//OUT03 DD DSN=....split output3
// DISP=(,CATLG,DELETE),
// SPACE=(CYL,(25,25),RLSE),
// DCB=(RECFM=FB,LRECL=500,BLKSIZE=0)
//TOOLIN DD *
COPY FROM(IN) USING(CTL1)
COPY FROM(T1) TO(C1) USING(CTL2)
COPY FROM(IN) USING(CTL3)
/*
//CTL1CNTL DD * .... this will get the count in input file OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=11))
/*
//CTL2CNTL DD * ..divides the count generated in CTL1 by 3 as we are splitting into 3 output file
OUTREC BUILD=(2X,C'SPLIT1R=',
1,11,ZD,DIV,+03,TO=ZD,LENGTH=11,80:X)
/*
This will surely work...
try this out |
|
Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Prabhu,
My requirement is not to divide the total number of input records by 3.
I need the exact count of records in each of the split files.
Can you tell me how the above jcl covers the requirement. |
|
Back to top |
|
 |
prabhu118 Currently Banned New User
Joined: 11 Feb 2008 Posts: 14 Location: Chennai
|
|
|
|
run the jcl..
the output corresponding to dd name T1 will give you the count of records in input |
|
Back to top |
|
 |
Arun Raj
Moderator
Joined: 17 Oct 2006 Posts: 2482 Location: @my desk
|
|
|
|
Can you please explain how it will give the exact count in each of the output files like,
file1 - 34
file2 - 33
file3 - 33
As Alissa said, I think I will have to continue with multiple passes of data.
Thanks,
Arun |
|
Back to top |
|
 |
|
|