The calling-standard macros use the concept of a single, current,
active routine. A routine is a programming entity that is
associated with a procedure descriptor that may be called, or
is a main routine specified as the transfer address of a linked
image.
Only one routine can be active or current at any given time
during assembly. If more than one routine is defined in a single
assembler source file, all items associated with the current
routine, that is, within the lexical scope of the routine, must
be completed before making a different routine current. The
lexical scope of one routine cannot overlap the lexical scope
of another routine.
A routine becomes current or comes into scope by invoking the
$ROUTINE macro with the appropriate arguments. $ROUTINE marks the
beginning of the lexical scope of a routine. The complementary
macro, $END_ROUTINE, marks the end of the current routine's
lexical scope.
1 – Routines and Program Sections
Routines have three types of associated program sections:
o Code section-Contains the executable instructions of the
routine. This section is typically read-only and executable.
o Data section-Contains data accessed by a routine. Typically,
this is where variable data is stored. This section is
typically nonexecutable, readable, and writeable.
o Linkage section-Contains a routine's procedure descriptor and
the necessary linkage information for calling other routines,
and for linkage to data not in the linkage section, if any.
Also, constant data may be placed here. Typically, this
section is read-only and not executable.
The linkage section is considered a type of data section with
the following function:
- Provides linkage information for calls made from a routine
associated with the linkage section.
- Provides linkage information for data outside of the
linkage section.
- Defines the associated routine's procedure descriptor so
that calls can be made to the routine.
- Defines constant or static data.