HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Symbolic parameters

HLASM Language Reference
SC26-4940-06

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.

Here are valid symbolic parameters:
&READER    &LOOP2
&A23456    &N
&X4F2      &$4
Here are invalid 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.
Notes:
  1. 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.
  2. Do not begin symbolic parameters with &SYS, these characters are used for system variable symbols provided with High Level Assembler.
The two kinds of symbolic parameters are:
  • Positional parameters
  • Keyword parameters

Each positional or keyword parameter used in the body of a macro definition must be declared in the prototype statement.

Here 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
Here is a macro instruction that calls this macro. The characters 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
If the macro instruction is used in a source program, these assembler language statements are generated:
HERE     ST              2,SAVE
         L               2,FIELDB
         ST              2,FIELDA
         L               2,SAVE

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014