Fwd: DB2 program calling another DB2 program question

Lee Mandel

Fwd: DB2 program calling another DB2 program question
I forgot to mention that both program PGMA and PGMB both run OK using the
same procedure one at a time. I just want PMGA to call PGMB. Also I am
using ISPF Dialog Manager to run this application.
Thank again. Lee



[login to unmask email]

Re: DB2 program calling another DB2 program question
(in response to Lee Mandel)
Lee,

Plan PGMA would have to include PGMB as either a DBRM or as part of it's
PKLIST. As long as plan PGMA includes programs PGMA and PGMB, you should
not have any problems.

Bill Gallagher, DBA
Phoenix Home Life
Enfield, CT 06083




Lee Mandel
<[login to unmask email] To: [login to unmask email]
.COM> cc:
Sent by: DB2 Subject: DB2 program calling another DB2 program question
Data Base
Discussion
List
<[login to unmask email]
OM>


12/13/00
06:17 AM
Please
respond to
DB2 Data Base
Discussion
List






Hi All,
Lets say I have a db2 program running that I have called using tso like
this.
DATA
DSN SYSTEM(DB2T)
RUN PROGRAM(PGMA) PLAN(PGMA)
END
ENDDATA

pgma is running OK and I wish to call another db2 program PGMB
Can I use the same code as above to call PGMB and if so what must I do to
BIND these together or whatever it take to call PGMB from PGMA.
Also what manual will give me an example. Any help will be appreciated.
Point me in the right direction.

TIA, Lee








Lee Mandel

Re: DB2 program calling another DB2 program question
(in response to BILL_GALLAGHER@PHL.COM)
Bill,
I am still doing something incorrect. My bind job look like this:
//SYSTSIN DD *
DSN SYSTEM(DB2T)
BIND PLAN(RKIDL419) MEM(RKIDL419) ACT(REP) ISOLATION(CS) -
LIB('RKI.D1129.DBRMLIB.DATA')
BIND PLAN(RKIDL420) MEM(RKIDL420) ACT(REP) ISOLATION(CS) -
LIB('RKI.D1129.DBRMLIB.DATA')
BIND PLAN(RKIDL421) MEM(RKIDL419,RKIDL420) -
ACT(REP) ISOLATION(CS) -
LIB('RKI.D1129.DBRMLIB.DATA')
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP31) -
LIB('DB2.TEST.RUNLIB.LOAD')
END
//SYSIN DD *
GRANT EXECUTE, BIND ON PLAN RKIDL419, RKIDL420, RKIDL421
TO PUBLIC;
Also my clists look like this: this one work OK
CONTROL END(ENDO) MSG CONLIST LIST FLUSH
/*NTROL END(ENDO)
ISPEXEC VGET (DB2ID ICBACK ZUSER HILEV) SHARED
ISPEXEC LIBDEF ISPLLIB DATASET ID('&HILEV..LOAD')
IF &LASTCC = 0 THEN
DO
DATA
DSN SYSTEM(&DB2ID.)
RUN PROGRAM(RKIDL419) PLAN(RKIDL421)
END
ENDDATA
ENDO
EXIT
When program rkidl419 is running I call a clist to call the next db2 program.
The clist look like this: I am executing another program with the same
plan name.
CONTROL END(ENDO) MSG CONLIST LIST FLUSH
/*NTROL END(ENDO)
ISPEXEC VGET (DB2ID ICBACK ZUSER HILEV) SHARED
ISPEXEC LIBDEF ISPLLIB DATASET ID('&HILEV..LOAD')
IF &LASTCC = 0 THEN
DO
DATA
DSN SYSTEM(&DB2ID.)
RUN PROGRAM(RKIDL420) PLAN(RKIDL421)
END
ENDDATA
ENDO
EXIT
This is where I get a S0C4.
Any help will be appreciated.
Thanks, Lee



Eric Pearson

Re: DB2 program calling another DB2 program question
(in response to Lee Mandel)
Lee,
This is easy if you use PACKAGES.
BIND all the programs as PACKAGES in the same COLLECTIONID.
Then Bind the PLANS to COLLECTIONID.* rather than to DBRMs.
This allows any of the programs to call any of the others.


regards,

eric pearson
NS ITO Database Support


-----Original Message-----
From: Lee Mandel [mailto:[login to unmask email]
Sent: Wednesday, December 13, 2000 6:18 AM
To: [login to unmask email]
Subject: DB2 program calling another DB2 program question


Hi All,
Lets say I have a db2 program running that I have called using tso like
this.
DATA
DSN SYSTEM(DB2T)
RUN PROGRAM(PGMA) PLAN(PGMA)
END
ENDDATA

pgma is running OK and I wish to call another db2 program PGMB
Can I use the same code as above to call PGMB and if so what must I do to
BIND these together or whatever it take to call PGMB from PGMA.
Also what manual will give me an example. Any help will be appreciated.
Point me in the right direction.

TIA, Lee








James Campbell

Re: DB2 program calling another DB2 program question
(in response to Eric Pearson)
Lee

How do you 'call a clist'? Do you attach a task or run it as a subprogram?

The DSN command is not designed to support multiple attachments to DB2 at
the same time.

The fact that you are getting a S0C4 means that you can raise a PMR.
However, you might find that the response is along the lines of "the DSN
command cannot be invoked in a subtask/subprogram of of a DSN command so,
instead of giving you a S0C4, we will give you a S04E-???????? abend."

What can you realistically do? Well, you could start by reading the Appl
Prog and SQL Guide chapter on Programming for ISPF. This discusses various
problems and techniques for multi-task/multi-program environments - which is
what you are doing. Then either:
- as others have suggested, restructure your plan(s) to use packages. You
can now call subroutines with wild abandon (without using DSN commands), and
DB2 will use the appropriate DBRMs. But you won't be able to use subtasks,
since DB2 connections are specific to a task.
or
- restructure your DB2 connections to use CAF or RRSAF instead of the the
DSN command. These allow multi-task connections to DB2. (see
http://mvshelp.com/ubb/Forum2/HTML/000182.html for a simple CAF program.
You could easily modify this example to call a program named in a
parameter.)

HTH
/* standard disclaimer */
James Campbell
DBA
Hansen Corporation, Doncaster
+61 3 9843 8442
[login to unmask email]


-----Original Message-----
From: Lee Mandel [mailto:[login to unmask email]
Sent: Thursday, December 14, 2000 4:43 AM
To: [login to unmask email]
Subject: Re: [DB2-L] DB2 program calling another DB2 program question


Bill,
I am still doing something incorrect. My bind job look like this:
//SYSTSIN DD *
DSN SYSTEM(DB2T)
BIND PLAN(RKIDL419) MEM(RKIDL419) ACT(REP) ISOLATION(CS) -
LIB('RKI.D1129.DBRMLIB.DATA')
BIND PLAN(RKIDL420) MEM(RKIDL420) ACT(REP) ISOLATION(CS) -
LIB('RKI.D1129.DBRMLIB.DATA')
BIND PLAN(RKIDL421) MEM(RKIDL419,RKIDL420) -
ACT(REP) ISOLATION(CS) -
LIB('RKI.D1129.DBRMLIB.DATA')
RUN PROGRAM(DSNTEP2) PLAN(DSNTEP31) -
LIB('DB2.TEST.RUNLIB.LOAD')
END
//SYSIN DD *
GRANT EXECUTE, BIND ON PLAN RKIDL419, RKIDL420, RKIDL421
TO PUBLIC;
Also my clists look like this: this one work OK
CONTROL END(ENDO) MSG CONLIST LIST FLUSH
/*NTROL END(ENDO)
ISPEXEC VGET (DB2ID ICBACK ZUSER HILEV) SHARED
ISPEXEC LIBDEF ISPLLIB DATASET ID('&HILEV..LOAD')
IF &LASTCC = 0 THEN
DO
DATA
DSN SYSTEM(&DB2ID.)
RUN PROGRAM(RKIDL419) PLAN(RKIDL421)
END
ENDDATA
ENDO
EXIT
When program rkidl419 is running I call a clist to call the next db2
program.
The clist look like this: I am executing another program with the same
plan name.
CONTROL END(ENDO) MSG CONLIST LIST FLUSH
/*NTROL END(ENDO)
ISPEXEC VGET (DB2ID ICBACK ZUSER HILEV) SHARED
ISPEXEC LIBDEF ISPLLIB DATASET ID('&HILEV..LOAD')
IF &LASTCC = 0 THEN
DO
DATA
DSN SYSTEM(&DB2ID.)
RUN PROGRAM(RKIDL420) PLAN(RKIDL421)
END
ENDDATA
ENDO
EXIT
This is where I get a S0C4.
Any help will be appreciated.
Thanks, Lee







**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************