View previous topic :: View next topic
|
Author |
Message |
Vidusha
New User
Joined: 01 Feb 2006 Posts: 20 Location: Chennai
|
|
|
|
How to split records in a dataset to multiple dataset.
Say there is a input dataset with 50,000 records. I want to copy them to 5 dataset 10,000 each. (based on the count)
Could any one provide solution for this.
Thanks in advance
Vidhya |
|
Back to top |
|
|
Rupesh.Kothari
Member of the Month
Joined: 27 Apr 2005 Posts: 463
|
|
|
|
Hi Vidhya
This topic already discussed in forum so may times. Please make search you will get lot of material...
Regards
Rupesh |
|
Back to top |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
Hi vidhya,
try this...
//step exec pgm=sort
//sortin dd dsn=input file
//sortof1 dd dsn=file1
//sortof2 dd dsn=file2
//sortof3 dd dsn=file3
//sortof4 dd dsn=file4
//sortof5 dd dsn=file5
//sysin dd *
option copy
outfil fnames=(1,2,3,4,5),splitby=10000
/*
This might work...
corrections welcomed...
Thanks,
Rajesh |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Quote: |
outfil fnames=(1,2,3,4,5),splitby=10000 |
Actually, that should be FILES= not FNAMES=.
Quote: |
Say there is a input dataset with 50,000 records. I want to copy them to 5 dataset 10,000 each. (based on the count) |
Here are two ways to do this with DFSORT:
Code: |
//S1 EXEC PGM=SORT
//SORTIN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//OUT3 DD DSN=... output file3
//OUT4 DD DSN=... output file4
//OUT5 DD DSN=... output file5
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=(OUT1,OUT2,OUT3,OUT4,OUT5),SPLITBY=10000
/*
|
Code: |
//S2 EXEC PGM=SORT
//SORTIN DD DSN=... input file
//OUT1 DD DSN=... output file1
//OUT2 DD DSN=... output file2
//OUT3 DD DSN=... output file3
//OUT4 DD DSN=... output file4
//OUT5 DD DSN=... output file5
//SYSIN DD *
OPTION COPY
OUTFIL FNAMES=OUT1,ENDREC=10000
OUTFIL FNAMES=OUT2,STARTREC=10001,ENDREC=20000
OUTFIL FNAMES=OUT3,STARTREC=20001,ENDREC=30000
OUTFIL FNAMES=OUT4,STARTREC=30001,ENDREC=40000
OUTFIL FNAMES=OUT5,SAVE
/*
|
|
|
Back to top |
|
|
rajesh_1183
Active User
Joined: 24 Nov 2005 Posts: 121 Location: Tadepalligudem
|
|
|
|
Hi frank..
Is that FNAMES= or FILES= ...????
becoz u have also written FNAMES=...
clarify it plz..
Thanks,
Rajesh |
|
Back to top |
|
|
Frank Yaeger
DFSORT Developer
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
|
|
|
|
Rajesh,
You can use FNAMES or FILES, but you have to use them properly to connect up with the OUTFIL ddnames.
I prefer FNAMES because it can be used with any ddnames, e.g.
Code: |
//OUT1 DD DSN=...
//OUT2 DD DSN=...
...
FNAMES=(OUT1,OUT2)
|
If you use FILES, then the ddname must be of the form SORTOFx or SORTOFxx and you only specify x or xx, e.g.
Code: |
//SORTOF1 DD DSN=...
//SORTOF2 DD DSN=...
...
FILES=(1,2)
|
In your case, you needed FILES=(1,2,3,4,5) but you had FNAMES=(1,2,3,4,5). |
|
Back to top |
|
|
|
|