I have a variable length record and I have to select the rows based on particular set of values and the output file should not contain redundant records. (avoid duplicates and have only the first record found)
I have used the following with ICETOOL and it worked fine.
SELECT FROM(SORTIN1) TO(SORTOUT) ON(VLEN) -
ON(1,2,PD) ON (3,4,CH) -
In case, if I have to retain the header and trailer, do we have any way to
add in the above statement.
(I have one header and one trailer record in the file).
(or) do we have to use only datasort to achieve this ?
What does your header record look like? What does your trailer record look like? In particular, is there something in the header and trailer record that identify them as such (e.g. '0' in position 5 for header and '9' in position 5 for trailer)?
a) The output should not have redundant records
(Order of the sorting should be:
(3,3,CH,A) (6,3,CH,A) (9,7,CH,A), (1,2,CH,A) )
b) Header and Trailer should be retained
I had a problem when I used VLEN, as (1,2,BI) was also getting executed which affected the sort order. When I removed it, everything was in place except for Header & Trailer.Just thinking if we have some logic to incorporate in the same 'select for' command'
You don't seem to understand VB records. VB records have an RDW in positions 1-4 followed by the data starting in position 5. So all of your starting positions are wrong.
Also, you only show the header and trailer and one data record, so I can't tell if the data records all start with '01' or not. Do they? If all of the data records start with '01', this is much easier.
Please show a more complete example of input records and expected output records.
Also, please show the //DFSMSG messages you received for your run so I can verify that you really have VB records.