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: 10211
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 Dynamic array request/response contai... Suja.Sai CICS 2 Tue Jan 24, 2017 11:37 am
No new posts Join in SQL Query vickey_dw DB2 2 Tue Jan 17, 2017 12:15 am
This topic is locked: you cannot edit posts or make replies. MQ setup query mohitsaini Java & MQSeries 4 Sun Jan 08, 2017 1:53 am
No new posts DB2 query Using Recursion, Converting... smilewithashu2 DB2 1 Tue Jan 03, 2017 12:50 pm
This topic is locked: you cannot edit posts or make replies. Calling REXX code from ISPF panel sanchita dey TSO/ISPF 4 Mon Jan 02, 2017 5:13 pm


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