You must use dynamic linking if your Assembler module calls a COBOL module. By definition, all calls from assembler to cobol
and vice versa are dynamic because Assembler
.OBJ files and COBOL
.OBJ files cannot be linked together. There are two methods of dynamically linking to COBOL modules:
- You can issue a
CALL macro call in your Assembler program. With this method you also need to put an
INCLUDE command in a link file for the assembler module giving the name of the cobol module that you want to link to. When the Linker
processes the
INCLUDE command, it does not actually include the COBOL module, but instead generates and includes a small Assembler module. When
the
CALL is executed at run time, the Assembler module loads and links to the COBOL module entry point specified.
- You can issue a
LOAD macro call in your Assembler program. Again, the
LOAD macro does not load the COBOL module directly, but instead creates and loads an Assembler module the address of which is
returned by the
LOAD. You then issue a
BALR instruction specifying this address. The small Assembler stub module then performs a dynamic
CALL to the COBOL module desired.
Note: Note that if you use this option you must use standard Assembler to COBOL linking which means the high bit in the last parameter
address being passed is set so that the COBOL program being called can determine the correct number of parameters being passed.
Whenever a COBOL program calls an Assembler module this linkage is also automatically done and the assembler module will be
entered with register 1 pointing at the list of addresses, one address per parameter passed, and the last parameter will have
its high bit set to indicate the end of the parameter list.