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
 

 

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

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
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    Post subject: can we perform sql queries and access databases in rexx?????
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: 8593
Location: Back in jolly old England

PostPosted: Tue Jan 11, 2011 5:12 pm    Post subject:
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

Moderator Team Head


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

PostPosted: Tue Jan 11, 2011 5:22 pm    Post subject: Reply to: can we perform sql queries and access databases in
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    Post subject:
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: 1771
Location: Bloomington, IL

PostPosted: Tue Jan 11, 2011 6:50 pm    Post subject:
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

Senior Member


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

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

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

http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=/com.ibm.db2.udb.admin.doc/doc/c0006728.htm
http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/index.jsp?topic=/com.ibm.db29.doc.apsg/db2z_accessrexxlanguagesupportinterface.htm
http://www.ibmmainframes.com/viewtopic.php?t=21197&highlight=db2
http://www.ibmmainframes.com/viewtopic.php?t=15761&highlight=db2
http://www.ibmmainframes.com/viewtopic.php?t=16578&highlight=db2
http://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    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 1 Wed Jul 26, 2017 9:11 pm
No new posts Passing data from REXX to C programme... chong.zhou All Other Mainframe Topics 0 Wed Jul 26, 2017 4:55 pm
No new posts REXX to get the all datasets name parasmalik20 CLIST & REXX 5 Tue Jul 18, 2017 9:10 pm
No new posts How system know which REXX to excute? jackzhang75 CLIST & REXX 14 Thu Jul 06, 2017 1:09 am
No new posts REXX - Dynamic file Creation d_sarlie CLIST & REXX 7 Tue Jun 27, 2017 7:30 pm


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