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
 
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: 10327
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 How to write Rexx program to size and... sreejeshcs CLIST & REXX 14 Thu Oct 12, 2017 7:26 am
No new posts Extend the decimal values in DIVISION Balaryan DFSORT/ICETOOL 3 Thu Oct 05, 2017 4:05 pm
No new posts HEX value search in a DB2 query maxsubrat DB2 2 Wed Oct 04, 2017 3:04 pm
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 5 Wed Oct 04, 2017 6:54 am
This topic is locked: you cannot edit posts or make replies. Rexx to execute spool commands upendrasri CLIST & REXX 47 Fri Sep 29, 2017 1:08 pm

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