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


Labeled USING instruction

HLASM Language Reference
SC26-4940-06

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.
Read syntax diagramSkip visual syntax diagram
Labeled USING

                                       .----------------.   
                                       V                |   
>>-label--USING--+-base-------------+----,base_register-+------><
                 '-(base-+------+-)-'                       
                         '-,end-'                           

label
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
base
Specifies a base address, which can be a relocatable or an absolute expression. The value of the expression must lie between 0 and 231-1.
end
Specifies the end address, which can be a relocatable or an absolute expression. The value of the expression must lie between 0 and 231-1. The end address can exceed the (base address + default range) without error. The end address must be greater than the base and must have the same relocatability attributes.
base_register
Is an absolute expression whose value represents general registers 0 through 15.

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 can 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
         .
         .

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014