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


Positional operands

HLASM Language Reference
SC26-4940-06

You can use a positional operand to pass a value into a macro definition through the corresponding positional parameter declared for the definition. Declare a positional parameter in a macro definition when you want to change the value passed at every call to that macro definition.

You can also use a positional operand to pass a value to the system variable symbol &SYSLIST. If &SYSLIST, with the applicable subscripts, is specified in a macro definition, you do not need to declare positional parameters in the prototype statement of the macro definition. You can thus use &SYSLIST to refer to any positional operand. This allows you to vary the number of operands you specify each time you call the same macro definition.

The positional operands of a macro instruction must be specified in the same order as the positional parameters declared in the called macro definition.

Each positional operand constitutes a character string. This character string is the value passed through a positional parameter into a macro definition.

The specification for each positional parameter in the prototype statement definition must be a valid variable symbol. Values are assigned (see  1 ) to the positional operands by the corresponding positional arguments see  2  below) specified in the macro instruction that calls the macro definition.
Figure 1. Positional operands
                       Source Module
             ┌────────────────────────────────────────────────┐
Macro        │         MACRO                                  │
Definition   ├────────────────────────────────────────────────┤
             │         POSPAR         &POS1,&POS2,&POS3       │
             │         .                                   │
             │         .                │     │     │         │
             │         MEND             │     │     │         │
             ├──────────────────────────┼─────┼─────┼─────────┤
             │         .                │     │     │         │
             │         .                1     1     1         │
             │         START            │     │     │         │
             │         .                │  ┌──┘ ┌───┘         │
             │         .                │  │    │             │
Macro        │         POSPAR         ONE,TWO,THREE      2    │
Instruction  │         .                                      │
             │         .                                      │
             │         END                                    │
             └────────────────────────────────────────────────┘
Notes:
  1. An omitted operand has a null character value.
  2. Each positional operand can be up to1024 characters long.
  3. If the DBCS assembler option is specified, the positional operand can be a string containing double-byte data. The string does not need to be quoted.
Here are examples of macro instructions with positional operands:
         MACCALL         VALUE,9,8
         MACCALL         &A,'QUOTED STRING'
         MACCALL         EXPR+2,,SYMBOL
         MACCALL         (A,B,C,D,E),(1,2,3,4)
         MACCALL         &A,'<.S.T.R.I.N.G>'
The following list shows what happens when the number of positional operands in the macro instruction is equal to or differs from the number of positional parameters declared in the prototype statement of the called macro definition:
Equal
Valid, if operands are correctly specified.
Greater than
Meaningless, unless &SYSLIST is specified in definition to refer to excess operands.
Less than
Omitted operands give null character values to corresponding parameters (or &SYSLIST specification).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014