Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups 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 Overlaying one set of charater values... Kevin Lindsley SYNCSORT 7 Sat Nov 05, 2016 3:21 am
No new posts Low values Results from VARCHAR FORMAT balaji81_k DB2 10 Thu Oct 20, 2016 1:18 am
No new posts How can we create a flat file in JAVA... rakesh.v18 Java & MQSeries 7 Fri Sep 23, 2016 10:46 pm
No new posts Using 'parm' to vary SORTOUT record v... Sysaron DFSORT/ICETOOL 13 Wed Sep 07, 2016 9:24 pm
No new posts execute APP if they are not ADDRESS T... italo_pm CLIST & REXX 3 Fri Aug 12, 2016 2:15 am


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us