View previous topic :: View next topic |
Author |
Message |
SRI123 Beginner
Joined: 01 Jun 2012 Posts: 18 Topics: 7
|
Posted: Tue Oct 13, 2015 3:40 am Post subject: SORT logic for multirecord value checking |
|
|
Hi
How to write logic checking for multiple records?
I have input file in this format with these 3 fields - EMPNO EMPTYPE Description. Each EMPNO can have 3 types of datatypes - type-1,type-2,type-3. It means it can have 3 records with 3 data types. If type-1, type-2 and type-3 records present, then write only type-1 record to output file. If type-2 and type-3 records present, then write type-2 record to output file. if type-3 record only present, then write type-3 record to output file.
Sample data is:
10 TYPE-1 TYPE-1-RECORD
10 TYPE-2 TYPE-2-RECORD
10 TYPE-3 TYPE-3-RECORD
20 TYPE-2 TYPE-2-RECORD
20 TYPE-3 TYPE-3-RECORD
30 TYPE-2 TYPE-3-RECORD
40 TYPE-1 TYPE1-RECORD
OUTPUT FILE:
10 TYPE-1 TYPE-1-RECORD
20 TYPE-2 TYPE-2-RECORD
30 TYPE-3 TYPE-3-RECORD
40 TYPE-1 TYPE-1-RECORD
Thanks |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Tue Oct 13, 2015 5:17 am Post subject: |
|
|
Is is possible that there is a TYPE-2-RECORD only? What do you want then?
Have a look at ICETOOL's SELECT operator. At the moment you are asking for the first record for the key. |
|
Back to top |
|
|
SRI123 Beginner
Joined: 01 Jun 2012 Posts: 18 Topics: 7
|
Posted: Tue Oct 13, 2015 5:26 am Post subject: |
|
|
Yes only TYPE-2 record can be possible, then only TYPE-2 rec need to be written.
Is it possible thru DFSORT? |
|
Back to top |
|
|
William Collins Supermod
Joined: 03 Jun 2012 Posts: 437 Topics: 0
|
Posted: Tue Oct 13, 2015 5:39 am Post subject: |
|
|
It would be possible through DFSORT, but what is the problem with using ICETOOL (which you have if you have DFSORT)?
For DFSORT, you could look at a MERGE on your key, with a single input DD (SORTIN01) and OPTION EQUALS, then SUM FIELDS=NONE.
Or you could code that out yourself, appending a SEQNUM with a RESTART on your key, and on OUTFIL have INCLUDE= for a value of one on the sequence number and a BUILD to return the record to it's original size. |
|
Back to top |
|
|
SRI123 Beginner
Joined: 01 Jun 2012 Posts: 18 Topics: 7
|
Posted: Wed Oct 14, 2015 1:33 am Post subject: |
|
|
Thank you Got desired result |
|
Back to top |
|
|
|
|