Not sure what you mean by splitting a file dynamically. If you are looking for a job that splits the file into two, SORT will do it for you. Please search for keyword SPLIT in this form to find lots of examples for splitting a file.
Sorry for not being clear.
Requirement : I have a transaction file. Number of records in the file keep changing daily. Assume file has 100 records.I need to copy first 50 in one file and the next 50 in another file.
The number 100 can vary. If the number is 50 then i need to copy 25 into one file and remaining 25 in to another file.
I have gone thru SPLIT keyword but it is not helping in solving this.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Fri May 12, 2006 12:36 pm Post subject:
Here's a new solution for this requirement that uses the SPLIT1R function of DFSORT available with z/OS DFSORT PTF UK90007 and DFSORT R14 PTF UK90006. Whereas SPLITBY can rotate back to the first data set, resulting in non-contiguous records, SPLIT1R only does one rotation so the records are always contiguous.
Here's a DFSORT job that uses SPLIT1R dynamically to divide any number of input records among any number of output files:
Code:
//S1 EXEC PGM=ICETOOL
//TOOLMSG DD SYSOUT=*
//DFSMSG DD SYSOUT=*
//IN DD DSN=... input file
//T1 DD DSN=&&T1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//C1 DD DSN=&&C1,UNIT=SYSDA,SPACE=(TRK,(1,1)),DISP=(,PASS)
//CTL3CNTL DD *
OUTFIL FNAMES=(OUT01,OUT02,...,OUTnn), <--- change for nn
// DD DSN=*.C1,VOL=REF=*.C1,DISP=(OLD,PASS)
//OUT01 DD DSN=... output file01
//OUT02 DD DSN=... output file02
...
//OUTnn DD DSN=... output filenn <--- change for nn
//TOOLIN DD *
* Get the record count.
COPY FROM(IN) USING(CTL1)
* Generate:
* SPLIT1R=x where x = count/nn.
* nn is the number of output files.
COPY FROM(T1) TO(C1) USING(CTL2)
* Use SPLIT1R=x to split records contiguously among
* the nn output files.
COPY FROM(IN) USING(CTL3)
/*
//CTL1CNTL DD *
OUTFIL FNAMES=T1,REMOVECC,NODETAIL,
TRAILER1=(COUNT=(M11,LENGTH=8))
/*
//CTL2CNTL DD *
OUTREC BUILD=(2X,C'SPLIT1R=',
1,8,ZD,DIV,+nn, <--- set to nn
TO=ZD,LENGTH=8,80:X)
/*
For complete information on SPLIT1R and the other new DFSORT/ICETOOL functions available with the April, 2006 PTFs, see:
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum