How to rmeove duplicate code which occur in same record



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

How to rmeove duplicate code which occur in same record

Postby rizalradzi » Fri Mar 26, 2010 7:49 am

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.
rizalradzi
 
Posts: 2
Joined: Fri Mar 26, 2010 7:33 am
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby dick scherrer » Fri Mar 26, 2010 8:08 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

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

Postby rizalradzi » Fri Mar 26, 2010 8:27 am

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.
rizalradzi
 
Posts: 2
Joined: Fri Mar 26, 2010 7:33 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Fri Mar 26, 2010 8:46 am

You're welcome - good luck :)

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

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

Postby dick scherrer » Mon Mar 29, 2010 12:10 pm

Any progress? Problems?

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post