Dynamically CALL one DC COBOL program from another
search cancel

Dynamically CALL one DC COBOL program from another

book

Article ID: 21011

calendar_today

Updated On:

Products

IDMS IDMS - Database

Issue/Introduction

This article describes how to dynamically call one DC COBOL from another - i.e. without having to link-edit the sub-program as part of the calling program

The COBOL compile option DYNAM is not supported in IDMS. However, it is still possible to dynamically invoke a subprogram.

Environment

Release: All supported releases.

Resolution

In the mainline program, use a TRANSFER CONTROL statement that specifies a variable. In the code prior to this call, MOVE the value of the subroutine name to this variable. This would look something like this:

MOVE 'subroutine_name' TO WS-SUB-NAME.
TRANSFER CONTROL TO WS-SUB-NAME USING <parameter-list>.

This approach will cause the subroutine to be loaded dynamically at run-time, so that it does not need to be included in the link-edit of the mainline COBOL program. This dynamic load of the subroutine is supported even though the compile option DYNAM is not.

Both the calling and called programs must be defined to SYSGEN.