Page 1 of 1

How to rmeove duplicate code which occur in same record

PostPosted: Fri Mar 26, 2010 7:49 am
by rizalradzi
Hi all,
I have input data as below:
KEY1|D8D8D8A8A9I1NNF8A7R2I1NNF8|
KEY2|I1NNH3I1NNH3|
KEY3|I1UPW3I1NNH3I1NNH3I1NNH3|

and the require output is:
KEY1|D8A8A9I1NNF8A7R2|
KEY2|I1NNH3|
KEY3|I1UPW3NNH3|

The input file is VB:
01 INP-DELQ-REC.
02 I-AA-NO PIC X(4).
02 FILLER PIC X.
02 I-REASON-CODE-ALL PIC X(1001).

The I-REASON-CODE-ALL is an occurance of a sets of 2 Char Code (variable length) and will end with pipe "|".

The logic is, I need to remove duplicate 2 char code (in I-REASON-CODE-ALL).

Pls help.

thanks.
Rizal.

Re: How to rmeove duplicate code which occur in same record

PostPosted: Fri Mar 26, 2010 8:08 am
by dick scherrer
Hello and welcome to the forum,

What have you done so far? Where are you having problems?

We will help you get this done, but we won't do the work for you.

Suggest you consider creating an array in working-storage to hold the unique values. Then, using reference modification, move each new unique value into the array.

Re: How to rmeove duplicate code which occur in same record

PostPosted: Fri Mar 26, 2010 8:27 am
by rizalradzi
Wow.
Thanks for the fast replied.
:) still struggling with the array with a simple move & compare.
I'll try as per your advice.

thanks again.
Rizal.

Re: How to rmeove duplicate code which occur in same record

PostPosted: Fri Mar 26, 2010 8:46 am
by dick scherrer
You're welcome - good luck :)

d

Re: How to rmeove duplicate code which occur in same record

PostPosted: Mon Mar 29, 2010 12:10 pm
by dick scherrer
Any progress? Problems?

d