problem re-executing sql query using rexx



IBM's Command List programming language & Restructured Extended Executor

problem re-executing sql query using rexx

Postby sricsc » Sat May 29, 2010 7:58 pm

Hi All,

I used REXX to query the DB2 Tables. I used the sql Query by means of Cursor and i give different inputs everytime. Whenver, i'm giving the input one by one from the REXX PROC to the Cursor, Output Host Variable Value has not changing. Is that Host Variable value will not change? Pls tell me whats the issue.

Below is my Rexx code.

GET_PROC:
...........
...........
DO I = 1 TO COUNT
INPUT = A.I
CALL GET_INFO
SAY "VALUE: " VAR1
END
.........

GET_INFO:
QUERY6= "SELECT * ",
"FROM <Table>",
"WHERE <conditions = INPUT>",
"ORDER BY <Col> DESC",
"FETCH FIRST 1 ROWS ONLY WITH UR"

ADDRESS DSNREXX 'EXECSQL PREPARE S7 FROM :QUERY6'
IF (SQLCODE \= 0) THEN CALL SQLC1
ADDRESS DSNREXX 'EXECSQL DECLARE C7 CURSOR FOR S7'
ADDRESS DSNREXX 'EXECSQL OPEN C7'

ADDRESS DSNREXX 'EXECSQL FETCH C7 INTO :'VAR1''
ADDRESS DSNREXX 'EXECSQL CLOSE C7'
RETURN


OUPUT LIKE :

25
25
25
25

Always Host Variable - VAR1 is showing the First output value. Its not showing other o/p Values, when other inputs are giving. I think Once these host variables get assigned to a Value at the first time, its not Changing till the EXIT.

Pls help me in this Issue...
Thanks,
Sri
sricsc
 
Posts: 13
Joined: Sat Aug 08, 2009 7:07 am
Has thanked: 0 time
Been thanked: 0 time

Re: problem re-executing sql query using rexx

 

Re: problem re-executing sql query using rexx

Postby dick scherrer » Sat May 29, 2010 9:43 pm

Hello,

When you have a question, start a new topic for your question rather than posting a reply to an nactive topic.

Change the display after the CALL to show both VAR1 and I . . .
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times


Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post