REXX with DB2-- need help



IBM's Command List programming language & Restructured Extended Executor

REXX with DB2-- need help

Postby sjrcreation » Thu Mar 10, 2011 12:52 pm

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.
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: REXX with DB2-- need help

 

Re: REXX with DB2-- need help

Postby NicC » Thu Mar 10, 2011 3:20 pm

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: REXX with DB2-- need help

Postby sjrcreation » Thu Mar 10, 2011 4:11 pm

Thanks Nicc.. I downloaded the doc. i will go through it and if i got it i will post the result.
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: REXX with DB2-- need help

Postby sjrcreation » Thu Mar 10, 2011 7:51 pm

Hi
started through the doc. still cant find a good answer. Appreciate if someone post the answer for the requirement :geek:
sjrcreation
 
Posts: 30
Joined: Sat Dec 11, 2010 9:44 am
Has thanked: 0 time
Been thanked: 0 time

Re: REXX with DB2-- need help

Postby Akatsukami » Thu Mar 10, 2011 8:45 pm

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.
"You have sat too long for any good you have been doing lately ... Depart, I say; and let us have done with you. In the name of God, go!" -- what I say to a junior programmer at least once a day
User avatar
Akatsukami
Global moderator
 
Posts: 1053
Joined: Sat Oct 16, 2010 2:31 am
Location: Bloomington, IL
Has thanked: 6 times
Been thanked: 51 times

Re: REXX with DB2-- need help

Postby DFSHDC40 » Sun Mar 13, 2011 3:01 am

Ref. for a rexx sample http://publib.boulder.ibm.com/cgi-bin/b ... 1113015703
[for V8 ... but nothing much has changed for a while]
If the code hasn't been changed, why is the LKED date today?
User avatar
DFSHDC40
 
Posts: 41
Joined: Sat Oct 16, 2010 4:16 pm
Location: IMS.SDFSRESL
Has thanked: 0 time
Been thanked: 0 time

Re: REXX with DB2-- need help

Postby NicC » Sun Mar 13, 2011 11:05 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: REXX with DB2-- need help

Postby dick scherrer » Sun Mar 13, 2011 11:11 am

Hello,

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

d
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Re: REXX with DB2-- need help

Postby NicC » Sun Mar 13, 2011 11:15 am

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.
The problem I have is that people can explain things quickly but I can only comprehend slowly.
Regards
Nic
NicC
Global moderator
 
Posts: 2690
Joined: Sun Jul 04, 2010 12:13 am
Location: Pushing up the daisys (almost)
Has thanked: 4 times
Been thanked: 105 times

Re: REXX with DB2-- need help

Postby dick scherrer » Sun Mar 13, 2011 11:56 am

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.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

Next

Return to CLIST & REXX

 


  • Related topics
    Replies
    Views
    Last post