Posted: Wed May 04, 2005 2:45 am Post subject: Combine Different Records with Sort
Hi,
I have an input file, which will have different types of records. Each record type is identified from 1st Digit of the record. Record types can be 'A','F','E' and 'B'. First A - Type record will come, followed by F & E and ends with B type. There is no specific sequence followed by F & E type records. But, A bunch of records start with record type A and end with Record type B .
I want to combine some fields in Record Type A and Record Type B. Is it possible through Sort(even by E35 Exit).
Here is the sample Input file and expected out put.
INPUT FILE
Joined: 02 Dec 2002 Posts: 1618 Topics: 31 Location: San Jose
Posted: Wed May 04, 2005 10:09 am Post subject:
Siva,
Are you pairing up the A and B records based on a common key in the records (e.g. position 4 in your example above), or based on their location in the file (e.g. first A record and first B record, second A record and second B record, etc)? _________________ 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
There is no common key between the type of records. What I know is I will get 'A' type record first and 'B' type record last. Intermediate record types I need to ignore.
Change the PGM name to ICETOOL if you have DFSORT in your shop.
Brief Desc:
1. The first COPY operator creates a temporary file like this,
Code:
AXY1 0000
B PQ1 0000
AXY2 0001
B PQ2 0001
AXY3 0002
B PQ3 0002
2. The second SORT operator sorts the records on the sequence number, thus grouping each A-B pair and then performs a BINARY summation on the field in B-RECORD which merges the two records together.
Let me know if you need more information on the logic.
Joined: 07 Jan 2003 Posts: 1056 Topics: 91 Location: The Blue Planet
Posted: Thu May 05, 2005 6:00 am Post subject:
Yes Kolusu you are correct.
It would be much simpler if the data is divided across two datasets. Frankly speaking, I didn't think of that option at all.
Just an after-effect of the series of "Sort Challenges" (to accomplish the result using min. number of steps / datasets) that we were having some time back !!!
_________________ 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
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