Query related to cursor



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

Query related to cursor

Postby Raju » Wed Jan 07, 2009 1:21 pm

Please help me

Can i define a cursor as mentioned below in my cobol program

EXEC SQL
DECLARE UBO-CURSOR CURSOR WITH HOLD FOR SELECT
OBJECTID1
, COUNT(*)
FROM TMGJOINING A,
TMGPARTJOIN B
WHERE A.JOINING_ID = B.JOINING_ID
AND JOINING_TYPENUMBER = 21
AND PARTICIPANT_TYPENR = 1
GROUP BY OBJECTID1
HAVING COUNT(*) > 1
END-EXEC.

Problem is that i want to fetch the count alongwith objectid1 for this i had defined two host variables WS-OBJECTID1 and WS-COUNT but while compilation time it is giving error that the host variable WS-COUNT is unusable.
Is there any other way to get that count???
Raju
 
Posts: 1
Joined: Wed Jan 07, 2009 12:59 pm
Has thanked: 0 time
Been thanked: 0 time

Re: Query related to cursor

Postby dick scherrer » Thu Jan 08, 2009 1:52 am

Hello Raju and welcome to the forum,

Is there any other way to get that count???
I believe not if you use HOLD. . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post