The assembler maintains a separate location counter for each section, element, and part. The location counter setting for the first section starts at 0, except when an initial section is started with a START instruction that specifies a nonzero location counter value. The location values assigned to the instructions and other data in a section, element, or part are, therefore, relative to the location counter setting at the beginning of that section, element, or part.
For executable sections, the location values that appear in the listings depend on the THREAD option:
For reference control sections, the location values that appear in the listings always start from 0.
You can continue a control section, element, or part that has been discontinued and, thereby, intersperse code sequences from different control sections, elements, or parts. Note that the location values that appear in the listings for such discontiguous sequences are divided into segments that follow from the end of one segment to the beginning of the subsequent segment.
The location values, listed for the next defined control section, element, or part, begin after the last location value assigned to the preceding such item.
On z/VSE, or when you specify the NOGOFF assembler option on z/OS and CMS, the maximum value of the location counter and the maximum length of a control section is 224-1, or X'FFFFFF' bytes. If LIST(133) is in force, then the high-order byte is shown as zero.
When you specify the GOFF assembler option, the maximum value of the location counter and the maximum length of an element or part is 231-1, or X'7FFFFFFF' bytes.
The assembler also maintains a length counter for each individually relocatable component of the program: executable and reference control sections, elements, and parts.
If any location counter overflows its maximum value, High Level Assembler issues the severe error message:
ASMA039S Location counter error
and continues assembling with the location counter value "wrapping" around to zero.
The length of a section, element, or part cannot exceed the maximum allowed length described above. If the length counter reaches this maximum value, it stays fixed at that value without an error condition or error message. Exceeding the length counter will cause overflow of the location counter, producing the ASMA039S message.
The location counter setting is relative to the beginning of the location it represents, and the length counter represents the cumulative length of the control section. This means that the length counter is nearly always greater than the location counter, and can exceed its maximum value before the location counter. Even if the location counter overflows, the length counter value may be correct, and reassembling with the NOTHREAD option may avoid the location counter overflow condition.
High Level Assembler lets you use multiple location counters for each individual control section. Use the LOCTR instruction (see LOCTR instruction) to assign different location counters to different parts of a control section. The assembler then rearranges and assembles the coding together, according to the different location counters you have specified: all coding using the first location counter is assembled together, then the coding using the second location counter is assembled together, and so forth.
An example of the use of multiple location counters is shown in Figure 13. In the example, executable instructions and data areas have been interspersed throughout the coding in their logical sequence, each group of instructions preceded by a LOCTR instruction identifying the location counter under which it is to be assembled. The assembler rearranges the control section so that the executable instructions are grouped together and the data areas are grouped together. Symbols are not resolved in the order they appear in the source program, but in location counter sequence.
SOURCE MODULE LINKED MODULE
(shown in source code format)
*----------------------------------* *----------------------------------* -*
| INST CSECT | | | controlled |
| LR 12,15 *------------------>| LR 12,15 | by INST |
| USING INST,12 *------------------>| USING INST,12 | location |
| . | | . | counter |
| . |*----------------->| TM CODE,X'03' | |
| DATA LOCTR ||*---------------->| BM NEWREC | |
| INPUTREC DS 0CL80 *++-----------* | | |
| RECCODE DS CL1 *++---------* | | | | control
| . ||| | | | | *-- section
| INST LOCTR ||| | | | | | INST
| TM CODE,X'03' **| | | * - - - - - - - - - - - - - - -- - * |
| BM NEWREC *-* | *---->| INPUTREC DS 0CL80 | controlled |
| . | *------>| RECCODE DS CL1 | by DATA |
| DATA LOCTR | | . | location |
| VAL1 DC F'56' *------------------>| VAL1 DC F'56' | counter |
| VAL2 DC F'84' *------------------>| VAL2 DC F'84' | |
| . | | . | |
| . | *----------------------------------* -*
| NEXT CSECT | | | control
| | | | section
| | | | NEXTThe interactions of the LOCTR instruction with sections, classes, and parts is described at LOCTR instruction.
[ Top of Page | Previous Page | Next Page | Contents | Index ]