Posted: Thu Apr 26, 2012 7:28 am Post subject: Basic Q on Fetch
Hi, this is a basic question on Fetch.
Quote:
Declare
Open
Fetch
Close
Above is the order to use a cursor in a batch program. Now, after open, is it must to do the fetch right after it or can code it somewhere after an IF condition?
Please advise. _________________ MF
==
Any training that does not include the emotions, mind and body is incomplete; knowledge fades without feeling.
==
Joined: 20 Oct 2006 Posts: 1411 Topics: 26 Location: germany
Posted: Thu Apr 26, 2012 8:24 am Post subject:
mf_user,
let us start at the beginning.
db2, mqs, cics, ims all have API's (application interface)
these API's allow you to imbed invocations to DB2, ... from a program,
whether it be written in COBOL, HLASM, PL1, JAVA, REXX, etc...
The API's are converted to the source language of the program (COBOL in this case)
by a pre-compiler.
after that, your program contains a CALL with a handful of parms in a USING List, instead of the coded API
(EXEC SQL ... END-EXEC)
in order to uses a cursor, it needs to be DECLAREd, OPENed, FETCHed
in that order.
after the Cursor is OPENed, your FETCHes can come at anytime. _________________ Dick Brenholtz
American living in Varel, Germany
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum