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
 

 

Help with cursor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: Help with cursor
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: 283
Location: Room: TREE(3). Hilbert's Hotel

PostPosted: Wed Dec 03, 2014 10:12 pm    Post subject:
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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm
No new posts Getting -504 Cursor Name GTT-ARTS-CUR... Robin Sulsona DB2 2 Fri Mar 17, 2017 1:43 am
No new posts Release of Adabas Cursor mohitsethi All Other Mainframe Topics 1 Mon Feb 06, 2017 8:36 pm
No new posts Updating Cursor row withour using FOR... chandan.inst DB2 15 Tue Nov 08, 2016 11:17 am
No new posts Variable for cursor names ravikumar15 DB2 5 Sun Jul 17, 2016 7:08 am


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