IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DB2 Question - Choose the best


IBM Mainframe Forums -> Mainframe Interview Questions
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
CIS777
Currently Banned

New User


Joined: 16 Sep 2005
Posts: 6

PostPosted: Fri Sep 30, 2005 8:04 pm
Reply with quote

The following are the only SQL statements contained in program PGMA:

EXEC SQL DECLARE CSR CURSOR FOR SELECT C1, C2, C3, SUM(C4) FROM T1
WHERE C5 = :HV5 AND C6 = :HV6 GROUP BY C1, C2, C3 END-EXEC.
EXEC SQL OPEN CSR END-EXEC.
EXEC SQL FETCH CSR INTO :HV1, :HV2, :HV3, :HV4 END-EXEC.

Which of the following statements correctly describe the result if PGMA is executed multiple times?

A. An SQLCODE -904 is received the second time PGMA executes.

B. An SQLCODE -502 is received the second time PGMA executes.

C. PGMA runs to completion, but an error message is issued stating that the cursor was not closed.

D. The program executes successfully, fetching a row if a qualifying row exists.

E. After PGMA executes once, an SQLCODE 100 will be returned on subsequent executions, since the cursor was never closed and reopened with new host variable values.
Back to top
View user's profile Send private message
EnjoyMF

New User


Joined: 27 May 2005
Posts: 88

PostPosted: Sat Oct 08, 2005 12:39 pm
Reply with quote

if we try to open the curson again with out closing it we get
B. An SQLCODE -502 is received the second time PGMA executes.

logically fetch is done multiple times and then check for sqlcode = 100 then close the cursor in the program


Regards
prasad
Back to top
View user's profile Send private message
akkoor

New User


Joined: 08 Oct 2005
Posts: 9

PostPosted: Sat Oct 08, 2005 8:05 pm
Reply with quote

We should get a -504
for trying to open an already open cursor
Back to top
View user's profile Send private message
nikyojin

New User


Joined: 05 Oct 2005
Posts: 94

PostPosted: Tue Oct 11, 2005 2:29 pm
Reply with quote

The Release parameter value while Bind if specified as Deallocate will automatically close the cursor once the job ends.
Hence
Quote:
D. The program executes successfully, fetching a row if a qualifying row exists.


else
Quote:
B. An SQLCODE -502 is received the second time PGMA executes.

since the cursor is left open....
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> Mainframe Interview Questions

 


Similar Topics
Topic Forum Replies
No new posts Question for file manager IBM Tools 7
No new posts question for Pedro TSO/ISPF 2
No new posts question on Outrec and sort #Digvijay DFSORT/ICETOOL 20
No new posts panel creation question TSO/ISPF 12
No new posts Sort w/OUTREC Question DFSORT/ICETOOL 2
Search our Forums:

Back to Top