Symbolic parameters
Symbolic parameters let you receive values into the body of a macro definition from the calling macro instruction. You declare these parameters in the macro prototype statement. They can serve as points of substitution in the body of the macro definition and are replaced by the values assigned to them by the calling macro instruction.
By using symbolic parameters with meaningful names, you can indicate the purpose for which the parameters (or substituted values) are used.
Symbolic parameters must be valid variable symbols. A symbolic parameter consists of an ampersand followed by an alphabetic character and from 0 to 61 alphanumeric characters.
&READER &LOOP2
&A23456 &N
&X4F2 &$4
CARDAREA first character is not an ampersand
&256B first character after ampersand is not alphabetic
&BCD%34 contains a special character other than initial ampersand
&IN AREA contains a special character [space] other than initial ampersand
Symbolic parameters have a local scope; that is, the name and value they are assigned only applies to the macro definition in which they have been declared.
- Symbolic parameters must not have multiple definitions or be identical to any other variable symbols within the given local scope. This applies to the system variable symbols described in System variable symbols, and to local-scope and global-scope SET symbols described in SET symbols.
- Do not begin symbolic parameters with
&SYS
, these characters are used for system variable symbols provided with High Level Assembler.
- Positional parameters
- Keyword parameters
Each positional or keyword parameter used in the body of a macro definition must be declared in the prototype statement.
MACRO Header
&NAME MOVE &TO,&FROM Prototype
&NAME ST 2,SAVE Model
L 2,&FROM Model
ST 2,&TO Model
L 2,SAVE Model
MEND Trailer
HERE
, FIELDA
,
and FIELDB
of the MOVE
macro instruction
correspond to the symbolic parameters &NAME
, &TO
,
and &FROM
, of the MOVE
prototype
statement. HERE MOVE FIELDA,FIELDB
HERE ST 2,SAVE
L 2,FIELDB
ST 2,FIELDA
L 2,SAVE