Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Thu Sep 25, 2008 3:40 pm Post subject:
Sqlcode,
Here's a DFSORT/ICETOOL job that will do what you asked for. I assumed your input file and output files have RECFM=FB and LRECL=80, but you can change the job appropriately for other attributes. The job uses DFSORT's new SUBSET and WHEN=GROUP functions available with z/OS DFSORT V1R5 PTF UK90013 (July, 2008).
Frank,
Could you please briefly explain me logic behind this control card?
Here is what I understood:
CTL1 builds dynamic sort control card to split file into N dynamic output files. It uses RECORDS= N to decide when to start writting to new file. SPLIT1R decides records will be written to how many output files.
I can't understand logic behind CTL2. Here we create a GROUP but without any RECORDS or BEGIN condition!!!
I am trying to understand this control card so that if requirement changes I should be able to do it.
Frank,
I get the logic after staring it for almost 50 minutes .
But now I have one more question (though its not a requirement but trying to learn), How Do I align First record and last records for each section horizontally so that final LIMIT file would look like as below :
LIMITFILE
Code:
11111111 --> Start of File 1 33333333 --> End of File 1
44444444 --> Start of File 2 66666666 --> End of File 2
..
..
34567890 --> Start of File 5 56789012 --> End of File 5
Can we merge TRAILER3 with HEADER3 as mentioned below :
Code:
SECTIONS=(81,1,
HEADER3=(1,8,5X,C'--> Start of File ',81,1,
TRAILER3=(1,8,5X,C'--> End of File ',81,1)))
Logic here to get first record and last record for each section.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Sat Sep 27, 2008 11:25 am Post subject:
Quote:
I can't understand logic behind CTL2. Here we create a GROUP but without any RECORDS or BEGIN condition!!!
CTL2CNTL does have RECORDS=n - it comes from the C1 data set.
Quote:
Can we merge TRAILER3 with HEADER3 as mentioned below
No. HEADER3 writes a record before the data records of each section. Any fields you specify in HEADER3 are taken from the first record of the section. TRAILER3 writes a record after the data records of each section. Any fields you specify in TRAILER3 are taken from the last record of the section.
Combining them would require a different approach, or possibly another pass. _________________ 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
Could you please help me out with combining start of record and end record?
OUT01-OUT05 would still be the same but LIMIT File will be as shown below :
_________________ 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
11111111 --> START OF FILE 1 33333333 --> END OF FILE 1
44444444 --> START OF FILE 2 66666666 --> END OF FILE 2
77777777 --> START OF FILE 3 99999999 --> END OF FILE 3
00000000 --> START OF FILE 4 23456789 --> END OF FILE 4
34567890 --> START OF FILE 5 56789012 --> END OF FILE 5
Frank & Kolusu,
When I ran the job with actual input dataset, it seems like not working as per required.
Input file has about 50000 records and I am trying to split that into 10 diffrent files. Here Total number of output file remains same. So I have modified SORTCARD to hardcode SPLIT1R=10(It did same without hardconding as well).
The intermediate SORT CARD generated is as shown below :
Since I intend to split input file in 10 output file, my SPLIT File should only have 10 records with start and end record but instead it has about 5K records. It also wrote only 10 records to each output file(OUT01 thru OUT09) and wrote rest of the records to OUT10(last output dataset).
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
Posted: Tue Sep 30, 2008 4:05 pm Post subject:
Sqlcode,
sqlcode wrote:
When I ran the job with actual input dataset, it seems like not working as per required.
Input file has about 50000 records and I am trying to split that into 10 diffrent files. Here Total number of output file remains same. So I have modified SORTCARD to hardcode SPLIT1R=10(It did same without hardconding as well).
SQLCODE,
if you are planning to split into 10 files then the SPLIT1R should be equal to 50,000/10 = 5,000 you have code just 10 and it is not going to work. Also since you have 10 files I suggest using ID=2 instead of 1 as it would have a proper counter.
Use the following control cards as IS which will give you the desired results
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