This is my first post in the forum. I have a small query with regards to the ADDRESS DSNREXX syntax in REXX.
I have written a REXX prog to get as input a query which in turns fetches the output, but the input queries can have any number of where clauses, which will be replaced by "?"
I know to connect to DB2 and fetch the data, but is it possible to dynamically change the number of values.
"EXECSQL FETCH C2 INTO :VA1,:VA2,:VA3,:VA4"
The above code will work as expected and fetch values, but if i don know the number of values to be fetched in , i just thought of framing the whole sentence into a variable and substituting it, like below
FETSTMT = "EXECSQL FETCH C2 INTO :VA1,:VA2,:VA3,:VA4"
ADDRESS DSNREXX FETSTMT
So, I tried this to open clause but the query failed with sqlcode 501, saying the cursor was not at all opened.
1) Is my attempt possible ! meaning can it be dynamically prepared substituted to ADDRESS DSNREXX
2) If it is not possible, is there any other way that i can dynamically do it !
Yes I have the prepare cursor, open cursor too. If it is possible to feed values dynamically to the syntax ADDRESS DSNREXX, I will make the open cursor also to be prepared dynamically in a string and make it work.
Since my doubt was to see if it can be dynamically changed, i just posted one syntax of the code.
Thanks, and let me know if i am not clear.