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

Help with cursor


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
spoorni

New User


Joined: 29 Nov 2007
Posts: 20
Location: india

PostPosted: Wed Dec 03, 2014 9:15 pm
Reply with quote

I have a program where I am using a cursor. If the row is not found of the table, I still need to return the vlaue with an indicator set. For the check for end of cursor, I use the check for SQLCODE = 100. What would I use within the cursor to check for row not found on table?
Back to top
View user's profile Send private message
mistah kurtz

Active User


Joined: 28 Jan 2012
Posts: 316
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Dec 03, 2014 10:12 pm
Reply with quote

Code:
05  WS-ROW-FLAG         PIC X.             
    88  WS-ROW-FOUND-YES                VALUE 'Y'.
    88  WS-ROW-FOUND-NO                 VALUE 'N'.


SET  WS-ROW-FOUND-NO             TO TRUE.
PERFORM 1000-FETCH-CUROSR UNTIL SQLCODE = +100

1000-FETCH-CUROSR.

EXEC SQL                               
    FETCH  cursor-name                         
    INTO   :Host-Variables
END-EXEC.                               

EVALUATE  TRUE                                         
                                                       
    WHEN  +00                                     
        SET  WS-ROW-FOUND-YES    TO TRUE
        PROCESS DATA

    WHEN  +100
        CONTINUE

    WHEN  OTHER                                         
        PROCESS ERROR

END-EVALUATE.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Is SQLCODE -811 possible while fetchi... DB2 1
No new posts Restart logic by using cursor name in... DB2 1
No new posts Seeking Resolution for SQKCODE -991 o... DB2 2
No new posts Multiple rows within Cursor when Coun... DB2 14
No new posts Dynamic cursor name in Cobol program COBOL Programming 1
Search our Forums:

Back to Top