Joined: 02 Dec 2002 Posts: 48 Topics: 9 Location: Columbus, GA
Posted: Tue Dec 03, 2002 4:52 pm Post subject: Split a sequential file to n number of files having 1 record
Hai all,
I have a sequential file which may have records from 1 to n. I want to split the file to n number of files each having single record. 'n' varies from 1 to 100. LRECL of the file is 32760. ( n will be always 1 - 100).
Suppose I have a file AAA.BBB.CCC with 3 records. I need AAA.BBB.CCC001 and
AAA.BBB.CCC002 and AAA.BBB.CCC003 with First and second and third records on it respectively.
Can any one help me to do this. _________________ Thanks,
Jeba
(Known is a drop Unknown is an ocean)
The first record will go to OUT001, the second record will go to OUT002, and so on until you run out of records or get to record 100 which will go to OUT100. OUTnnn data sets without a corrresponding record will be empty. For example, if you have 98 records, then AAA.BBB.CCC099 and AAA.BBB.CCC100 will be empty.
If this isn't what you want to do, then please describe what you want to do in more detail. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Last edited by Frank Yaeger on Tue Dec 03, 2002 6:45 pm; edited 1 time in total
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Dec 03, 2002 6:47 pm Post subject:
Jeba,
Is that what you wanted to do? _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 02 Dec 2002 Posts: 48 Topics: 9 Location: Columbus, GA
Posted: Tue Dec 03, 2002 10:52 pm Post subject:
Frank,
This is what I expected. But the only thing I don't like is (100 - n ) Empty files will be created. Is there any way to get n number of files alone ? _________________ Thanks,
Jeba
(Known is a drop Unknown is an ocean)
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Wed Dec 04, 2002 5:20 am Post subject:
Jeba,
The following DFSORT/ICETOOL JCL will give you the results.If you have syncsort at your shop, then change the pgm name to synctool.A brief explanation of the job.Since you wanted only output files corresponding to the no: of records in the file, we create dynamic control cards.
Step010 is create the control cards.we use inrec to have just the seqnum and we sort descending on the seqnum, so that the last record will be first.we create 4 temp files.
File T1 will be as follows:
Code:
OUTFIL SPLIT,FNAMES=(OUT001,
File T2 will be as follows:
Code:
OUT002,
OUT003,
OUT004,
File T3 will be as follows:
Code:
OUT005)
File T4 will have the jcl allocation for these 5 files.
to create the OUTnnn statement since ENDREC=1 gets the first record which has nnn. This is a clever way to easily access the count of records. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Sun Jan 05, 2003 10:45 am Post subject:
Rajvasan,
We need to sort in the descending order so that we will know the max : of files to be created.Let us you have 25 records in your file.
The sysin cards are as follows
Code:
INREC FIELDS=(SEQNUM,3,ZD)
SORT FIELDS=(1,3,ZD,D)
Now the last record will be the first record and this tells us as to how many files to be created.
If you don't sort in descending order , there is no way to know the no: of files to be created.
the job builds the dynamic control cards. So we need to know the last record to end the control cards.Look at the closing parenthesis.So sorting on descending seqnum will give the last record and we can use that record to end the dynamic control cards.
Note EQ,1 instead of EQ,2. EQ,2 would omit the next to last record, but you really want to omit the last record which has sequence number 1. With 2, both T2 and T3 will have OUT002. With 1, T2 won't have any records and T3 will have OUT002.
For completeness (even though it's not likely to be a problem), note that either way, this won't work for just one record because both T1 and T3 will have OUT001. _________________ Frank Yaeger - DFSORT Development Team (IBM)
Specialties: JOINKEYS, FINDREP, WHEN=GROUP, ICETOOL, Symbols, Migration
DFSORT is on the Web at:
www.ibm.com/storage/dfsort
Joined: 26 Nov 2002 Posts: 12376 Topics: 75 Location: San Jose
Posted: Sun Jan 05, 2003 11:20 am Post subject:
Thanks Frank. I have changed the control cards for T2. As always there is a catch for every solution like in this case having just 1 record in the input file.
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