Posted: Tue Nov 11, 2003 6:21 am Post subject: SORT (split the files into 3 files viz..Hdr , Dtl , Trlr
Hi,
I have a file with header having Low-Values and trailer having High-Values and 1 to many detail records. I want to copy the header separately into a temp file and trailer separately into another temp file and all the details records into a separate file. I want to use Sort utility for this.
Here the input file is a variable length one with header and trailer layout being declared with COMP-3 and detail record with alpha and numeric combinations.
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Nov 11, 2003 11:34 am Post subject:
Kishore,
DFSORT's equivalent of COMP-3 is PD. Let's assume that your COMP-3 field is in positions 11-14 (4-byte PD field -> 7 decimal digits and a sign). I would assume that low-values would be P'0000000' (PD zeros) and high values would be P'9999999' (PD nines). If so, then you can do what you want with a DFSORT job like this.
Note: Since your file is VB, remember to account for the 4-byte RDW at the start of each record when determining starting positions.
If your low and high values do not look like that, then just change the INCLUDE conditions appropriately to handle what they do look like. For example, if your low-values are actually all binary zeros (X'00000000') and your high-values are actually all binary ones (X'FFFFFFFF'), then you could use these OUTFIL statements:
_________________ 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
is the trailer record.
both of them are declared in comp-3 format. Here i want to issue the selection criteria from third column onwards.
My actual requirement is to sort the detail records in the file without disturbing header and trailer record (header should be the first record and trailer should be the last record with all other detail records in the sorted order in the output file). The sorting should be based on some sequence number present in position 80 and 10 bytes long - comp -3. My requirement is to use only Sort and not ICETOOL.
The file layout is having header and trailer declared in COMP-3 format and the detail records in combinations of alpha and numeric format.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Nov 12, 2003 3:05 am Post subject:
Kishore,
As frank mentioned above your data is actually binary format. Your low-values are actually all binary zeros (X'00000000') and your high-values are actually all binary ones (X'FFFFFFFF'). PGM=SORT and PGM=ICEMAN can both be used to call "SORT". The following JCl will give you the desired results. A brief explanation of the JOb.
Step0100 will split the input file into 3 different files. HDR file will have Header record and TRl will have the trailer and all the detail records are copied into TRl file.
Step0200 takes this detail records file(D1) created in step0100 and sorts on the required field and creates a temp file D2.
Step0300 concatenates header file (H1) , Sorted detail record file(D2) and trailer file(T1) and copies into a final output file.
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Nov 12, 2003 7:10 am Post subject:
Srika,
That is one method of using referbacks which I use. I am concating 3 datasets and am using "*" to referback , "&" is a Symbolic Parameter.
For OLD data sets, if VOL=REF references a non-SMS-managed data set, the system assumes the data set is non-SMS-managed and on the same volume as the referenced data set. If VOL=REF references an SMS-managed data set, the system searches the catalog because the referencing data set might not be on the same volume as the referenced data set.
1. The INCLUDE cond for HDR and TLR are same
OUTFIL FNAMES=HDR,INCLUDE=(7,4,BI,EQ,X'00000000')
OUTFIL FNAMES=TRL,INCLUDE=(7,4,BI,EQ,X'FFFFFFFF')
OUTFIL FNAMES=DTL,SAVE
Both are starting at 7 columns of length 4 but the Trailer starts
after the data content?
2. please explain the Third statement. you didn't mentioned any include cond(Starting location and Length??? How does it assumes the starting position and length?
Joined: 26 Nov 2002 Posts: 12375 Topics: 75 Location: San Jose
Posted: Wed Jun 23, 2004 5:27 am Post subject:
kris_madras,
SAVE selects the records that are not selected for any other OUTFIL group. In the control cards you see the save parm will write out all other records which are not written to HDR or TRL file
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Tue Jun 29, 2004 12:49 pm Post subject:
kris wrote
Quote:
1. The INCLUDE cond for HDR and TLR are same
OUTFIL FNAMES=HDR,INCLUDE=(7,4,BI,EQ,X'00000000')
OUTFIL FNAMES=TRL,INCLUDE=(7,4,BI,EQ,X'FFFFFFFF')
OUTFIL FNAMES=DTL,SAVE
Both are starting at 7 columns of length 4 but the Trailer starts
after the data content?
Are you concerned that the OUTFIL for the the trailer record (TRL) comes before the OUTFIL for the detail records (DTL)? If that's your question, then the answer is that it doesn't matter because when you're writing out separate OUTFIL data sets, the OUTFIL statements can be in any order. The header record will be written to the HDR data set. The trailer record will be written to the TRL data set. The detail records will be written to the DTL data set.
The CON DD then concatenates these data sets in the correct order in which they need to be read in (header record, detail records, trailer record).
Quote:
2. please explain the Third statement. you didn't mentioned any include cond(Starting location and Length??? How does it assumes the starting position and length?
For more information on the SAVE parameter of DFSORT's OUTFIL, see "OUTFIL Features" - "OUTFIL: Subsets" in "Beyond Sorting" at:
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