View previous topic :: View next topic |
Author |
Message |
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Mon Mar 06, 2006 9:26 am Post subject: Processing the duplicate rows came out of Union All. |
|
|
Hi,
I searched the DB2/IMS part to find out how duplicate rows can be processed programatically that came out of an UNION ALL. But, I could not found the relavant info.
A COBOL-DB2 program combines two select statments with UNION ALL. The requirement is to process the duplicates also. How to achieve it?
Please explain.
TIA....... _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
kolusu Site Admin
Joined: 26 Nov 2002 Posts: 12372 Topics: 75 Location: San Jose
|
Posted: Mon Mar 06, 2006 9:35 am Post subject: |
|
|
mf_user,
Processing duplicate rows is one of the simplest task. define a working storage variable to hold the previous key
Code: |
01 WS-PREVIOUS-KEY PIC X(nn).
PERFORM FETCH CURSOR
IF FETCHED-VALUES = WS-PREVIOUS-KEY
PERFORM DUPLICATE PROCESSING
ELSE
PERFORM UNIQUE PROCESSING
MOVE FETCHED-VALUES TO WS-PREVIOUS KEY
END-IF
|
Hope this helps...
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
|
SureshKumar Intermediate
Joined: 23 Jan 2003 Posts: 211 Topics: 21
|
Posted: Mon Mar 06, 2006 9:35 am Post subject: |
|
|
mf_user,
Since the requirement is to process all rows(including dups) what difference does it make. your program logic must be built to handle it. You are making us 'guess' specific program requirements. thanks |
|
Back to top |
|
|
mf_user Intermediate
Joined: 01 Jun 2003 Posts: 372 Topics: 105
|
Posted: Tue Mar 07, 2006 1:39 am Post subject: |
|
|
Kolusu Thank you very much for the idea. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
== |
|
Back to top |
|
|
|
|