Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Problem in declaring cursor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
chk_varthi

New User


Joined: 28 Apr 2010
Posts: 2
Location: Hyderabad

PostPosted: Thu May 20, 2010 7:26 am    Post subject: Problem in declaring cursor
Reply with quote

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

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 20, 2010 7:42 am    Post subject:
Reply with quote

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

New User


Joined: 28 Apr 2010
Posts: 2
Location: Hyderabad

PostPosted: Thu May 20, 2010 9:02 am    Post subject:
Reply with quote

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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Thu May 20, 2010 9:10 am    Post subject:
Reply with quote

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

Global Moderator


Joined: 20 Oct 2006
Posts: 6968
Location: porcelain throne

PostPosted: Thu May 20, 2010 12:31 pm    Post subject:
Reply with quote

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

Senior Member


Joined: 11 Aug 2009
Posts: 1281
Location: Belgium

PostPosted: Fri May 21, 2010 6:28 pm    Post subject:
Reply with quote

search forum ?
http://www.ibmmainframes.com/viewtopic.php?t=46003&highlight=s0c1
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Strings with double quotes having pro... raja Arumugam All Other Mainframe Topics 11 Thu Mar 30, 2017 10:34 am
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Problem reading GTF trace output danik56 ABENDS & Debugging 7 Thu Mar 16, 2017 1:02 pm
No new posts ROUNDED Problem with COMPUTE statement shalem COBOL Programming 11 Thu Feb 09, 2017 8:16 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us