Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Dynamic feeding values to ADDRESS DSNREXX

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> CLIST & REXX
View previous topic :: :: View next topic  
Author Message
Govarthanan

New User


Joined: 22 Nov 2013
Posts: 10
Location: India

PostPosted: Mon Nov 25, 2013 6:10 pm    Post subject: Dynamic feeding values to ADDRESS DSNREXX
Reply with quote

Hi All,

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.

For .e.g.

Code:

 ADDRESS DSNREXX                               
    "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

Code:

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 !

Thanks in advance for your replies icon_smile.gif
Back to top
View user's profile Send private message

dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Nov 25, 2013 10:11 pm    Post subject:
Reply with quote

Hello and welcome to the forum,

Have you Defined and OPENed the cursor?

I do not see this in the code . . .
Back to top
View user's profile Send private message
Govarthanan

New User


Joined: 22 Nov 2013
Posts: 10
Location: India

PostPosted: Mon Nov 25, 2013 11:46 pm    Post subject:
Reply with quote

Dick,
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.
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Tue Nov 26, 2013 10:30 am    Post subject:
Reply with quote

Govarthanan, I ran the below code and it worked as expected. Is this what you are trying to achieve?
Code:
DN= "FETCH C1 INTO :STA.I,:BNB.I,:BATCHD.I,:BATCHT.I,",   
                        ":JOBN.I"                               
ADDRESS DSNREXX "EXECSQL "DN                                     
Back to top
View user's profile Send private message
Govarthanan

New User


Joined: 22 Nov 2013
Posts: 10
Location: India

PostPosted: Tue Nov 26, 2013 11:34 am    Post subject:
Reply with quote

Yes , MFKiddo, Thanks. I tried this syntax and it is working.

Thanks a lot MFKid. icon_biggrin.gif icon_super.gif
Back to top
View user's profile Send private message
TheMFKid

New User


Joined: 20 Nov 2013
Posts: 91
Location: India

PostPosted: Tue Nov 26, 2013 11:54 am    Post subject:
Reply with quote

Superb.. Good to know it helped!

Thanks.
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 -> CLIST & REXX All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts LOW VALUES as a KEY juares castro DB2 10 Sat Apr 07, 2018 1:06 am
No new posts *MASTER* address space abending at IPL Alan Playford All Other Mainframe Topics 2 Mon Mar 12, 2018 8:02 am
No new posts Query to compare 2 values of 1 column... Poha Eater DB2 13 Fri Mar 09, 2018 10:45 am
No new posts Enterprise PL/I - dynamic allocation ... prino PL/I & Assembler 1 Mon Jan 29, 2018 10:17 pm
No new posts attchmvs from rexx subroutine that re... harisukumaran CLIST & REXX 1 Fri Jan 19, 2018 5:29 am

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us