IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to pass dynamic values in a sql query in REXX


IBM Mainframe Forums -> CLIST & REXX
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
srajanbose

New User


Joined: 11 Oct 2004
Posts: 69
Location: chennai

PostPosted: Mon Dec 01, 2008 12:02 pm
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

Superior Member


Joined: 14 Mar 2007
Posts: 10873
Location: italy

PostPosted: Mon Dec 01, 2008 12:05 pm
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 View Bookmarks
All times are GMT + 6 Hours
Forum Index -> CLIST & REXX

 


Similar Topics
Topic Forum Replies
No new posts Compile Several JCL JOB Through one r... CLIST & REXX 4
No new posts Running REXX through JOB CLIST & REXX 13
No new posts Error to read log with rexx CLIST & REXX 11
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
Search our Forums:

Back to Top