The labeled USING instruction specifies a base address, one or more base registers, and a USING label which can be used as a symbol qualifier.
| Labeled USING |
|---|
|
The default range is 4096 per base register.
The essential difference between a labeled USING instruction and an ordinary USING instruction is the label placed on the USING statement. To indicate to the assembler that the USING established with the label is to provide resolution of base and displacement for a symbol, the label must be used to qualify the symbol. Qualifying a symbol consists of preceding the symbol with the label on the USING followed by a period. The only symbols resolved by the labeled USING are those symbols qualified with the label. This label cannot be used for any other purpose in the program, except possibly as a label on other USING instructions.
The following examples show how labeled USINGs are used:
PRIOR USING IHADCB,R10
NEXT USING IHADCB,R2
MVC PRIOR.DCBLRECL,NEXT.DCBLRECL
The same code without labeled USINGs could be written like this:
USING IHADCB,R10
MVC DCBLRECL,DCBLRECL-IHADCB(R2)
In the following example, a new element, NEW, is inserted into a doubly-linked list between two existing elements LEFT and RIGHT, where the links are stored as pointers LPTR and RPTR:
LEFT USING ELEMENT,R3
RIGHT USING ELEMENT,R6
NEW USING ELEMENT,R1
.
.
MVC NEW.RPTR,LEFT.RPTR Move previous Right pointer
MVC NEW.LPTR,RIGHT.LPTR Move previous Left pointer
ST R1,LEFT.RPTR Chain new element from Left
ST R1,RIGHT.LPTR Chain new element from Right
.
.
ELEMENT DSECT
LPTR DS A Link to left element
RPTR DS A Link to right element
.
.
The range of a labeled USING instruction (called the labeled USING range) is the 4096 bytes beginning at the base address specified in the labeled USING instruction, or the range as specified by the range end, whichever is the lesser. Addresses that lie within the labeled USING range can be converted from their implicit form (qualified symbols) to their explicit form; those outside the USING range cannot be converted.
Like the ordinary USING range, the labeled USING range is the range of addresses in a control section that is associated with the base register specified in the labeled USING instruction. If the labeled USING instruction assigns more than one base register, the composite labeled USING range is the product of the number of registers specified in the labeled USING instruction and 4096 bytes. The composite labeled USING range begins at the base address specified in the labeled USING instruction. Unlike the ordinary USING range, however, you cannot specify separate labeled USING instructions to establish the same labeled USING range. For example,
IN USING BASE,10,11
specifies a range of 8192 bytes beginning at BASE, but
IN USING BASE,10 IN USING BASE+4096,11
specifies a single labeled USING range of 4096 bytes beginning at BASE+4096.
You can specify the same base address in any number of labeled USING instructions. You can also specify the same base address in an ordinary USING and a labeled USING. However, unlike ordinary USING instructions that have the same base address, if you specify the same base address in an ordinary USING instruction and a labeled USING instruction, High Level Assembler does not treat the USING ranges as coinciding. When you specify an unqualified symbol in an assembler instruction, the base register specified in the ordinary USING is used by the assembler to resolve the address into base-displacement form. An example of coexistent ordinary USINGs and labeled USINGs is given below:
USING IHADCB,R10
SAMPLE USING IHADCB,R2
MVC DCBLRECL,SAMPLE.DCBLRECL
In this MVC instruction, the (unqualified) first operand is resolved with the ordinary USING, and the (qualified) second operand is resolved with the labeled USING.
The domain of a labeled USING instruction (called the labeled USING domain) begins where the USING instruction appears in a source module. It continues to the end of the source module, except when:
You can specify the same base register or registers in any number of labeled USING instructions. However, unlike ordinary USING instructions, as long as all the labeled USINGs have unique labels, the assembler considers the domains of all the labeled USINGs to be active and their labels eligible to be used as symbol qualifiers. With ordinary USINGs, when you specify the same base register in a subsequent USING instruction, the domain of the prior USING is ended.
The assembler converts implicit address references into their explicit form using the base register or registers specified in a labeled USING instruction when the following conditions are met:
[ Top of Page | Previous Page | Next Page | Contents | Index ]