Using DB2 "predicate" for cursor

IBM's flagship relational database management system
jfdutcher
Posts: 9
Joined: Mon Apr 28, 2014 10:53 pm
Skillset: COBOL, IMS,ISPF,JCL,CICS,DB2,SQL
Referer: Googling for answers

Using DB2 "predicate" for cursor

Postby jfdutcher » Mon May 22, 2017 5:15 pm

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) ?

NicC
Global moderator
Posts: 3025
Joined: Sun Jul 04, 2010 12:13 am
Skillset: JCL, PL/1, Rexx, Utilities and to a lesser extent (i.e. I have programmed using them) COBOL,DB2,IMS
Referer: Google
Location: Pushing up the daisies (almost)

Re: Using DB2 "predicate" for cursor

Postby NicC » Mon May 22, 2017 6:01 pm

Locked - discussed on the Expert's forum.

Also - nothing is "thrown" on MVS, its predecessors or its successors.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic


  • Similar Topics
    Replies
    Views
    Last post