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.
The following are valid symbolic parameters:
&READER &LOOP2 &A23456 &N &X4F2 &$4
The following are not valid symbolic parameters:
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.
The value of the parameter remains constant throughout the processing of the containing macro definition during each call of that definition.
The two kinds of symbolic parameters are:
Each positional or keyword parameter used in the body of a macro definition must be declared in the prototype statement.
The following is an example of a macro definition with symbolic parameters.
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
In the following macro instruction that calls the above macro, the characters HERE, FIELDA, and FIELDB of the MOVE macro instruction correspond to the symbolic parameters &NAME, &TO, and &FROM, respectively, of the MOVE prototype statement.
HERE MOVE FIELDA,FIELDB
If the preceding macro instruction were used in a source program, the following assembler language statements would be generated:
HERE ST 2,SAVE
L 2,FIELDB
ST 2,FIELDA
L 2,SAVE
[ Top of Page | Previous Page | Next Page | Contents | Index ]