how to use array to store data from DB2 query



Unicenter CA-Easytrieve Plus Report Generator: CA's information retrieval and data management tool

how to use array to store data from DB2 query

Postby rsaxena8 » Fri Jun 18, 2010 1:09 pm

Hi
In easytrieve i am trying to fetch data from DB2 table which is returning multiple values for a variable .
Can anybody suggest how can i do that

CURSOR
SQL DECLARE CURSOR3 CURSOR FOR                                      +
SELECT  CHAR(YEAR(DATE(CURRENT DATE))-YEAR(DATE(B.CICL_DOB_DT)))    +
     FROM CILXA1A.TRV_TRAVELLER A ,  CILXA1A.CLIENT_TAB B           +
   WHERE A.POLICY_ID = :I-POLICY-ID                                 +
     AND A.NON_TRAVEL_IND = 'N'                                     +
     AND A.CLIENT_ID = B.CLIENT_ID                                  +
     AND B.HISTORY_VLD_NBR = 0                                      +
     FOR  READ ONLY     
Code'd

This query is returning multiple rows/values. How can these values be capture in fetch statement , probably can be arrary ...
but i have no idea how to do that


SQL OPEN CURSOR3
SQL FETCH CURSOR3 INTO :W-REP-AGE }-- how to store multiple values

SQL CLOSE CURSOR3

need it uregent , can anybody help ...
thanks a lot
rsaxena8
 
Posts: 2
Joined: Fri Jun 18, 2010 12:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to use array to store data from DB2 query

Postby dick scherrer » Fri Jun 18, 2010 11:13 pm

Hello and welcome to the forum,

First - we don't do urgent. . . If you believe something is urgent, hire someone to specifically work on the urgency. . .

Second - practice using the Code tag (your earlier post has now been "Code'd". This reserves alignment and improves readability.

As far as you request, define an array as well as an individual ws area. "Fetch" into the individual area and then move the value(s) fetched to the array.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times

Re: how to use array to store data from DB2 query

Postby rsaxena8 » Sat Jun 19, 2010 7:23 pm

Thanks a lot for your reply dick .
I would appreciate if u could put the snippet of code for your soln as i tried to define the array but couldn't get the right syntax.
do it at your own convenience :)
Thanks again
rsaxena8
 
Posts: 2
Joined: Fri Jun 18, 2010 12:58 pm
Has thanked: 0 time
Been thanked: 0 time

Re: how to use array to store data from DB2 query

Postby dick scherrer » Sat Jun 19, 2010 9:10 pm

Hello,

i tried to define the array but couldn't get the right syntax.
Post your array code and whatever problem has occurred.

If your organization is licensed to use the product, the documentation may be downloaded from CA Support for free. We may neither post nor link to the documentation via the forum.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6268
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 93 times


Return to CA-Easytrieve

 


  • Related topics
    Replies
    Views
    Last post