Tuesday, November 13, 2012

COBOL Reviewer Part 1

COBOL (Common Business Oriented Language)

What are the two ways to call a COBOL program?
  • Static Call
  • Dynamic Call

Static Call 
o    The static form of the CALL statement specifies the name of the called module as a literal; e.g., it is in quotes.
CALL ‘PROGNAME’ USING arguments.
o    Static calls refer to calls made to called modules that were link-edited to the main program at compile time. That is, the called module’s object code is part of the main module’s object code.
o    This is established on compile time with the NODYNAM compiler option.
o    In static call, the called module and main module are link edited together.
o    Called module called in STATIC mode will always contain values from previous calls if the "INITIAL" keyword was not coded in the Program-ID declaration in the called module's IDENTIFICATION DIVISION. But you can reset the values by coding CANCEL from the main module.
o    In static call actual and formal parameters share same memory location.
o    In the case of static call the main module and called module are loaded into the main memory initially. 
o    In static call, if we do any changes to called module, we need to compile both main and called.

Dynamic Call
o    In COBOL, the dynamic form of a called module call is coded like this:
01 WS-SUBROUTINE-A        PIC X(8) VALUE “PROGNAME’.
CALL WS-SUBROUTINE-A USING arguments.
o    The dynamic form of the CALL statement specifies the name of the called module using a variable; the variable contains the name of the called module  to be invoked.
o    Dynamic calls refer to calls made to modules with separate object code from the main module. This is established on compile time with the DYNAM compiler option.
o    In Dynamic call, the called module and main module exist as separate modules.
o    Called module called in DYNAMIC mode will always be in initial state.
o    In dynamic call actual and formal parameters uses different memory locations.
o    In the case of dynamic call only the main program is loaded first and the called program is loaded only when a call to it is made, hence the memory utilization is good in dynamic call.
o    In dynamic call, if we change the called program, we only need to compile called program. There is no need to compile the main program.

COBOL Reviewer Part 2 can be viewed here.

No comments:

Post a Comment