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: 10232
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 Check Binary Values for symbols gandikk CA Products 3 Tue Mar 21, 2017 5:11 am
No new posts JCL to Set Return code based on DB2 S... vinu78 DB2 17 Mon Mar 13, 2017 9:47 pm
No new posts To display values of multiple rows in... vinu78 DB2 2 Thu Mar 09, 2017 1:20 pm
No new posts REXX cdoe to purge a JOB from spool a... Sulabh Agrawal CLIST & REXX 11 Thu Mar 09, 2017 11:36 am
No new posts Overriding PS data in rexx Shaheen Shaik CLIST & REXX 8 Fri Mar 03, 2017 5:08 pm


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