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

can we perform sql queries and access databases in rexx?????


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

New User


Joined: 08 Sep 2009
Posts: 2
Location: Chennai

PostPosted: Tue Jan 11, 2011 5:10 pm
Reply with quote

can we perform sql queries and access databases in rexx????? If so, let me know a simple program in rexx to perform sql queries.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Tue Jan 11, 2011 5:12 pm
Reply with quote

Yes,

Google will give you lots of examples. Maybe the first port of call before posting here.
Back to top
View user's profile Send private message
superk

Global Moderator


Joined: 26 Apr 2004
Posts: 4652
Location: Raleigh, NC, USA

PostPosted: Tue Jan 11, 2011 5:22 pm
Reply with quote

I think, for an answer, we'd need to know what kind of database(s) and queries we're talking about.
Back to top
View user's profile Send private message
respondvignesh
Currently Banned

New User


Joined: 08 Sep 2009
Posts: 2
Location: Chennai

PostPosted: Tue Jan 11, 2011 6:04 pm
Reply with quote

This is for SQL and DB2
Back to top
View user's profile Send private message
Akatsukami

Global Moderator


Joined: 03 Oct 2009
Posts: 1788
Location: Bloomington, IL

PostPosted: Tue Jan 11, 2011 6:50 pm
Reply with quote

respondvignesh wrote:
This is for SQL and DB2

There are several different interfaces between Rexx and DB2. Before attempting to use one, you must create an entry for it in the TSO environment table. Do this by coding:
Code:

call rxsubcom("ADD",name,handler)

name is whatever name you desire to call the DB2 environment; this name not be the same as the command handler.

handler is the name of the interface routine. It must be in a library in the linklist or that is allocated to STEPLIB. The standard IBM-supplied interface is DSNREXX; in my shop, however, we typically use the OpenSoftware interface RXTASQL.

Having established the environment, you may need to connect with a subsystem using DB2SET, DSNALI, or the like. If there are examples of this in your shop, follow them.

Queries are passed to the handler via the ADDRESS command. Assume that you executed the following to establish the environment:
Code:

call rxsubcom("ADD","SQL","RXTASQL")

then you would execute a query by:
Code:

address sql "SELECT FOO FROM BAR WHERE NOTARY="SOJAC"

and the values returned (if any) would be in the stem foo.. Other interfaces will have different means of handling queries and returning results.

A return code of -3 from ADDRESS is diagnostic that your attempt to create the environment failed. Do not bother to tell us that everything went marvelously and that gremlins somehow trashed the environment table.

If you encounter specific problems, you may discuss them with us. Posting nothing more than "My exec/query didn't work!" will lead to nothing more than a response of "Too bad, so sad". Refusal to give the information we ask for to diagnose the problem will result in our ignoring you. Demands that we give you all the code needed to perform function X will result in replies of the sort: "I charge USD n/day or fraction thereof to produce working, tested, and robust code; PayPal me the money and I'll e-mail the code". Be aware that n will likely be on the close order of 1,000. If this seems outrageous, remember that it is presumably your job on the line, not ours. Talk is cheap, but whiskey costs money.
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Wed Jan 12, 2011 6:19 pm
Reply with quote

Adding to the reply of Akatsukami, please look here too:

publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/c0006728.htm
publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_accessrexxlanguagesupportinterface.htm
www.ibmmainframes.com/viewtopic.php?t=21197&highlight=db2
www.ibmmainframes.com/viewtopic.php?t=15761&highlight=db2
www.ibmmainframes.com/viewtopic.php?t=16578&highlight=db2
www.ibmmainframes.com/viewtopic.php?t=8445&highlight=db2
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 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 isfline didnt work in rexx at z/OS ve... CLIST & REXX 7
No new posts run rexx code with jcl CLIST & REXX 15
Search our Forums:

Back to Top