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
 

 

Fetching data from cursor

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
ravi.bollineni

New User


Joined: 28 Jun 2006
Posts: 8

PostPosted: Thu Sep 21, 2006 7:26 pm    Post subject: Fetching data from cursor
Reply with quote

Hi All,

I am working on mainframe environment using the Database as DB2. Following is the declaration of my cursor.

Code:
EXEC SQL                                                         
    DECLARE CNTRPT CURSOR FOR                                   
    SELECT DEPT_ID,                                             
                DEPT_GRP_NBR                                       
    CASE DEPT_STAT_CDE                                           
             WHEN 10 THEN SET :WS-PAID-CNT = COUNT(*)               
             WHEN 11 THEN SET :WS-ADJ-CNT  = COUNT(*)               
    END                                                         
    FROM  DEPT_DTL                                     
    WHERE DEPT_DTL.CUST_ID      = :PARM-CUST  AND
               DEPT_DTL.TRNS_CDE    = 'P' 
                                                                           
    GROUP BY DEPT_ID,                                           
                    DEPT_GRP_NBRR,                                   
                    DEPT_AFFL_ID                                       
    ORDER BY DEPT_ID,                                           
                    DEPT_GRP_NBRR                                     
END-EXEC.

***********************************************************

While fetching data from the cursor can i use the following way?

Code:
EXEC SQL
         FETCH CNTRPT               
                 INTO :DB-NF-DEPT_ID,     
                         :DB-NF-DEPT_GRP_NBR,
                         :DB-NF-PAID-CNT,
                         :DB-NF-ADJ-CNT
END-EXEC


Can i retrieve the data of the variable :WS-PAID-CNT into
DB-NF-PAID-CNT?

Could you please calrify me in this regard.

Thanks,
Ravi.
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Oct 27, 2006 9:19 am    Post subject: Re: Fetching data from cursor
Reply with quote

Quote:
Can i retrieve the data of the variable :WS-PAID-CNT into
DB-NF-PAID-CNT?

Yes, if defined properly. Did you try that ?

Check Declaring Host Variables... & Using Host Variables...
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 Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Group Data based on a key Arun Raj DFSORT/ICETOOL 7 Thu Apr 27, 2017 11:29 pm
No new posts unload data from table with lob columns farhad_evan DB2 0 Sat Apr 22, 2017 1:32 pm
No new posts SORT JSON type of data maxsubrat DFSORT/ICETOOL 8 Wed Apr 19, 2017 6:01 pm


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