Introduction



Most programs and their sub-routines are statically linked, which is to say they are combined into a single load module by use of the Linkage Editor (also known as the Program Binder).

Programs, including sub-routines can reside as separate entities to be loaded into memory as required, which is called Dynamic Linkage, and z/OS provides the macros listed opposite to facilitate this.

z/OS Dynamic Linkage Macros



Macro

Function

ATTACH

Attach a sub-task. (A sub-task operates asynchronously with the invoker and can compete with for the same or alternative processor. Sub-tasking creates an additional Task Control Block (TCB)).

CALL

Pause the current module and pass control to the specified sub-routine. Used on its own, CALL typically indicates Static Linkage to be resolved by the Linkage Editor, however it can be used in conjunction with LOAD to effect Dynamic Linkage. Once the sub-routine ends processing continues at the instruction after the CALL.

DELETE

Decrement the usage count of a Dynamically CALLed routine, and indicate its memory can be released if appropriate.

DETACH

Deletes a sub-task and is the opposite of ATTACH.

LINK

Pause the current module and pass control to the specified sub-routine. This effects Dynamic Linkage whether combined with LOAD or not. Once the sub-routine ends processing continues at the instruction after the LINK.

LOAD

Fetch a module into memory without executing it.

XCTL

Terminate the current module and pass control to the specified sub-routine, without ensuring a return.


This document focusses on Dynamic Linkage and hence the use of either LINK, XCTL or the combination of LOAD and CALL. Note that the IBM manuals discuss LIST (MF=L) and EXECUTE (MF=E) forms of the macros, but they are omitted from this guide.

Copyright © Legac-e Education 2004-