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
 

 

How to pass dynamic values in a sql query in REXX

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

New User


Joined: 11 Oct 2004
Posts: 69
Location: chennai

PostPosted: Mon Dec 01, 2008 12:02 pm    Post subject: How to pass dynamic values in a sql query in REXX
Reply with quote

My requirement is to execute the below sql query
Code:
SQLSTMT= "SELECT NAME FROM SYSIBM.SYSCOLUMNS",       
"WHERE TBCREATOR='CI1'",                                     
"AND NAME IN (SELECT NAME FROM SYSIBM.SYSCOLUMNS" ,           
"WHERE TBCREATOR='CI1' AND TBNAME=TABNAME1 AND KEYSEQ > 0 )" 

I want to pass the TABNAME1 value dynamically. How to acheive this in Rexx.
Back to top
View user's profile Send private message

enrico-sorichetti

Global Moderator


Joined: 14 Mar 2007
Posts: 10256
Location: italy

PostPosted: Mon Dec 01, 2008 12:05 pm    Post subject: Reply to: How to pass dynamic values in a sql query in REXX
Reply with quote

if You are using the REXX sql interface the sql query is just a REXX string
and can be built by concatenating the needed fragments

Code:

get the query variables ... for example with
parse arg creator tablnam
.......
SQLSTMT= "SELECT NAME FROM SYSIBM.SYSCOLUMNS" || ,
         "WHERE TBCREATOR='" || creator || "'" || ,                                      
         "AND NAME IN (SELECT NAME FROM SYSIBM.SYSCOLUMNS" || ,
                       "WHERE TBCREATOR='" || creator || "'" || ,                                      
                       "AND TBNAME='" || tablnam || "'" || ,
                       "AND KEYSEQ > 0 )" 


the above snippet only shows how to build the query string from Your sample
is not concerned about sql goodness icon_biggrin.gif
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 Sorting of hex values Saurabh_mi DFSORT/ICETOOL 11 Thu May 25, 2017 3:49 pm
This topic is locked: you cannot edit posts or make replies. Need help on If condition continuatio... ashok_uddaraju CLIST & REXX 4 Fri May 19, 2017 8:55 am
No new posts Replace values in the input data Vikas Maharnawar DFSORT/ICETOOL 10 Thu May 11, 2017 2:18 pm
No new posts Running an REXX EXEC implicitly sho7hills CLIST & REXX 3 Thu Apr 20, 2017 8:14 am
No new posts Need help in REXX CALL program Raje1002 CLIST & REXX 5 Wed Apr 19, 2017 11:18 pm


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