LINK Macro



The CALL macro is useful when several CSECTs are combined via the Program Binder (Linkage Editor) to form a single larger program. When a CSECT exists as a separate executable entity within a Load Library then a different macro is used and this is LINK. The advantages of dynamic linkage are:


  • Only those CSECTs of a program that are in use will be loaded into central memory thus conserving memory.
  • It may avoid the need to re-link all invoking programs if an amendment is made to the sub-routine.

Dynamic Linkage using the LINK Macro.



LINK syntax



EP=

This provides the member name of the sub-routine by which it is stored in the Load Library.

EPLOC=

This is an alternative format where entaddr is the address of the sub-routine either as a A-type constant or a General Purpose Register (GPR) in the range 2 to 12. This address could be obtained by executing the LOAD macro before issuing the LINK.)

PARAM=

This is optional and represents the names of one or more memory areas to be passed as parameters.

VL=

An optional indicator to set the high-order bit to 1 in the last parameter when the number of parameters in the list may vary.


The IBM manual includes descriptions of the LIST (MF=L) and EXECUTE (MF=E) formats which are useful for constructing re-entrant code. There is also a LINKX macro for 64-bit addressing mode.

Copyright © Legac-e Education 2004-