Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

How to call A COBOL-DB2 subprogram from COBOL-DB2 main pgm

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2
View previous topic :: :: View next topic  
Author Message
tushar_study

New User


Joined: 01 Feb 2007
Posts: 30
Location: Mumbai

PostPosted: Fri Feb 23, 2007 1:29 pm    Post subject: How to call A COBOL-DB2 subprogram from COBOL-DB2 main pgm
Reply with quote

Hi ,

Can anyone guide on this:

I need to call a COBOL-DB2 subprogram from my COBOL-DB2 main program.How do I give a call,how will the parameters be passed and is there any special declaration to be made in the subprogram?

Regards,
Tushar
Back to top
View user's profile Send private message

UmeySan

Active Member


Joined: 22 Aug 2006
Posts: 755
Location: Germany

PostPosted: Fri Feb 23, 2007 3:23 pm    Post subject:
Reply with quote

Hi !

First of all, if you take a search through the forum, you will find a lot of examples.

Cobol/Db2 calls Cobol/DB2 -> nothing else than Cobol calls Cobol
Parameters are passed normaly via Linkage or External-CopyBook

Regards, UmeySan

Normal Example:

Fields are declared in normal CopyBooks

In Calling-Program (Main-Programm)
...Call with Params

C40-CALL-MDL60040 SECTION.
MOVE 'C40-MDL60040' TO FTEXT4
*---------------------------------------------------------

CALL 'MDL60040' USING MZPN-KOPF-DATEN
MZPN-AZ-SPEZIFISCHE-DATEN
MZPN-IFRS-ALLGEMEINE-DATEN
MZPN-ERGEBNIS-KOPF-DATEN
MZPN-ERGEBNIS-CASHFLOW-DATEN
MZPN-ERGEBNIS-BEWERTUNG-ALLG
END-CALL

*---------------------------------------------------------
MOVE SPACES TO FTEXT4.
C40-CALL-MDL60040-EXIT.
EXIT.

In Called-Program (Sub-Programm)
...the fields are declared in Linkage

LINKAGE SECTION.

01 MZPN-KOPF-DATEN.
COPY CMP10000.

01 MZPN-AZ-SPEZIFISCHE-DATEN.
COPY CMP10060.

01 MZPN-IFRS-ALLGEMEINE-DATEN.
COPY CMP10008.


01 MZPN-ERGEBNIS-KOPF-DATEN.
COPY CMP10100
REPLACING ==A:==
BY ==ERG-==.

01 MZPN-ERGEBNIS-CASHFLOW-DATEN.
COPY CMP10101
REPLACING ==A:==
BY ==ERG-==.

01 MZPN-ERGEBNIS-BEWERTUNG-ALLG.
COPY CMP10102
REPLACING ==A:==
BY ==ERG-==.


PROCEDURE DIVISION USING MZPN-KOPF-DATEN
MZPN-AZ-SPEZIFISCHE-DATEN
MZPN-IFRS-ALLGEMEINE-DATEN
MZPN-ERGEBNIS-KOPF-DATEN
MZPN-ERGEBNIS-CASHFLOW-DATEN
MZPN-ERGEBNIS-BEWERTUNG-ALLG.



Call with use of external CopyBook

Main-Programm:

Working-Storage
...here the CopyBooks are declared
COPY CIPUFMSG. ...this one is an external book

...in Procedure-Division normal Call statement without Params

F50-WRITE-IFRS-MESSAGES SECTION.
MOVE 'F50-WRT-IFR-MSG' TO FTEXT4
*----------------------------------------------
IF COM-ERGS-TYP-IFRS NOT = ZERO
CALL 'MDL60120' END-CALL
END-IF
*----------------------------------------------
MOVE SPACES TO FTEXT4.
F50-WRITE-IFRS-MESSAGES-EXIT.


Sub-Programm:

Working-Storage
...here the CopyBooks are declared
COPY CIPUFMSG. ...this one is an external book

LINKAGE SECTION.
...nothing needed

PROCEDURE DIVISION.
...normal cobol handling

S00-STEUERUNG SECTION.
MOVE 'S00-STEUERUNG' TO FTEXT0
-------------------------------------------------
PERFORM A05-VORLAUF
IF MDL60120-WEITER
PERFORM F05-VERARBEITUNG
END-IF
PERFORM Z05-NACHLAUF
-------------------------------------------------
MOVE SPACES TO FTEXT0.
S00-STEUERUNG-EXIT.


External Books:
IER1337.$$NDVR$$.WORK(CIPUFMSG)

01 IFP-MSG-MESSAGES EXTERNAL.

10 MSG-VERARB-ART PIC X(004).
10 MSG-FILLER-001 PIC X(001).
10 MSG-VERARB-CDE PIC X(002).
10 MSG-FILLER-002 PIC X(001).
10 MSG-VERARB-KTO PIC X(010).
10 MSG-FILLER-003 PIC X(001).
10 MSG-VERARB-COD PIC X(004).
10 MSG-FILLER-005 PIC X(001).
10 MSG-VERARB-MSG PIC X(108).

By use of external books, no parms are used by call-statement.
The book must be present in both programms.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> DB2 All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts COBOL DB2 program - zIIP eligible vasanthz COBOL Programming 7 Wed May 31, 2017 5:12 am
This topic is locked: you cannot edit posts or make replies. Cobol GUI (like Editor) Kala Mainframe COBOL Programming 14 Wed May 10, 2017 12:30 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us