Page 1 of 2

REXX with DB2-- need help

PostPosted: Thu Mar 10, 2011 12:52 pm
by sjrcreation
hi all,

requirement:
I have tables name in a PS. (that is the input, around 100 tb) need to take row count (ie select count(*) from tb)
need to save the output of the count in PS like
tb1 -- 26
tb2 -- 58
...

So how to connect rexx to DB2

my idea: In QMF we can save a queary as proc and call the proc in rexx. but i dont know how to call the proc in rexx and send the table name to proc

can someone help on this.
Thanks in advance.

Re: REXX with DB2-- need help

PostPosted: Thu Mar 10, 2011 3:20 pm
by NicC
Did you search the forum? There are examples in here of using SQL in Rexx programs. You can also look up the 'Application Programming and SQL Guide' (SC26-9933-xx where xx is version dependent) for your version of DB2 and there is also a complete manual on 'Rexx Language Support' in the DB2 bookshelf - sorry but no document number for that.

Re: REXX with DB2-- need help

PostPosted: Thu Mar 10, 2011 4:11 pm
by sjrcreation
Thanks Nicc.. I downloaded the doc. i will go through it and if i got it i will post the result.

Re: REXX with DB2-- need help

PostPosted: Thu Mar 10, 2011 7:51 pm
by sjrcreation
Hi
started through the doc. still cant find a good answer. Appreciate if someone post the answer for the requirement :geek:

Re: REXX with DB2-- need help

PostPosted: Thu Mar 10, 2011 8:45 pm
by Akatsukami
sjrcreation wrote:Hi
started through the doc. still cant find a good answer. Appreciate if someone post the answer for the requirement :geek:

The method is:
CALL RXSUBCOM("ADD", environment, handler)

and you will then send DB2 commands by coding:
ADDRESS environment "query"

environment is pretty much an arbitrary string, although you should use a meaningful name, like "DB2" or "SQL".

handler can be one of a number of interfaces. IBM supplies DSNREXX; the queries are static SQL, very much like those coded in a compiled-language program. Open Software Technologies supplies RXTASQL (part of their REXXTOOLS package) the queries are dynamic SQL, like those executed through DSNTEPx, SPUFI, or QMF. There may be others. Ask your senpai, DBA, or other site support personnel which if any of these are installed in your shop.

Re: REXX with DB2-- need help

PostPosted: Sun Mar 13, 2011 3:01 am
by DFSHDC40
Ref. for a rexx sample http://publib.boulder.ibm.com/cgi-bin/b ... 1113015703
[for V8 ... but nothing much has changed for a while]

Re: REXX with DB2-- need help

PostPosted: Sun Mar 13, 2011 11:05 am
by NicC
environment is pretty much an arbitrary string


No it is not - it is the command processor which will process the commands which will be DSNREXX if you follow the documentation. You will get a RC=-3 if you put in an invalid environment.

Re: REXX with DB2-- need help

PostPosted: Sun Mar 13, 2011 11:11 am
by dick scherrer
Hello,

Suggest that it is arbitrary as there is no vendor-insisted value. "Anyplace" can use "Anyname" of their choice.

d

Re: REXX with DB2-- need help

PostPosted: Sun Mar 13, 2011 11:15 am
by NicC
I just tried before posting -
ADDRESS BLING
"LISTC LEV(level)"

gives RC=-3
The environment is the name of the command processor which is DSNREXX unless you have another vendor's product in which case it will be whatever they called their version of the command processor.

Re: REXX with DB2-- need help

PostPosted: Sun Mar 13, 2011 11:56 am
by dick scherrer
Hello,

I don't use this, so i cannot provide technical specifics.

However, i suggest the post from Akatsukami be re-read carefully . . .

You will get a RC=-3 if you put in an invalid environment
Yup, as expected. . .

Suspect that if you had properly (arbitrarily) defined BLING as a valid environment, it would have worked.