REXX, DSN RUN return code

Mariusz .

REXX, DSN RUN return code
Hello,

I have a Rexx script where I run DB2 applications by DSN+CALL commands:

ret_codes.=''
do i=1 to ....
.....
q1 = " RUN PROGRAM("pgmname") PLAN("planname") "
q2 = " PARM('"parm_txt"')"
queue (q1)(q2)
queue " END "
"DSN SYSTEM(DB2X)"
ret_codes.pgm.i=pgmname
ret_codes.plan.i=planname
ret_codes.retcode.i=RC
'DELSTACK'
end

The above solution is bad from performance point of view.
The best solution would be to build the stack and then run DSN command only once:

do i=1 to ....
.....
q1 = " RUN PROGRAM("pgmname") PLAN("planname") "
q2 = " PARM('"parm_txt"')"
queue (q1)(q2)
end
queue " END "
"DSN SYSTEM(DB2X)"
'DELSTACK'

The thread will be created only once. But there is one difficulty. I don't know how to take over return codes of all
running programs (but the last).
Does somebody know the solution? (or address where TSO saves RC after running CALL program ?).

Best regards

Mariusz Stakowski

_____________________________________________________________________
* IDUG North America * Anaheim, California * May 2-6 2011 * http://IDUG.ORG/NA *
* Your only source for independent, unbiased, and trusted DB2 information. *
_____________________________________________________________________
http://www.IDUG.org/mentor
Mentoring should be a rewarding experience for everyone...
IDUG is offering up to 80% off when you both come to the conference!
_____________________________________________________________________

If you need to change settings, http://www.idug.org/cgi-bin/wa?A0=DB2-L is the home of IDUG's Listserv

Todd Burch

Re: REXX, DSN RUN return code
(in response to Mariusz .)
You give up control of the stream, and give up knowledge about which
command failed, when when calling the DSN subcommand processor with >
1 command at a time.

In batch, you can have some control over this when calling DSN under
IKJEFT1A instead of IKJEFT01, but it is still nowhere close to ideal.

If you were looking for a hack-job, you could add the TEST(integer)
option to the DSN command syntax to get a trace of the command flows,
and trap and parse that output, but, as with any hack, any PTF could
change that trace.

http://publib.boulder.ibm.com/infocenter/dzichelp/v2r2/topic/com.ibm.db29.doc.comref/db2z_cmd_dsn.htm

I would suggest one command at time.

Todd



On Feb 9, 2011, at 8:18 AM, Mariusz Stakowski wrote:

Hello,

I have a Rexx script where I run DB2 applications by DSN+CALL commands:

ret_codes.=''
do i=1 to ....
.....
q1 = " RUN PROGRAM("pgmname") PLAN("planname") "
q2 = " PARM('"parm_txt"')"
queue (q1)(q2)
queue " END "
"DSN SYSTEM(DB2X)"
ret_codes.pgm.i=pgmname
ret_codes.plan.i=planname
ret_codes.retcode.i=RC
'DELSTACK'
end

The above solution is bad from performance point of view.
The best solution would be to build the stack and then run DSN command
only once:

do i=1 to ....
.....
q1 = " RUN PROGRAM("pgmname") PLAN("planname") "
q2 = " PARM('"parm_txt"')"
queue (q1)(q2)
end
queue " END "
"DSN SYSTEM(DB2X)"
'DELSTACK'

The thread will be created only once. But there is one difficulty. I
don't know how to take over return codes of all
running programs (but the last).
Does somebody know the solution? (or address where TSO saves RC after
running CALL program ?).

Best regards

Mariusz Stakowski

_____________________________________________________________________
* IDUG North America * Anaheim, California * May 2-6 2011 * http://IDUG.ORG/NA
*
* Your only source for independent, unbiased, and trusted DB2
information. *
_____________________________________________________________________
http://www.IDUG.org/mentor
Mentoring should be a rewarding experience for everyone...
IDUG is offering up to 80% off when you both come to the conference!
_____________________________________________________________________

If you need to change settings, http://www.idug.org/cgi-bin/wa?A0=DB2-
L is the home of IDUG's Listserv


_____________________________________________________________________
* IDUG North America * Anaheim, California * May 2-6 2011 * http://IDUG.ORG/NA *
* If you are going to attend only one conference this year, this is it! *
** The most DB2 technical sessions of any conference
** Access IBM experts and developers
_____________________________________________________________________

If you need to change settings, http://www.idug.org/cgi-bin/wa?A0=DB2-L is the home of IDUG's Listserv