View previous topic :: View next topic
|
Author |
Message |
zero
New User
Joined: 01 Dec 2007 Posts: 21 Location: Hyderabad
|
|
|
|
Hi,
My requirement is this. I have an input file like this :
11111
11111
11111
22222
22222
33333
33333
I am copying subsets of records into different output files using OUTFIL.
But, my requirement is to copy different no. of records for different files.
Eg :
Code: |
//SYSIN DD *
SORT FIELDS=COPY
OUTFIL FNAMES=OUT1,INCLUDE=(1,5,ZD,EQ,11111)
OUTFIL FNAMES=OUT1,INCLUDE=(1,5,ZD,EQ,22222)
OUTFIL FNAMES=OUT1,INCLUDE=(1,5,ZD,EQ,33333)
/* |
If use the above card, all "11111" records will go to file1; All "22222" records will go to file2; all "33333" records will go to file3;
But, my requirement is not to get all the records.
i would like to copy 3 records to file1; 2 records to file2; 1 record to file3.
is there any option with OUTFIL that can select only required no. of recs ?
(like, STOPAFT=n)
thanks |
|
Back to top |
|
|
zero
New User
Joined: 01 Dec 2007 Posts: 21 Location: Hyderabad
|
|
|
|
Sorry, in the above sort card, Output DD names are OUT1, OUT2, OUT3. |
|
Back to top |
|
|
Skolusu
Senior Member
Joined: 07 Dec 2007 Posts: 2205 Location: San Jose
|
|
|
|
zero wrote: |
If use the above card, all "11111" records will go to file1; All "22222" records will go to file2; all "33333" records will go to file3;
But, my requirement is not to get all the records.
i would like to copy 3 records to file1; 2 records to file2; 1 record to file3.
|
zero,
Assuming that your data is already sorted on the key , here is a JCL which would give you the desired results
Code: |
//STEP0100 EXEC PGM=ICEMAN
//SYSOUT DD SYSOUT=*
//SORTIN DD *
11111
11111
11111
22222
22222
33333
33333
//OUT1 DD SYSOUT=*
//OUT2 DD SYSOUT=*
//OUT3 DD SYSOUT=*
//SYSIN DD *
SORT FIELDS=COPY
OUTREC OVERLAY=(81:SEQNUM,8,ZD,RESTART=(1,5))
OUTFIL FNAMES=OUT1,BUILD=(01,80),
INCLUDE=(1,5,CH,EQ,C'11111',AND,81,8,ZD,LE,3)
OUTFIL FNAMES=OUT2,BUILD=(01,80),
INCLUDE=(1,5,CH,EQ,C'22222',AND,81,8,ZD,LE,2)
OUTFIL FNAMES=OUT3,BUILD=(01,80),
INCLUDE=(1,5,CH,EQ,C'33333',AND,81,8,ZD,LE,1)
/*
|
If the data is not sorted then just change the sort fields statement to
Code: |
SORT FIELDS=(01,05,CH,A)
|
|
|
Back to top |
|
|
|
|