Page 1 of 1

how to use array to store data from DB2 query

PostPosted: Fri Jun 18, 2010 1:09 pm
by rsaxena8
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

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

PostPosted: Fri Jun 18, 2010 11:13 pm
by dick scherrer
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.

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

PostPosted: Sat Jun 19, 2010 7:23 pm
by rsaxena8
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

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

PostPosted: Sat Jun 19, 2010 9:10 pm
by dick scherrer
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.