Macros are divided into types on the basis of the manner in which their operands are passed. The various types are type O, type R (where the operands are passed in registers) and type S (where the operands are passed in memory; S = storage).
O-type macros
Macros which are neither type R nor type S are known as O-type macros.
Examples of this type are macros in which a register (often only R1) containing the start address of the operand list is specified in the operand field.
The operand list is defined in the data section of the program (using DC statements) and contains the operand values.
R-type macros
Operation | Operands |
|
|
A macro belongs to type R if all necessary operand values can be loaded into the two registers (0 and 1) used for this purpose. An R-type macro does not generate an operand list.
The operands may be specified directly or placed in registers 0 and 1.
Address operands in R-type macros may be specified as explicit or implicit addresses.
S-type macros
Format 1 (S-, L-, D-, C-, M form)
Name | Operation | Operands |
|
|
|
Format 2 (E form)
Name | Operation | Operands |
|
|
|
For S-type macros, the operand values specified in the macro are passed to the function module in the form of a data area which is part of the macro expansion. This is a suitably structured area which contains the data and memory definitions (DC and DS statements) necessary for passing the operand values.
The following applies to all macros that can be called with a specific macro version (e.g. via the VERSION or PARMOD operand): the version operand must have the same value in all calls with different values for the MF operand (MF=L/E/D/C).
With regard to MF, there are six different macro call forms: S form, E form, L form, D form, C form and M form.
S form = standard form
MF=S is the default value. The instruction section is generated first, followed by the data area with the operand values specified in the macro call. This data area contains no field names and no explanatory equates. The standard header is initialized.
E form = execute form
Operation | Operands | |
|
|
|
The E form of the MF operand initiates a supervisor call (SVC): the contents of an operand list (see L form) are evaluated and the corresponding operations are executed. For this reason, the “execute” macro call must include the address of the operand list, either as a symbolic address (addr) or in a register (r/1). No other operands are evaluated.
“label” is the symbolic address of the macro in the Assembler program.
L form = LIST form
Operation | Operands | |
|
|
|
The list form uses the other operands specified in the macro to generate an operand list. This list does not contain symbolic addresses for the operands; these are generated by the C or D form of the macro. The address of the operand list must be specified in the macro (E form), which means that the symbolic address “label” must always be specified.
The operand list begins with the standard header (see "Standard header"), whose fields are loaded automatically when the list is created with MF=L. Even if an operand list is to be created dynamically with the D or C form, it must be initialized beforehand with MF=L in order to ensure that the header contains the correct information.
D form = DSECT form
Operation | Operands | |
|
|
|
The D form generates a DSECT for the operand list of the macro. The first character of the generated names can be modified via the PREFIX operand. If a symbolic address is defined for the macro via “label”, the DSECT receives this name. If “label” is not defined, the DSECT receives a macro-specific default name whose first character is likewise modified by PREFIX. The operand list should be initialized with the list form of the macro before the DSECT call in order to ensure that the standard header contains the correct information.
C form
Operation | Operands | |
|
|
|
Like the D form, the C form generates an operand list, but not in the form of a DSECT since no DSECT statement is generated. The operand list remains empty and should be initialized with the L form of the macro call in order to ensure, above all, that the standard header contains the correct information.
Using the PREFIX operand, the first character of the generated names can be changed, while the MACID operand can be used to change the second to fourth characters in these names (a string of up to three characters can be specified for MACID). If the macro is addressed symbolically via “label”, this is also the address of the operand list; if “label” is not specified, the operand list cannot be addressed symbolically.
M form = modification form
Operation | Operands | |
|
|
|
Instructions (e.g. MVCs) are generated to overwrite the fields in an initialized data area (operand list) with the operand values specified in the macro call. The M form thus offers an easy way of dynamically matching the operand values with which a macro is called to the requirements of the program.
Since the instructions generated for this purpose use the addresses and equates of the C form or D form, care must be taken, when using the M form, that these names are available for addressing the operand list to be modified. In particular, care must be taken that, if specified, the operands PREFIX and MACID in a macro call with MF=M have the same values as in the associated MF=C or MF=D call.