Posted: Mon Jan 08, 2007 12:56 pm Post subject: Appending records in a file based on a Key - Syncsort
I apologize if a similar questions has been asked before in this forum. I searched through the posts . But couldnt anything similar to the scenario i am posting.
Requriement:One input file - 1 Million Records (Sequential file)
Format: VB
LRECL = 5980
The input file has two record types 10 and 20. The key field is in postion 8 (9 bytes - character). There can be only one 10 record and one 20 record for a key. And the file is sorted based on the key (20 record is the record next to corresponding 10 record). I have added 4 bytes to the keyfield positions since it is a variable block file.
My requirement is to create a new file out of the input file with the some data from record 10 and some data from record 20.
Example:
Input
Code:
10AABCDEFGHI 00ASD VIJAY 1111
20BABCDEFGHI 00THIS IS A TEST FILE P
10AEFGHIJKLM 99ASD INDIGO 9999
20BEFGHIJKLM 99THIS IS A TEST FILE L
My output should be:
Code:
ABCDEFGHI 00 VIJAY 1111 P
EFGHIJKLM 99 INDIGO 9999 L
I am trying to append the 20 record to the corresponding 10 record based on the key. Is there any way to accomplish that using SYNCSORT? If the records are appended into one, i can easily extract the data in need using OUTREC.
Any help in this regard would be greatly appreciated.
Joined: 26 Nov 2002 Posts: 12401 Topics: 75 Location: San Jose
Posted: Mon Jan 08, 2007 8:57 pm Post subject:
s_vijay_s,
I wrote the sort card based on your sample input and I assumed positions of couple of fileds. Tell me the exact positions of the following
1. Where does the indicator 10 or 20 start in the input file?
2. As per your description the key starts at pos 9 (including rdw) ? Is that right?
3. Where does the value 00 & 99 start in the input file?
4. Where does the fields Vijay and Indigo start in the input file?
5. Where does the values "p" & "L" start in the input file?
6. Do you want the output also to be a VB file ? or a fB file?
7. What is the version of syncsort you are running? You can find this in the first line of your sysout from the sort job.
Kolusu,
Sorry I should have made my requirements clear in my first post. All the positions i have mentiond below are inclusive of the RDW.
1) Indicator 10 or 20 start at position 5
2) The Key field starts at position 8 and is 9 bytes long.
3) 00 or 99 start at position 23
4) Vijay or Indigo starts at 34 and is 9 byte long
5) P or L starts at 49
6) The output should also be an VB file
7) "SYNCSORT FOR Z/OS 1.2.1.0R" is the version of SYNCSORT I am running.
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