• Aucun résultat trouvé

A

B

C MEXIT

D E

F

MEND

START

0

EXITS

Figure 44. MEXIT Operation

For example:

MACRO MACI

&VAL AREAD

·

&VALI AREAD MEND

·

CSECT MACI

·

THIS IS THE STATEMENT TO BE PROCESSED FIRST

THIS IS THE SECOND STATEMENT FOR THE SECOND AREAD END

·

170 Assembler H Version 2 Application Programming: Language Reference

V

~

n

o

o

COMMENTS STATEMENTS

Ordinary comments statements allow you to make descriptive remarks about the generated output from a macro definition.

Ordinary comments statements can be used in macro definitions and in open code.

A comments statement consists of an asterisk in the begin column followed by any character string. The comments statement is used by the assembler to generate an assembler language comments statement, just as other model statements are u~ed by the

assembler to generate assembler statements. No variable symbol substitution is performed.

INTERNAL MACRO COMMENTS STATEMENTS

You can also write internal macro comments in the body of a macro definition to describe the operations performed at preassembly time when the macro is processed.

Internal macro comments statements can be used only inside macro definitions. They may appear anywhere in a macro definition.

An example of their correct use is given below:

Begin column (standard value):

Column 1 must contain a period (.).

Column 2 must contain an asterisk (*).

Column 3 may contain the start of any character string.

Note:

Internal macro comments will not be generated.

No values are substituted for any variable symbols that are specified in internal macro comments statements.

SYSTEM VARIABLE SYMBOLS

System variable symbols are variable symbols whose values are set by the assembler according to specific rules. You can use these symbols as points of substitution in model statements and conditional assembly instructions.

System variable symbols (&SYSDATE, &SYSPARM, and &SYSTIME) can be used as points of substitution both inside macro definitions and in open code. &SYSlOC gives you the name of the location counter in effect when the macro instruction appears. The remaining system variable symbols (&SYSECT, &SYSLOC, &SYSLIST, and &SYSNDX) can be used only inside macro definitions. All

system variable symbols are subject to the same rules of concatenation and substitution as other variable symbols.

System variable symbols must not be used as symbolic parameters in the macro prototype statement. Also, they must not be

declared as SET symbols.

The assembler assigns read-only values to system variable

symbols; they cannot be changed by using the SETA, SETB, or SETC instruction.

SCOPE OF SYSTEM VARIA~LE SYMBOLS: The system variable symbols (&SYSDATE, &SYSPARM, and &SYSTIME) have a global scope. This means that they are assigned a read-only value for an entire source module, a value that is the same throughout open code and inside any macro definitions called.

The system variable symbols (&SYSECT, &SYSLOC, &SYSLIST, and

&SYSNDX) have a local scope. They are assigned a read-only Chapter 7. How to Prepare Macro Definitions 171

·

value each time a macro is called, and have that value only within the expansion of the called macro.

&SYSDATE--Hacro Instruction Date

You can use &SYSDATE to obtain the date on which your source module is assembled.

&SYSDATE is assigned a read-only value of the following format:

mm/dd/yy (8-character string) where:

mm gives the month.

dd gives the day.

yy gives the year.

Example:

11/25/82

Note:

This date corresponds to the date printed in the page

heading of listings and remains constant for each assembly.

Note:

The value of the type attribute of &SYSDATE (T'&SYSDATE) is always U, and the value of the count attribute (K'&SYSDATE) is always 8.

&SYSECT--current Control section

You can use &SYSECT in a macro definition to generate the name of the current control section. The current control section is the control section in which the macro instruction that calls the definition appears.

The local system variable symbol &SYSECT is assigned a read-only value each time a macrQ definition is called.

The value assigned is the symbol that represents the name of the current control section from which the macro definition is

called. Note that it is the control section in effect when the macro is called. A control section that has been initiated or continued by substitution does not affect the value of &SYSECT for the expansion of the current macro. However, it does affect

&SYSECT for a subsequent macro call. Nested macros cause the assembler to assign a value to &SYSECT that depends on the control section in force inside the outer macro when the inner macro is called.

Notes:

1. The control section whose name is assigned to &SYSECT can be defined by a START, CSECT, DSECT, or COM instruction.

2. The value of the type attribute of &SYSECT (T'&SYSECT) is always U, and the value of the count attribute (K'&SYSECT)

is equal to the number of characters assigned as a value to

&SYSECT.

3. Throughout the use of a macro definition, the value of

&SYSECT may be considered a constant, independent of any CSECT or DSECT statements or inner macro instructions in that definition.

172 Assembler H Version 2 Application Programming: language Reference

n

0

o

The next example illustrates these rules. In it, statement 8 is the last CSECT, DSECT, or START statement processed before

st~tem~~! .. ~_!~ ~rocessed. T~erefore,_~~!~~CT is.a:ssign~d_the

6.

Statement 3 is the last CSECT, DSECT, or START statement

processed before statement 4 is processed. Therefore, &SYSECT is assigned the value CSOUT1 for macro instruction INNER in statement 4. CSOUT1 is substituted for &SYSECT when it appears in statement 2.

statement 1 is used to generate a CSECT statement for statement 4. This is the last CSECT, DSECT, or START statement that appears before statement 5. Therefore, &SYSECT is assigned the value INA for macro instruction INNER in statement 5. INA is

appears before statement 10. Therefore, &SYSECT is assigned the value INS for macro instruction OUTER2 in statement 10. INB is

Dans le document Assembler H Version 2 Application Programming: (Page 184-187)