View previous topic :: View next topic
|
Author |
Message |
chk_varthi
New User
Joined: 28 Apr 2010 Posts: 2 Location: Hyderabad
|
|
|
|
Hi All,
My query is, there are 2 tables EMP & DEPT i have to declare a cursor using joins in a COBOL + DB2 program LIKE BELOW
EXEC SQL
DECLARE X CURSOR FOR SELECT T1.PNO, T2.PID FROM EMP T1, DEPT T2 WHERE T1.PNO = T2.PNO
END-EXEC
I am getting error SOC1 when opening the cursor. My assumption is that there is problem while DECLARE cursor highlighted above, instead of T1.PNO=T2.PNO we need to give some condition T1.PNO=????
Please suggest ASAP.Can pl send mail eAddr_removed@yahoo.com
Actual e-mail address removed
regards
CK |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello and welcome to the forum,
Due to problems in the past, we remove user e-mail addresses.
Why do you believe the s0c1 happens when opening this cursor?
What diagnostic information might have been generated by then pre-compile, compile, link, or bind?
We don't do ASAP,do please don't ask. . . |
|
Back to top |
|
|
chk_varthi
New User
Joined: 28 Apr 2010 Posts: 2 Location: Hyderabad
|
|
|
|
Hi,
I am giving the declare cursor coded in my program.
I am trying to declare a cursor using joins.
EXEC SQL
DECLARE L_CURSOR CURSOR FOR
SELECT C.PRFL_NBR,
C.USERID,
C.CHNNL_ID,
A.ATTCH_ACCT_NBR
FROM CENTRY C, ACCT A
WHERE
C.PRFLNBR = A.PRFLNBR
END-EXEC
EXEC SQL
OPEN L_CURSOR
END-EXEC
I am getting error when it came to OPEN cursor with SOC1 error. I think while declaring the cursor using joins is a problem. Can anyone help regarding this issue. How to declare cursor for the above condition
regards
CK |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
Hello,
It does no good to repeat the original post and not provide the requested answers. . .
Cursors often process a result set that is from a join. . . |
|
Back to top |
|
|
dbzTHEdinosauer
Global Moderator
Joined: 20 Oct 2006 Posts: 6966 Location: porcelain throne
|
|
|
|
actually, a declare cursor, does not execute any code.
the code generated by the db2 pre-compiler is executed, normally once,
at the very beginning of the program - before your first coding statement.
So, to say the OPEN is receiving a S0C1 because of the declare is rather
................
Take a look at why you receive S0C1 from the operating system.
Though you are receiving the error upon a CALL to db2,
solve your problem based on why a S0C1 can be issued. |
|
Back to top |
|
|
GuyC
Senior Member
Joined: 11 Aug 2009 Posts: 1281 Location: Belgium
|
|
Back to top |
|
|
|