Page 1 of 1

Rexx code to delete duplicate records

PostPosted: Fri May 02, 2014 7:10 pm
by ravisankarc
Hi,

I want a rexx code which can identify and delete the duplicate records. I searched in previous topics but couldn't find a relevant one.

Thanks in advance.

Regards
Ravi

Re: Rexx code to delete duplicate records

PostPosted: Fri May 02, 2014 7:43 pm
by enrico-sorichetti
I want a rexx code which can identify and delete the duplicate records.


You might want it... but You will not get it :evil:
this is a help forum, not a gimme something one.

search the forum on how to do it using sort
gazillions of examples around

Re: Rexx code to delete duplicate records

PostPosted: Fri May 02, 2014 8:26 pm
by ravisankarc
Hi Enrico,

I know deleting duplicate records using DFSORT, but I am looking a rexx code to do this. Because the other part of my requirement has been coded in rexx and don't want to use DFSORT in between.

Regards
Ravi

Re: Rexx code to delete duplicate records

PostPosted: Fri May 02, 2014 8:47 pm
by enrico-sorichetti
does not seem that much difficult to me

here is the logic

read one record into the old_record_buffer
do while more records left
    read one record into the new_record_buffer
    /* compare old and new */
    if old < new then
        move new to old
        iterate/continue
    if old = new
       process as needed
       iterate/continue
   if old > new
      take care of the error ( out of sequence )
end
process the record left ( the old one  )

Re: Rexx code to delete duplicate records

PostPosted: Fri May 02, 2014 9:26 pm
by enrico-sorichetti
:oops: forgot to write the record

instead of
    if old < new then
        move new to old


should be
    if old < new then
        write the old record
        move new to old