Posted: Mon Jun 20, 2005 6:33 am Post subject: Eliminate Dups & Update Trailer count using syncsort
Hi,
I am using Syncsort.
My requiremnt ,i have a file having header,detail lines and trailer.
Trailer contains the count of detail lines,and other info also which cannot be hardcoded,
My output should be a file with header,detail lines(remove duplicates) and trailer should contain count of detail lines(excluding duplicates)
Ex:
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Jun 20, 2005 7:38 am Post subject:
Vasavi,
The following JCL will give you the desired results. I assumed that your input file is of FB recfm and is has lrecl of 80. I assumed you have to remove duplicates considering 3 fields which start at pos 1 for 3 bytes and at pos 5 for 3 bytes and at pos 9 for 9 bytes. I also assumed that you header record is recongnized by 'header' in the first 6 bytes and similarly trailer by 'trailer' in the first 7 bytes. We first add a indicator at the end to make sure that header record always stays at the top and the trailer at the bottom.
Now we sort on the the key fields along with the indicator at the end and eliminate dups. But to get the updated count excluding the header record is a little bit tricky. We add a seqnum on OUTREC FIELDS which starts from zero. By doing so, the header record is not counted as part of the records. And we use this on the trailer for getting the total detail records after you are done with eliminating the dups.
My trailer doesn't have any 'TRAILER' word to represent as trailer.
My Trailer looks like
<DATE> <COUNT>
Date is not current date,its date from file so i cna't even write it as constant.
Ex:
040505 003
040505 is value from a file which can't be tretaed as constant.
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Jun 20, 2005 11:54 am Post subject:
vasavi,
The following JCL will give you the desired results. Since there is no indicator to reprenst the trailer record, we need an additional pass.
A brief explanation of the job. we first add a seqnum at the end of all records and sort on that seqnum descending. By doing so, we have the trailer record as the first record.
Now we split the file into 3 files, namely TRL, DTL and HDR files.
TRL file will be symbol file which will be used in the next step.
The HDR file will just have the header record and DTL file will have all the detail records.
The next step we concatenate the HDR and DTL file and sum sort on the key fields to eliminate the duplicates and use the symbol to update the trailer count.
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Wed Jun 22, 2005 4:36 am Post subject:
vaasavi,
Syncsort manuals are copyrighted and hence are not available online. If your shop has a valid licence you can contact your sys admin for a copy of the manual
Hi Kolusu,
Your JCL is woring fine for datasets with lrecl=80,if i am trying to use same jcl for input file with lrecl=200,it's not working,it is getting abended.
jcl which i used is
Joined: 26 Nov 2002 Posts: 12377 Topics: 75 Location: San Jose
Posted: Mon Jun 27, 2005 5:05 am Post subject:
vaasavi,
Your JCL has many errors.You are adding a seqnum and sorting on it in ASCending sequence which will be the same as input.
Since you can identify the header(H) and detail(D) records you really don't need a seqnum.You are right about SYMNAMES DD . It must have the following attributes: RECFM=F or RECFM=FB and LRECL=80.
You are not eliminating any dups, then I wonder what is the purpose of your JCL?
It is always a good idea to understand the JCL and change it to your needs instead of simply copying it.
From your JCL I understood that you have a file with the following attributes
LRECL=200, RECFM=FB
The header record can be identified with 'h' in the first byte and the detail records can be identified with 'd' in the first byte.
Now where are your key fields that are considered to dups?
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