Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

CALL STORED PROCEDURE USING EXEC REXX

770 views
Skip to first unread message

Anderson C. Mattos

unread,
Aug 17, 2009, 2:25:44 PM8/17/09
to
Hi Guys,
How do I call a stored procedure using EXEC REXX?
Thanks!!
Anderson Mattos


Esta mensagem � uma correspond�ncia reservada e sua divulga��o, distribui��o, reprodu��o ou qualquer forma de utiliza��o depende de autoriza��o, sujeitando-se o respons�vel a medidas judiciais. O remetente utiliza o correio eletr�nico no exerc�cio do seu trabalho ou em raz�o dele, eximindo esta institui��o de qualquer responsabilidade por utiliza��o indevida. Se voc� a recebeu por engano, favor elimin�-la.

Paul Gilmartin

unread,
Aug 17, 2009, 2:53:32 PM8/17/09
to
On 08/17/09 12:24, Anderson C. Mattos wrote:
>
> How do I call a stored procedure using EXEC REXX?
>
If it's another Rexx EXEC, call it as a function or a
procedure in SYSEXEC or SYSPROC.

If it's a JCL PROC, submit a job that calls it with
either SYSOUT writer(INTRDR) or address TSO SUBMIT.
In those cases you get no direct indication of completion
or status.

-- gil

----------------------------------------------------------------------
For TSO-REXX subscribe / signoff / archive access instructions,
send email to LIST...@VM.MARIST.EDU with the message: INFO TSO-REXX

Don Leahy

unread,
Aug 17, 2009, 3:03:59 PM8/17/09
to
Are you referring to a DB2 Stored Procedure?

2009/8/17 Anderson C. Mattos <anderso...@itau-unibanco.com.br>:

----------------------------------------------------------------------

Anderson C. Mattos

unread,
Aug 17, 2009, 3:17:46 PM8/17/09
to
Yes,

I'm refering to a DB2 Stored Procedure.

Thanks

-----Mensagem original-----
De: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] Em nome de Don Leahy
Enviada em: segunda-feira, 17 de agosto de 2009 16:03
Para: TSO-...@VM.MARIST.EDU
Assunto: Re: [TSO-REXX] CALL STORED PROCEDURE USING EXEC REXX

Don Leahy

unread,
Aug 17, 2009, 3:55:13 PM8/17/09
to
The CALL statement is very simple:

address DSNREXX "EXECSQL CALL :proc_name(:P1,:P2,:P3,:P4)"

Where :proc_name is a host variable that contains the stored procedure
name, and :P1 etc are host variables containing parameters to be
passed to the procedure. The number of parameters will vary depending
on your specific needs.

Naturally, you cannot call the stored procedure unless you have
established a connection to DB2 first.

Seibert, Dave

unread,
Aug 19, 2009, 8:15:42 AM8/19/09
to
Here's what I use:

...
/* ----------------------------------------------------------------- */

"SUBCOM DSNREXX" /* set up addressability to the DB2 Rexx
interface */
IF RC THEN
S_RC = RXSUBCOM('ADD','DSNREXX','DSNREXX')

if ssid = '' | ssid = '.' then
ssid = dfltdb2() /* set default subsys id */

ADDRESS DSNREXX
"CONNECT " ssid

if sqlcode <> 0 then
do;say "Connect to "ssid" failed: ";say ' ';call Display_Sqlca;exit;end

EXECSQL "SET CURRENT PACKAGESET = 'DSNREXX'"

if sqlcode <> 0 then
do;say "set curr packset failed: ";say ' ';call Display_Sqlca;exit;end

SPname= locationLit||schemaLit||SPName

parmvar=''
do i = 1 to words(SPParms)
parmvar=parmvar||',:'||value("SPP"i)
call value "SPP"i , value(word(SPParms,i))
end

parmvar = strip(parmvar,'L',',')

EXECSQL "CALL :SPname("parmvar")"
if sqlcode <> 0 then
call Display_sqlca

SAY 'Called SP ' SPname
SAY 'SP SQLCode ' sqlcode
EXIT
/* ----------------------------------------------------------------- */


The above is just the guts of the routine I use to call different SPs.
If you're starting from scratch, I recommend testing a simple call to a
stored procedure with no parms. Then add parms as you need them. The
parm parsing above isn't clear and I don't have time to explain. Come
up with your own; it'll be easier and simpler.

Good luck

Dave


>
> 2009/8/17 Anderson C. Mattos <anderso...@itau-unibanco.com.br>:
>> Hi Guys,
>> How do I call a stored procedure using EXEC REXX?
>> Thanks!!
>> Anderson Mattos


The contents of this e-mail are intended for the named addressee only. It contains information that may be confidential. Unless you are the named addressee or an authorized designee, you may not copy or use it, or disclose it to anyone else. If you received it in error please notify us immediately and then destroy it.

Don Leahy

unread,
Aug 19, 2009, 2:36:12 PM8/19/09
to
What is dfltdb2() ? Is it something home grown?

Seibert, Dave

unread,
Aug 19, 2009, 2:42:17 PM8/19/09
to
Hi Don
Whoops. I neglected to remove that homegrown reference.
It's a routine I have to determine the default subsystem for an LPAR. Not much need for outside of Compuware, probably.

Dave

Miranda, John

unread,
Oct 19, 2009, 2:27:20 PM10/19/09
to
Is it possible to execute a java program with a rexx running in batch? We have a rather length rexx, but it needs some information from a java client accessing a vendor product. We can construct a series of steps, to run the java client to access and save data to z/os file, then run the rexx in the next step.

We would like to see this done within the rexx. Is this possible? Can we execute a java program and pass data back?

John M.

----------------------------------------------------------------------

Bob Stark

unread,
Oct 19, 2009, 6:00:02 PM10/19/09
to
I think this topic needs a new subject line.

Yes, a TSO REXX program, stored in a PDS and running in foreground TSO, or
in batch running under IKJEFT01, can directly invoke a java program and
receive the stdout returned by that program.

I wrote a UNIXCMD() external REXX function which does this. The UNIX command
response is returned on the REXX stack. I have previously posted it to this
list, and will send it to you if you want to give it a shot.

REXX also runs in the OMVS Shell, and an exec running there could do the
same thing; Execute a java program and capture the stdout.


Regards,

Bob Stark

ProTech - When you're serious about Systems Management
Consulting, Software, and Training for z/OS, UNIX and Internet
www.protechtraining.com 800-373-9188 x151 Cell: 412-445-8072

John M.

--
If this email is spam, report it here:
http://www.onlymyemail.com/view/?action=reportSpam&Id=Mzg3MzE6OTgzNjY1Nzc4Om
JzdGFya0Bwcm90ZWNocHRzLmNvbQ%3D%3D

Miranda, John

unread,
Nov 20, 2009, 2:04:23 PM11/20/09
to
I would like to give it a shot.

John Miranda
john.m...@usaa.com


-----Original Message-----
From: TSO REXX Discussion List [mailto:TSO-...@VM.MARIST.EDU] On Behalf Of Bob Stark
Sent: Monday, October 19, 2009 5:00 PM
To: TSO-...@VM.MARIST.EDU

George.William

unread,
Nov 23, 2009, 11:34:50 AM11/23/09
to
Thanks for the offer to send the example. I'd like a copy please.
Billgeo at georgetec dot com

Thanks!
Bill

John Miranda
john.m...@usaa.com


Regards,

Bob Stark

John M.

______________________________________________________________________
CONFIDENTIALITY NOTICE: This email from the State of California is for the sole use of the intended recipient and may contain confidential and privileged information. Any unauthorized review or use, including disclosure or distribution, is prohibited. If you are not the intended recipient, please contact the sender and destroy all copies of this email.

0 new messages