I have an input file with 4 fields (FB 80). The first field (pos 1-4) is the key on which I am doing the comparison. The third field (pos 10) can have values Y/N.
Code:
SRK1 AK1 Y XYZ
SRK1 AK2 N DFG
SRK1 AK3 N ERT
SRK2 AK4 N GTY
SRK2 AK5 N JKU
SRK3 AK6 Y JKL
SRK4 AK7 N POI
SRK4 AK8 Y QWE
SRK5 AK9 N QST
If for a key, we have a record with Y in the third column, all other records for the key need to be removed (only one record will be present with Y for any key in the input file). If for a key only N records are present, then all duplicates should be retained. Currently, I am splitting this file into 2, one with all Y recs and the other with N and then using an easytrieve to get my final result. The final file looks like this.
Code:
SRK1 AK1 Y XYZ
SRK2 AK4 N GTY
SRK2 AK5 N JKU
SRK3 AK6 Y JKL
SRK4 AK8 Y QWE
SRK5 AK9 N QST
Is it possible to do this in a single step using SORT? Thanks for your inputs.
Joined: 15 Feb 2005 Posts: 7129 Location: San Jose, CA
It's difficult to come up with a job that will work for you when we don't know which functions you can use and which you can't. You say you don't have WHEN=GROUP, but we don't even know if you have IFTHEN, OVERLAY, etc. I guess as a start, we should determine your exact level of DFSORT. Run this job and show your //SYSOUT messages:
Thank you Frank for the response. The current version supports IFTHEN clause and the OVERLAY sub-parameter. WHEN=INIT, WHEN=(logical expression) and WHEN=NONE work without any issues.
As Frank suggested run the job and show your sysout messages. It will save our time and give us an idea about what other features will not work in DFSORT level you are using.