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
 

 

DB2 Question - Choose the best

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
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    Post subject: DB2 Question - Choose the best
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    Post subject: Re: DB2 Question - Choose the best
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    Post subject: Re: DB2 Question - Choose the best
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Fault Analyzer - listings question. egrove IBM Tools 4 Thu Aug 11, 2016 5:31 pm
No new posts dataset copy question - REPRO or some... atulxp TSO/ISPF 2 Wed Aug 03, 2016 10:56 pm
No new posts SQL Order By related question Joseph K Thomas DB2 8 Fri Mar 18, 2016 12:53 pm
No new posts DFSort Question krrp DFSORT/ICETOOL 9 Mon Mar 07, 2016 7:11 pm
No new posts Question: REORG on LOB tablespaces rakesh1155 DB2 1 Fri Aug 14, 2015 2:14 pm


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