The externref specifies a destination for subroutine invocation. The format for an externref is:
&[packagename.]name[^name]
Where packagename, like the name elements is a valid GT.M name. Because of the parsing conventions of GT.M, the identifier between the ampersand (&) and the optional parameter-list has precisely constrained punctuation – a later section describes how to transform this into a more richly punctuated name should that be appropriate for the called function. While the intent of the syntax is to permit the name^name to match an GT.M labelref, there is no semantic implication to any use of the up-arrow (^). For more information on M names, labelrefs and parameter-lists, refer to the "General Language Features" chapter in this manual.
The name after the period follows M rules for a single name or two names separated by a caret (^), and thus permits specifications in the M form label^routinename.
name[^name] specifies an external routine that appears within the name-space identified by packagename in the external call table. name[^name] must be unique within that name-space. If the name-space does not contain an entry corresponding to name[^name], the VMS LINKER generates a warning and GT.M generates a run-time error.
DO commands may specify an externref in place of an M entryref. Extrinsic functions and extrinsic special variables may specify an externref in place of a labelref.
Example:
SET X=$&MATH.NATRLOG(Y)
This invokes the NATRLOG function in the MATH package and passes the value of Y by value.
Example:
DO &UNIX.DATE(.A)
This invokes the DATE subroutine in the "UNIX" package and passes A by reference.