• Keine Ergebnisse gefunden

Note: An ampersandthat is part of a symbolic parameter is not considered in determining whether a macro-instructlon operand contains an even number

of consecutive ampersands.

LEVELS OF MACRO-INSTRUCTIONS

A macro-definition that corresponds to an outer macro-instruction may contain any number of inner macro-lnstructions. The outer macro-instruction is called a first level macro-instruction. Each of the inner macro-instructions is called a second level macro-lnstruction.

The macro-definltion that corresponds to a second level macro-instruction may contain any number of inner macro-instructions. These macro-instructions are called third level macro instructions, etc.

The number of levels of macro-instructions that may be used depends upon the complexity of the macro-definition and the amount of storage

available.

SECTION 9: HOW TO WRITE CONDITIONAL ASSEMBLY INSTRUCTIONS

The conditional assembly instructions allow the programmer to: (i) define and assign values to SET symbols that can be used to vary parts of

generated statements, and (2) vary the sequence of generated statements.

Thus, the programmer can use these instructions to generate many different sequences of statements from the same macro-deflnition.

There are 13 conditional assembly instructions, i0 of which are described in this section. The other three conditional assembly instructions -- GBLA, GBLB, and GBLC -- are described in Section i0. The instructions described in this section are:

LCLA SETA AIF

LCLB SETB AGO

LCLC SETC ACTR

ANOP

The primary use of the conditional assembly instructions is in macro-definitions. However, all of them may be used in an assembler language source program.

Where the use of an instruction outside macro-definitions differs from its use within macro-definitions, the difference is described in the subsequent text•

The LCLA, LCLB, and LCLC instructions may be used to define and assign initial values to SET symbols.

The SETA, SETB, and SETC instructions may be used to assign arithmetic, binary, and character values, respectively, to SET symbols.

The SETB instruction is described after the SETA and SETC instructions, • because the operand field of the SETB instruction is a combination of the

operand fields of the SETA and SETC instructions.

The AIF, AGO, and ANOP instructions may be used in conjunction with sequence symbols to vary the sequence in which statements are processed by the assembler. The programmer can test attributes assigned by the assembler to symbols or macro-instructlon operands to determine which statements are to be processed. The ACTR instruction may be used to vary the maximum number of AIF and AGO branches.

Examples illustrating the use of conditional assembly instruction are included throughout this section. A chart summarizing the elements that can be used in each instruction appears at the end of this section.

9-1

SET SYMBOLS

SET symbols are one type of variable symbol. The symbolic parameters discussed in Section 7 are another type of variable symbol. SET symbols differ from symbolic parameters in three ways: (i) where they can be used in an assembler language source program, (2) how they are assigned values, and (3) whether or not the values assigned to them can be changed.

Symbolic parameters can only be used in macro-deflnltions, whereas SET symbols can be used inside and outside macro-definitions.

Symbolic parameters are assigned values when the programmer writes a macro-instruction, whereas, SET symbols are assigned values when the

programmer writes SETA, SETB, and SETC conditional assembly instructions.

Each symbolic parameter is assigned a single value for one use of a macro- definition, whereas the values assigned to each SETA, SETB, and SETC

symbol can change during one use of a macro-definltlon.

Defining SET Symbols

SET symbols must be defined by the programmer before they are used.

When a SET symbol is defined it is assigned an initial value. SET symbols may be assigned new values by means of the SETA, SETB, and SETC instructions. A SET symbol is defined when it appears in the operand field of an LCLA, LCLB, or LCLC instruction.

Using Variable Symbols

The SETA, SETB, and SETC instructions may be used to change the values assigned to SETA, SETB, and SETC symbols, respectively. When a SET symbol appears in the name, operation, or operand field of a model statement, the current value of the SET symbol (i.e., the last value assigned to it) replaces the SET symbol in the statement.

For example, if &A is a symbolic parameter, and the corresponding characters of the macro-instructlon are the symbol HERE, then HERE replaces each occurrence of &A in the macro-deflnltlon. However, if &A is a SET symbol, the value assigned to &A can be changed, and a different value can replace each occurrence of &A in the macro-deflnltlon.

The same variable symbol may not be used as a symbolic parameter and as a SET symbol in the same macro-deflnltion.

The following illustrates this rule.

Name Operation Operand

&NAME MOVE &TO,&FROM

If the statement above is a prototype statement, then &NAME,&TO, and

&FROM may not be used as SETsymbols in the macro-definition.

The samevariable symbol maynot be used as two different types of SET symbols in the samemacro-definition. Similarly, the samevariable symbol may not be used as two different types of SET symbols outside macro-definitions.

For example, if &A is a SETAsymbol in a macro-definition, it cannot be used as a SETCsymbol in that definition. Similarly, if &A is a SETA symbol outside macro-definitions, it cannot be used as a SETCsymbol outside macro-definitions.

The samevariable symbol maybe used in two or more macro-definitions and outside macro-definitions. If such is the case, the variable symbol will be considered a different variable symbol each time it is used.

For example, if &A is a variable symbol (either SETsymbol or symbolic parameter) in one macro-deflnltlon, it can be used as a variable symbol

(either SETsymbol or symbolic parameter) in another definition. Similarly, if &A is a variable symbol (SETsymbol

or symbolic parameter) in a

macro-definition, it can be used as a SET symbol outside macro-definltions.

All variable symbols may be concatenated with other characters in the same way that symbolic parameters may be concatenated with other characters. The rules for concatenating symbolic parameters with other characters are in Section 7 under the subsection "Symbolic Parameters."

Variable symbols in macro-instructions are replaced by the values assigned to them, immediately prior to the start of processing the definition. If a SET symbol is used in the operand field of a

macro-instruction, and the value assigned to the SET symbol is equivalent to the sublist notation, the operand is not considered a sublist.

ATTRIBUTES

The assembler assigns attributes to macro-instruction operands and to symbols in the program. These attributes may be referred to only in conditional assembly instructions or expressions.

There are six kinds of attributes. They are: type, length, scaling, integer, count, and number. Each kind of attribute is discussed in the paragraphs that follow.

9-3

If an outer macro-instructlon operand is a symbol before substitution,