Page 1 of 1

Using DB2 "predicate" for cursor

PostPosted: Mon May 22, 2017 5:15 pm
by jfdutcher
I have pulled very simple code from IBM manual which demonstrates a simple test to determine cursor status (and I gather, avoid either -501 or -502 SQLCODES).
IF READCUR IS OPEN
EXEC SQL
CLOSE READCUR
END-EXEC
EXEC SQL
OPEN READCUR
END-EXEC
ELSE
EXEC SQL
OPEN READCUR
END-EXEC
END-IF
READCUR is defined in WS:
EXEC SQL
DECLARE READCUR CURSOR FOR
SELECT
etc.etc.

But at compile time the compiler throws a '14' return and says READCUR is undefined. The program is an old one and has run for years
but my attempt to insert the test for open cursor is stymied.
Is it that my DB2 / COBOL environment doesn't allow using DB2 predicates (at least for a cursor) ?

Re: Using DB2 "predicate" for cursor

PostPosted: Mon May 22, 2017 6:01 pm
by NicC
Locked - discussed on the Expert's forum.

Also - nothing is "thrown" on MVS, its predecessors or its successors.