HLASM Language Reference
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Use of multiple location counters

HLASM Language Reference
SC26-4940-06

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 on, for futher location counters.
An example of the use of multiple location counters is shown in Figure 1. In the example, executable instructions and data areas have been interspersed throughout the coding in their logical sequence. Each group of instructions is preceded by a LOCTR instruction that identifies 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.
Figure 1. Use of multiple location counters
           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
│                                  │                   │                                  │ NEXT

The interactions of the LOCTR instruction with sections, classes, and parts is described at LOCTR instruction.

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014