DSECT instruction
- symbol
- Is one of the following:
- An ordinary symbol
- A variable symbol that has been assigned a character string with a value that is valid for an ordinary symbol
- A sequence symbol
The DSECT instruction can be used anywhere in a source module after the ICTL instruction.
If symbol denotes an ordinary symbol, the ordinary symbol identifies the dummy section. If several DSECT instructions within a source module have the same symbol in the name field, the first occurrence initiates the dummy section and the rest indicate the continuation of the dummy section. The ordinary symbol denoted by symbol represents the address of the first byte in the dummy section, and has a length attribute value of 1.
If symbol is not specified, or if name is a sequence symbol, the DSECT instruction initiates or indicates the continuation of the unnamed control section.
The location counter for a dummy section is always set to an initial value of 0. However, when an interrupted dummy control section is continued using the DSECT instruction, the location counter last specified in that control section is continued.
- The assembler language statements that appear in a dummy section are not assembled into object code.
- When establishing the addressability of a dummy section, the symbol in the name field of the DSECT instruction, or any symbol defined in the dummy section can be specified in a USING instruction.
- A symbol defined in a dummy section can be specified in an address constant only if the symbol is paired with another symbol from the same dummy section, and if the symbols have opposite signs.
- Provide one of:
- An ordinary or labeled USING statement that specifies:
- A general register that the assembler can use as a base register for the dummy section.
- A label in the dummy section. The USING instruction tells the assembler that the register contains the address of this label.
- A dependent or labeled dependent USING statement that specifies:
- A supporting base address (for which there is a corresponding ordinary USING statement) that lets the assembler determine a base register and displacement for the dummy section.
- A value from the dummy section that the assembler can assume is the same as the supporting base address.
- An ordinary or labeled USING statement that specifies:
- Ensure that the base register is loaded with one of:
- The actual address of the storage area if an ordinary USING statement or a labeled USING statement was specified.
- The base address specified in the corresponding ordinary USING statement if a dependent or labeled dependent USING statement was specified.
The values assigned to symbols defined in a dummy section are relative to the initial statement of the section. Thus, all machine instructions that refer to names defined in the dummy section refer, at execution time, to storage locations relative to the address loaded into the register.
Figure 1 shows an example of how to code
the DSECT instruction. The sample code is referred to as Assembly-2
.
- Places a record in an area of storage
- Places the address of the storage area in general register 3
- Branches to Assembly-2 to process the record
INCODE
, OUTPUTA
,
and OUTPUTB
. The statement USING INAREA,3
assigns
general register 3 as the base register for the INAREA
DSECT.
General register 3 contains the address of the storage area. The
symbols in the DSECT are defined relative to the beginning of the
DSECT. This means that the address values they represent are, at the
time of program execution, the actual storage locations of the storage
area that general register 3 addresses. ASEMBLY2 CSECT
USING *,15
USING INAREA,3
CLI INCODE,C'A'
BE ATYPE
MVC OUTPUTA,DATA_B
MVC OUTPUTB,DATA_A
B FINISH
ATYPE DS 0H
MVC OUTPUTA,DATA_A
MVC OUTPUTB,DATA_B
FINISH BR 14
DATA_A DC CL8'ADATA'
DATA_B DC CL8'BDATA'
INAREA DSECT
INCODE DS CL1
OUTPUTA DS CL8
OUTPUTB DS CL8
END