DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'

Ken Michalik

DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'
Is it possible to write a stored procedure or UDF in COBOL to execute as
program type sub, and what has to be done to get to create the load module
that executes this way?

I searched in vain through SG24-4693-01 looking for a COBOL example written
to be executed as a stored procedure of program type sub.
I also looked through the DB2 application development guide and all it had
appeared to be a 'C' sample.

We have devlopers interested in writing UDFs, and not being able to write in
COBOL might kill this interest.

Thanks.

Ken Michalik
Kraft Foods



James Campbell

Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'
(in response to Ken Michalik)
Ken

The major differences between program type MAIN and SUB are:-
- for MAIN, DB2 will recreate the LE environment for each
execution, for SUB it can reuse the LE environment
- for C language programs, a MAIN program will be given
parameters in argc, argv format, for SUB it will be given parameters
as a list of parameters. Other languages will (I think) get the same
parameters.

COBOL UDFs can be either MAIN or SUB, although I tend to use
MAIN. There are examples in the Appl Prog and SQL Guide
showing the parameters to be used.

The load module has to be in the STEPLIB DD of the SPAS.

SG24-4693 is specifically orientated towards Stored Procedures,
not UDFs.

James Campbell

On 14 Dec 2001, at 14:59, Michalik, Ken wrote:

Date sent: Fri, 14 Dec 2001 14:59:13 -0600
Send reply to: DB2 Data Base Discussion List <DB2-
[login to unmask email]>
From: "Michalik, Ken" <[login to unmask email]>
Subject: [DB2-L] DB2 OS/390: Cobol stored procedure or
UDF PROGRAM TYPE
'SUB'
To: [login to unmask email]

> Is it possible to write a stored procedure or UDF in COBOL to execute as
> program type sub, and what has to be done to get to create the load module
> that executes this way?
>
> I searched in vain through SG24-4693-01 looking for a COBOL example written
> to be executed as a stored procedure of program type sub.
> I also looked through the DB2 application development guide and all it had
> appeared to be a 'C' sample.
>
> We have devlopers interested in writing UDFs, and not being able to write in
> COBOL might kill this interest.
>
> Thanks.
>
> Ken Michalik
> Kraft Foods
>
>
> DB2-L webpage at htt
p://www.ryci.com/db2-l. The owners of the list can


James A Campbell



Suresh Sane

Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'
(in response to James Campbell)
James - why MAIN? The redbook (V6 Tech Update), if I recall right,
recommends using SUB. Have you found the performance difference to be
negligible? Any benchmarks you could share?

Thanks,
Suresh

>From: James Campbell <[login to unmask email]>
>Reply-To: DB2 Data Base Discussion List <[login to unmask email]>
>To: [login to unmask email]
>Subject: Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE
> 'SUB'
>Date: Sat, 15 Dec 2001 17:27:20 +1100
>
>Ken
>
>The major differences between program type MAIN and SUB are:-
>- for MAIN, DB2 will recreate the LE environment for each
>execution, for SUB it can reuse the LE environment
>- for C language programs, a MAIN program will be given
>parameters in argc, argv format, for SUB it will be given parameters
>as a list of parameters. Other languages will (I think) get the same
>parameters.
>
>COBOL UDFs can be either MAIN or SUB, although I tend to use
>MAIN. There are examples in the Appl Prog and SQL Guide
>showing the parameters to be used.
>
>The load module has to be in the STEPLIB DD of the SPAS.
>
>SG24-4693 is specifically orientated towards Stored Procedures,
>not UDFs.
>
>James Campbell
>
>On 14 Dec 2001, at 14:59, Michalik, Ken wrote:
>
>Date sent: Fri, 14 Dec 2001 14:59:13 -0600
>Send reply to: DB2 Data Base Discussion List <DB2-
>[login to unmask email]>
>From: "Michalik, Ken" <[login to unmask email]>
>Subject: [DB2-L] DB2 OS/390: Cobol stored procedure or
>UDF PROGRAM TYPE
> 'SUB'
>To: [login to unmask email]
>
> > Is it possible to write a stored procedure or UDF in COBOL to execute as
> > program type sub, and what has to be done to get to create the load
>module
> > that executes this way?
> >
> > I searched in vain through SG24-4693-01 looking for a COBOL example
>written
> > to be executed as a stored procedure of program type sub.
> > I also looked through the DB2 application development guide and all it
>had
> > appeared to be a 'C' sample.
> >
> > We have devlopers interested in writing UDFs, and not being able to
>write in
> > COBOL might kill this interest.
> >
> > Thanks.
> >
> > Ken Michalik
> > Kraft Foods
> >
> >
> >
>the DB2-L webpage at htt
>p://www.ryci.com/db2-l. The owners of the list can be reached at
>[login to unmask email]
>
>
>James A Campbell
>
>
>
>
>


_________________________________________________________________
Chat with friends online, try MSN Messenger: http://messenger.msn.com



Isaac Yassin

Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'
(in response to Suresh Sane)
Hi,
While I believe the Redbook I could not find measurable differences using SUB / MAIN
in assembler UDF

Isaac Yassin
[login to unmask email]
----- Original Message -----
From: "Suresh Sane" <[login to unmask email]>
Newsgroups: bit.listserv.db2-l
To: <[login to unmask email]>
Sent: Saturday, December 15, 2001 4:25 PM
Subject: Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'


> James - why MAIN? The redbook (V6 Tech Update), if I recall right,
> recommends using SUB. Have you found the performance difference to be
> negligible? Any benchmarks you could share?
>
> Thanks,
> Suresh
>
> >From: James Campbell <[login to unmask email]>
> >Reply-To: DB2 Data Base Discussion List <[login to unmask email]>
> >To: [login to unmask email]
> >Subject: Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE
> > 'SUB'
> >Date: Sat, 15 Dec 2001 17:27:20 +1100
> >
> >Ken
> >
> >The major differences between program type MAIN and SUB are:-
> >- for MAIN, DB2 will recreate the LE environment for each
> >execution, for SUB it can reuse the LE environment
> >- for C language programs, a MAIN program will be given
> >parameters in argc, argv format, for SUB it will be given parameters
> >as a list of parameters. Other languages will (I think) get the same
> >parameters.
> >
> >COBOL UDFs can be either MAIN or SUB, although I tend to use
> >MAIN. There are examples in the Appl Prog and SQL Guide
> >showing the parameters to be used.
> >
> >The load module has to be in the STEPLIB DD of the SPAS.
> >
> >SG24-4693 is specifically orientated towards Stored Procedures,
> >not UDFs.
> >
> >James Campbell
> >
> >On 14 Dec 2001, at 14:59, Michalik, Ken wrote:
> >
> >Date sent: Fri, 14 Dec 2001 14:59:13 -0600
> >Send reply to: DB2 Data Base Discussion List <DB2-
> >[login to unmask email]>
> >From: "Michalik, Ken" <[login to unmask email]>
> >Subject: [DB2-L] DB2 OS/390: Cobol stored procedure or
> >UDF PROGRAM TYPE
> > 'SUB'
> >To: [login to unmask email]
> >
> > > Is it possible to write a stored procedure or UDF in COBOL to execute as
> > > program type sub, and what has to be done to get to create the load
> >module
> > > that executes this way?
> > >
> > > I searched in vain through SG24-4693-01 looking for a COBOL example
> >written
> > > to be executed as a stored procedure of program type sub.
> > > I also looked through the DB2 application development guide and all it
> >had
> > > appeared to be a 'C' sample.
> > >
> > > We have devlopers interested in writing UDFs, and not being able to
> >write in
> > > COBOL might kill this interest.
> > >
> > > Thanks.
> > >
> > > Ken Michalik
> > > Kraft Foods
> > >
> > >
> > >
> >the DB2-L webpage at htt
> >p://www.ryci.com/db2-l. The owners of the list can be reached at
> >[login to unmask email]
> >
> >
> >James A Campbell
> >
> >
> >
> >
> >
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> DB2-L webpage at http://www.ryci.com/db2-l. The
owners of the list can
>



James Campbell

Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'
(in response to Isaac Yassin)
Fortunately, I have never had to push efficiency to the point where
MAIN/SUB was significant. Perhaps in future there may be
differences which are measurable.

James Campbell

On 15 Dec 2001, at 17:21, Isaac Yassin wrote:

Date sent: Sat, 15 Dec 2001 17:21:19 +0200
Send reply to: DB2 Data Base Discussion List <DB2-
[login to unmask email]>
From: Isaac Yassin <[login to unmask email]>
Subject: Re: [DB2-L] DB2 OS/390: Cobol stored procedure
or UDF PROGRAM
TYPE 'SUB'
To: [login to unmask email]

> Hi,
> While I believe the Redbook I could not find measurable differences using SUB / MAIN
> in assembler UDF
>
> Isaac Yassin
> [login to unmask email]
> ----- Original Message -----
> From: "Suresh Sane" <[login to unmask email]>
> Newsgroups: bit.listserv.db2-l
> To: <[login to unmask email]>
> Sent: Saturday, December 15, 2001 4:25 PM
> Subject: Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE 'SUB'
>
>
> > James - why MAIN? The redbook (V6 Tech Update), if I recall right,
> > recommends using SUB. Have you found the performance difference to be
> > negligible? Any benchmarks you could share?
> >
> > Thanks,
> > Suresh
> >
> > >From: James Campbell <[login to unmask email]>
> > >Reply-To: DB2 Data Base Discussion List <[login to unmask email]>
> > >To: [login to unmask email]
> > >Subject: Re: DB2 OS/390: Cobol stored procedure or UDF PROGRAM TYPE
> > > 'SUB'
> > >Date: Sat, 15 Dec 2001 17:27:20 +1100
> > >
> > >Ken
> > >
> > >The major differences between program type MAIN and SUB are:-
> > >- for MAIN, DB2 will recreate the LE environment for each
> > >execution, for SUB it can reuse the LE environment
> > >- for C language programs, a MAIN program will be given
> > >parameters in argc, argv format, for SUB it will be given parameters
> > >as a list of parameters. Other languages will (I think) get the same
> > >parameters.
> > >
> > >COBOL UDFs can be either MAIN or SUB, although I tend to use
> > >MAIN. There are examples in the Appl Prog and SQL Guide
> > >showing the parameters to be used.
> > >
> > >The load module has to be in the STEPLIB DD of the SPAS.
> > >
> > >SG24-4693 is specifically orientated towards Stored Procedures,
> > >not UDFs.
> > >
> > >James Campbell
> > >
> > >On 14 Dec 2001, at 14:59, Michalik, Ken wrote:
> > >
> > >Date sent: Fri, 14 Dec 2001 14:59:13 -0600
> > >Send reply to: DB2 Data Base Discussion List <DB2-
> > >[login to unmask email]>
> > >From: "Michalik, Ken" <[login to unmask email]>
> > >Subject: [DB2-L] DB2 OS/390: Cobol stored procedure or
> > >UDF PROGRAM TYPE
> > > 'SUB'
> > >To: [login to unmask email]
> > >
> > > > Is it possible to write a stored procedure or UDF in COBOL to execute as
> > > > program type sub, and what has to be done to get to create the load
> > >module
> > > > that executes this way?
> > > >
> > > > I searched in vain through SG24-4693-01 looking for a COBOL example
> > >written
> > > > to be executed as a stored procedure of program type sub.
> > > > I also looked through the DB2 application development guide and all it
> > >had
> > > > appeared to be a 'C' sample.
> > > >
> > > > We have devlopers interested in writing UDFs, and not being able to
> > >write in
> > > > COBOL might kill this interest.
> > > >
> > > > Thanks.
> > > >
> > > > Ken Michalik
> > > > Kraft Foods
> > > >
> > > >
> > > >
> > >the DB2-L webpage at htt
> > >p://www.ryci.com/db2-l. The owners of the list can be reached at
> > >[login to unmask email]
> > >
> > >
> > >James A Campbell
> > >
> > >
> > >
> > >
> > >
> >
> >
> > _________________________________________________________________
> > Chat with friends online, try MSN Messenger: http://messenger.msn.com
> >
> >
> > DB2-L webpage at h
ttp://www.ryci.com/db2-l. The
> owners of the list can
> >
>
>
> DB2-L webpage at htt
p://www.ryci.com/db2-l. The owners of the list can


James A Campbell