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 Export flat file data into excel sheet murali.andaluri DFSORT/ICETOOL 2 Mon Mar 20, 2017 5:39 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 Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts SPUFI -- Joining 3 tables – data in... Sysaron DB2 2 Wed Mar 08, 2017 4:18 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm


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