22.02.2015 Views

HLASM Language Reference

HLASM Language Reference

HLASM Language Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Terms, Literals, and Expressions<br />

The following example shows how to use the length attribute to move a character<br />

constant into either the high-order or low-order end of a storage field.<br />

A1 DS CL8<br />

B2 DC CL2'AB'<br />

HIORD MVC A1(L'B2),B2<br />

LOORD MVC A1+L'A1-L'B2(L'B2),B2<br />

A1 names a storage field 8 bytes in length and is assigned a length attribute of 8.<br />

B2 names a character constant 2 bytes in length and is assigned a length attribute<br />

of 2. The statement named HIORD moves the contents of B2 into the first 2 bytes of<br />

A1. The term L'B2 in parentheses provides the length specification required by the<br />

instruction.<br />

The statement named LOORD moves the contents of B2 into the rightmost 2 bytes of<br />

A1. The combination of terms A1+L'A1-L'B2 adds the length of A1 to the beginning<br />

address of A1, and subtracts the length of B2 from this value. The result is the<br />

address of the seventh byte in field A1. The constant represented by B2 is moved<br />

into A1 starting at this address. L'B2 in parentheses provides the length<br />

specification in both instructions.<br />

For ease in following the preceding example, the length attributes of A1 and B2 are<br />

specified explicitly in the DS and DC statements that define them. However, keep<br />

in mind that the L'symbol term makes coding such as this possible in situations<br />

where lengths are unknown. For example:<br />

C3 DC C'This is too long a string to be worth counting'<br />

STRING MVC BUF(L'C3),C3<br />

Other Attribute <strong>Reference</strong>s<br />

Other attributes describe the characteristics and structure of the data you define in<br />

a program; for example, the kind of constant you specify or the number of<br />

characters you need to represent a value. These other attributes are:<br />

Count (K')<br />

Defined (D')<br />

Integer (I')<br />

Number (N')<br />

Operation code (O')<br />

Scale (S')<br />

| Type (T'); allowed only in conditional assembly.<br />

You can refer to the count (K'), defined (D'), number (N'), and operation code<br />

(O') attributes only in conditional assembly instructions and expressions. For full<br />

details, see “Data Attributes” on page 324.<br />

Literals<br />

You can use literals as operands in order to introduce data into your program. The<br />

literal is a special type of relocatable term. It behaves like a symbol in that it<br />

represents data. However, it is a special kind of term because it also is used to<br />

define the constant specified by the literal. This is convenient because:<br />

The data you enter as numbers for computation, addresses, or messages to be<br />

printed is visible in the instruction in which the literal appears.<br />

You avoid the added effort of defining constants elsewhere in your source<br />

module and then using their symbolic names in machine instruction operands.<br />

40 <strong>HLASM</strong> V1R5 <strong>Language</strong> <strong>Reference</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!