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 Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 6 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm
No new posts SQL - select data available in index Nileshkul DB2 3 Mon Jun 26, 2017 1:30 am


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