Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
&SYSNDX System Variable Symbol HLASM Language Reference SC26-4940-06 |
|
For each macro invocation, a new value of &SYSNDX is assigned. The previous value is incremented by 1. Thus, you can attach &SYSNDX to the end of a symbol inside a macro definition to generate a unique suffix for that symbol each time you call the definition. Although an apparently identical symbol is to be generated by two or more calls to the same definition, the suffix provided by &SYSNDX produces two or more unique symbols. For example, the symbol ABC&SYSNDX might generate ABC0001 on one invocation of a macro, and ABC0002 on the next invocation. Thus you avoid an error being flagged for multiply defined symbols. The local-scope system variable symbol &SYSNDX is assigned a read-only value each time a macro definition is called from a source module. The value assigned to &SYSNDX is a number from 1 to 9999999. For the numbers 0001 through 9999, four digits are generated. For the numbers 10000 through 9999999, the value is generated with no zeros to the left. The value 0001 is assigned to the first macro called by a program, and is incremented by one for each subsequent macro call (including nested macro calls). The maximum value for &SYSNDX can be controlled by the MHELP
instruction described under MHELP Control on &SYSNDX:.
Notes:
The example that follows shows the use of &SYSNDX, and a way
to communicate local &SYSNDX values among macro instructions.
It is assumed that the first macro instruction processed, OUTER1,
is the 106th macro instruction processed by the assembler.
Statement 7 is the 106th macro instruction processed. Therefore, &SYSNDX is assigned the number 0106 for that macro instruction. The number 0106 is substituted for &SYSNDX when it is used in statements 4 and 6. Statement 4 is used to assign the character value 0106 to the SETC symbol &NDXNUM Statement 6 is used to create the unique name B0106. Statement 5 is the 107th macro instruction processed. Therefore, &SYSNDX is assigned the number 0107 for that macro instruction. The number 0107 is substituted for &SYSNDX when it is used in statements 1 and 3. The number 0106 is substituted for the global-scope SETC symbol &NDXNUM in statement 2. Statement 8 is the 108th macro instruction processed. Therefore, each occurrence of &SYSNDX is replaced by the number 0108. For example, statement 6 is used to create the unique name B0108. When statement 5 is used to process the 108th macro instruction, statement 5 becomes the 109th macro instruction processed. Therefore, each occurrence of &SYSNDX is replaced by the number 0109. For example, statement 1 is used to create the unique name A0109. |
Copyright IBM Corporation 1990, 2014
|