Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 310
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 Get line number where cursor is from ... satish.ms10 CLIST & REXX 3 Wed Oct 24, 2018 12:23 am
No new posts Delete Multiple rows in chunks by usi... dharmaraok DB2 5 Tue Sep 11, 2018 8:44 pm
No new posts -502 Error - Cursor already open anand jeyapaul DB2 7 Sun Oct 29, 2017 4:22 am
No new posts Update table without cursor Ron Klop DB2 3 Wed Oct 11, 2017 1:06 pm
No new posts Testing rerad cursor for status with ... John F Dutcher DB2 8 Fri May 19, 2017 9:35 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us