MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Processing the duplicate rows came out of Union All.

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database
View previous topic :: View next topic  
Author Message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Mon Mar 06, 2006 9:26 am    Post subject: Processing the duplicate rows came out of Union All. Reply with quote

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. Surprised Shocked How to achieve it?

Please explain.

TIA....... Arrow
_________________
MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Back to top
View user's profile Send private message Send e-mail
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12372
Topics: 75
Location: San Jose

PostPosted: Mon Mar 06, 2006 9:35 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
SureshKumar
Intermediate


Joined: 23 Jan 2003
Posts: 211
Topics: 21

PostPosted: Mon Mar 06, 2006 9:35 am    Post subject: Reply with quote

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
View user's profile Send private message
mf_user
Intermediate


Joined: 01 Jun 2003
Posts: 372
Topics: 105

PostPosted: Tue Mar 07, 2006 1:39 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Database All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group