Can someone give me an example of using SETLL and READE to find a duplicate record for a keyed field.
Currently the file I am working with has 3 keyed fields. The field I am looking for duplicates in is the second key in sequence. I am not sure how to code this in free format, where I use READE and SETLL to find duplicate records.
/free
read filename;
dow not %eof(filename);
SETLL (XXPART)OUTPUTWORKFILE;
IF NOT %EQUAL(OUTPUTWORKFILE);
write OUTPUTWORKFILE;
enddo;
I know that I can't just jump to the second keyed field(XXPART), so I have to include the first keyed field (XXPLNT). Just not sure how to do that in free form. Also uncertain where I should put the reade.
Thanks in advance.
I don't think you need a reade
to do what you want. setll
should be sufficient as long as you don't need anything from outfile. Notice that you can use a compound key with setll
.
read filename;
dow not %eof(filename);
setll (xxplnt: xxpart) outputworkfile;
if not %equal(outputworkfile);
write outputworkfile;
endif;
read filename;
enddo;