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

Wanted to whether SQL query can be build in Sub program


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
arunbai6

New User


Joined: 28 Oct 2014
Posts: 1
Location: USA

PostPosted: Fri Oct 31, 2014 5:43 am
Reply with quote

Hi All,

Is there any way i can build the sql query in a subprogram by passing parms from the main program. also execute the query in the sub pgm and return the value back to the main pgm. for Direct query like

SELECT COL1, COL2, COL3
FROM TAB_X
WHERE COL1 = :hvar
Back to top
View user's profile Send private message
Marso

REXX Moderator


Joined: 13 Mar 2006
Posts: 1348
Location: Israel

PostPosted: Sun Nov 02, 2014 7:04 pm
Reply with quote

Hello and welcome to the Forum.

Exactly which part of the query is to be dynamically built ?
Back to top
View user's profile Send private message
Rohit Umarjikar

Global Moderator


Joined: 21 Sep 2010
Posts: 2591
Location: NYC,USA

PostPosted: Mon Nov 03, 2014 9:00 am
Reply with quote

Create a table which contains 2 columns viz 1. Unquie integer number and other column corresponds to the SQL query. So now pass the parm to this sub program and query against this new table and gives these parms values against the first column and get the corresponding SQL and string it form a dynamic query.
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 -> DB2

 


Similar Topics
Topic Forum Replies
No new posts linking an ALC program to a Relationa... PL/I & Assembler 1
No new posts Need Help with on of the coalesce query DB2 4
This topic is locked: you cannot edit posts or make replies. Passing a field name to COBOL program COBOL Programming 10
This topic is locked: you cannot edit posts or make replies. Sample CICS Webservices Program CICS 1
No new posts Calling Rexx program from Cobol CLIST & REXX 12
Search our Forums:

Back to Top