If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Can I execute a DB2 ( OS390) Querry from REXX on OS390

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-19-04, 15:33
MahendraSetty MahendraSetty is offline
Registered User
 
Join Date: Apr 2004
Posts: 48
Talking Can I execute a DB2 ( OS390) Querry from REXX on OS390

Can I execute a DB2 ( OS390) Querry from REXX on OS390 ?
Any examples ?

Thanks
Mahendra
Reply With Quote
  #2 (permalink)  
Old 04-19-04, 16:16
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: Can I execute a DB2 ( OS390) Querry from REXX on OS390

Yes, you can ...

For this, you will have to first enable Db2 for use with REXX ... The panel used is DSNTIJRX ...

Once this is done , you can use REXX with DB2

For sample programs, see scripts section in www.db2click.com

HTH

Sathyaram

Quote:
Originally posted by MahendraSetty
Can I execute a DB2 ( OS390) Querry from REXX on OS390 ?
Any examples ?

Thanks
Mahendra
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #3 (permalink)  
Old 04-19-04, 16:52
MahendraSetty MahendraSetty is offline
Registered User
 
Join Date: Apr 2004
Posts: 48
Re: Can I execute a DB2 ( OS390) Querry from REXX on OS390

I am sorry, How do I enable the panel DSNTIJRX ?

Thanks



Quote:
Originally posted by sathyaram_s
Yes, you can ...

For this, you will have to first enable Db2 for use with REXX ... The panel used is DSNTIJRX ...

Once this is done , you can use REXX with DB2

For sample programs, see scripts section in www.db2click.com

HTH

Sathyaram
Reply With Quote
  #4 (permalink)  
Old 04-19-04, 17:11
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
Re: Can I execute a DB2 ( OS390) Querry from REXX on OS390

Sorry, it is the DB2 product installation panel ...

Get in touch with your Database admin or system admin people

Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #5 (permalink)  
Old 05-05-04, 02:07
jeddahrock jeddahrock is offline
Registered User
 
Join Date: Apr 2004
Location: Jeddah-Saudi Arabia
Posts: 7
Thumbs up

Hi,
1- when you wirte rexx program you know the first line in program must be :
/* REXX */

2- and when you need to connect to db2 fo os/390 use :
RXSQL_DB2SUBSYS = db2ss where db2ss is db2 id

3- and know you can write the query :
QUERY = "SELECT * FROM SYSIBM.SYSTABLES "

4- to run the query
CALL RXSQL QUERY

i hope these useful for you
Reply With Quote
  #6 (permalink)  
Old 05-11-04, 10:23
MahendraSetty MahendraSetty is offline
Registered User
 
Join Date: Apr 2004
Posts: 48
Thanks very much.

I have
RXSQL_DB2SUBSYS = "DB2T"
CALL RXSQL QUERY

This works except for I get

SQLCODE = 12
SQLSTATE = 00000

for Query = "select * from sysibm.systables"

I Tried changing the query but get the same results.

Also how to see the results of the query ?

Thanks
Reply With Quote
  #7 (permalink)  
Old 05-15-04, 15:21
jeddahrock jeddahrock is offline
Registered User
 
Join Date: Apr 2004
Location: Jeddah-Saudi Arabia
Posts: 7
Hi,

first,
i think 12 not listed in sqlcode

2nd,
to see the result :

say RXSQL_0 ===> print number of rows from query

if you select * from SYSIBM.SYSTABLES :
say name.i creator.i where name, creator are columns name
and i is indicator to record no.
e.g. name.1 creator.1
Reply With Quote
  #8 (permalink)  
Old 05-17-04, 09:43
MahendraSetty MahendraSetty is offline
Registered User
 
Join Date: Apr 2004
Posts: 48
That SQLCODE of 12 is what I am getting after I run the query.

Also tried say RXSQL_0 it results in displaying the string RXSQL_0 and doesnt displays any value.

Do we need to bind/rebind any plan to run rex/db2 clist ?

SQLCODE of +12 with SQLstate 01545 states that 'The unqualified column name ...... was interpreted as a correlated reference '

But I am getting SQLCODE 12 with SQLSTATE 00000.

Appreciate all the help.

Thanks
Reply With Quote
  #9 (permalink)  
Old 05-17-04, 10:36
sathyaram_s sathyaram_s is offline
Super Moderator
 
Join Date: Aug 2001
Location: UK
Posts: 4,534
I suspect the 12 to be a REXX return value ...

Are you sure it is SQLCODE ?


Cheers
Sathyaram
__________________
Visit the new-look IDUG Website , register to gain access to the excellent content.
Reply With Quote
  #10 (permalink)  
Old 05-17-04, 11:56
MahendraSetty MahendraSetty is offline
Registered User
 
Join Date: Apr 2004
Posts: 48
This is how my pgm looks on Mainframe :
***************************** Top of Data *********************
/* REXX */
RXSQL_DB2SUBSYS = 'DB2T'
RXSQL_DB2PLAN = 'RXDB2'
QUERY = 'SELECT * FROM SYSIBM.SYSTABLES'
CALL RXSQL QUERY
CALL SQLCA
EXIT
SQLCA:
SAY "SQLCODE = " SQLCODE
SAY "SQLSTATE = " SQLSTATE
SAY "SQLMSG = " SQLERRM
SAY "SQLSCA = " SQLSTMT
SAY "RXSQL0 = " RXSQL_0
SAY "RXSQL1 = " RXSQL_1
RETURN
**************************** Bottom of Data *******************

AND THIS IS THE OUTPUT I GET ( CUT AND PASTE FROM THE SCREEN)


SQLCODE = 12
SQLSTAT E = 00000
SQLMSG = SQLERRM
SQLSCA = SQLSTMT
RXSQL0 = RXSQL_0
RXSQL1 = RXSQL_1


Thanks
Reply With Quote
  #11 (permalink)  
Old 05-26-04, 01:48
jeddahrock jeddahrock is offline
Registered User
 
Join Date: Apr 2004
Location: Jeddah-Saudi Arabia
Posts: 7
use RXSQL_SQLCODE


/* REXX */
RXSQL_DB2SUBSYS = 'DB2T'
RXSQL_DB2PLAN = 'RXDB2'
QUERY = 'SELECT * FROM SYSIBM.SYSTABLES'
CALL RXSQL QUERY
CALL SQLCA
EXIT
SQLCA :
SAY 'RXSQL_0: ' RXSQL_0
SAY 'SQLCODE: ' RXSQL_SQLCODE
SAY 'SQLERRM: ' RXSQL_SQLERRM
Reply With Quote
  #12 (permalink)  
Old 05-26-04, 09:27
MahendraSetty MahendraSetty is offline
Registered User
 
Join Date: Apr 2004
Posts: 48
Thumbs down

Then I get this display on screen :


RXSQL_0: RXSQL_0
SQLCODE: RXSQL_SQLCODE
SQLERRM: RXSQL_SQLERRM
***

Thanks,

Mahendra
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On