IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

How to call COBOL program from a COBOL stored procedure.


IBM Mainframe Forums -> DB2
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kalais

New User


Joined: 18 Apr 2006
Posts: 22

PostPosted: Wed Jul 23, 2008 1:08 pm
Reply with quote

Hi,

I am trying to call a COBOL program from a DB2 stored procedure written in COBOL. How I can achieve this? I need some sample code for this.

And I also need sample code/references on calling stored procedure routine from a stored procedure. Both SPs are in COBOL.



Thanks,
Kalai
Back to top
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Wed Jul 23, 2008 7:09 pm
Reply with quote

Calling a COBOL program from a Stored Procedure is similar to Calling COBOL program from a COBOL program. The syntax remains the same.

Stored Procedure - PGMA
COBOL Program - PGMB

PGMA
CALL PGMB using parm1, Parm2

But one thing we need to take care here that both the programs should be bound under same plan.
Back to top
View user's profile Send private message
jaspal

New User


Joined: 22 May 2007
Posts: 68
Location: mumbai

PostPosted: Fri Jul 25, 2008 10:22 pm
Reply with quote

Hi,

why you need to call a cobol component from Stored procedures.
Stored procedures is structured query language (SQL) programs that are stored at the DB2 server .
if you will call a cobol component from stored procedure there i think you are giving heads up to DB2 subsystem.....why can't you do processing over there in stored procedure itself ( i.e computation etc ) .


Thanks,
Jaspal
Back to top
View user's profile Send private message
Suresh Ponnusamy

Active User


Joined: 22 Feb 2008
Posts: 107
Location: New York

PostPosted: Fri Jul 25, 2008 11:33 pm
Reply with quote

Hi Jaspal,

You can do it in either way.

Usually COBOL program would be a common routine that can be called from Many Stored Procedures.

For example something like date validation routine or any conversion routine which would be used by multiple stored procedure, it can be placed in a COBOL program.

For creating SP, we need to define the SP definition and create it, provide access to all the user whoever accessing the SP and everytime if want to add/modify any parameter, we need to change the definition of the SP.

In our project, we used to have COBOL program, in case of any common routines rather than using a Separate SP.

Suggestions are welcome.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> DB2

 


Similar Topics
Topic Forum Replies
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts Using API Gateway from CICS program CICS 0
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts COBOL ZOS Web Enablement Toolkit HTTP... COBOL Programming 0
No new posts Calling DFSORT from Cobol, using OUTF... DFSORT/ICETOOL 5
Search our Forums:

Back to Top