High Level Assembler for z/OS & z/VM & z/VSE. Language Reference (Version 1 Release 6) - page 9

 

  Главная      Manuals     High Level Assembler for z/OS & z/VM & z/VSE. Language Reference (Version 1 Release 6)

 

Search            copyright infringement  

 

 

 

 

 

 

 

 

 

 

 

Content      ..     7      8      9      10     ..

 

 

 

High Level Assembler for z/OS & z/VM & z/VSE. Language Reference (Version 1 Release 6) - page 9

 

 

Bit-length modifier: The length modifier can be specified to indicate the number
of bits into which a constant is to be assembled. The bit-length modifier is written
as L.n where n is either a decimal self-defining term, or an absolute expression
enclosed in parentheses. It must have a positive value. Such a modifier is
sometimes called a “bit-length” modifier, to distinguish it from a “byte-length”
modifier. You cannot combine byte-length and bit-length modifiers. For example, a
12 bit field must be written L.12, not L1.4.
The value of n is 1 - the number of bits (a multiple of 8) that are required to make
up the maximum number of bytes allowed in the type of constant being defined.
The bit-length modifier can never be used with the CU-, G-, S-, V-, R-, J- and
Q-type constants, and cannot be used with the A-type or Y-type constant if the
operand is simply or complexly relocatable.
When only one operand and one nominal value are specified in a DC instruction,
the following rules apply:
1. The bit-length modifier allocates a field into which a constant is to be
assembled. The field starts at a byte boundary and can run over one or more
byte boundaries, if the bit length is greater than 8.
If the field does not end at a byte boundary and if the bit length is not a
multiple of 8, the remainder of the last byte is filled with binary zeros. For
example, DC FL.12’-1’ generates X’FFF0’.
2. The nominal value of the constant is assembled into the field:
a. Starting at the high-order end for the C-, E-, D-, and L-type constants
b. Starting at the low-order end for the remaining types of constants that
support a bit-length modifier
3. The nominal value is padded or truncated to fit the field (see “Padding and
truncation of values” on page 134).
“padding” is not the same as “filling”. In padding, the designated bit field is
completed according to the rules for the constant type. Filling is always binary
zeros placed at the right end of an incomplete byte.
C-type character constants are padded with EBCDIC spaces (hexadecimal X'40',
and CA-type character constants are padded with ASCII spaces (hexadecimal
X'20'). Other constant types are padded either by sign extension or with zeros,
according to the type of the constant.
The length attribute value of the symbol naming a DC instruction with a specified
bit length is equal to the minimum number of integral bytes needed to contain the
bit length specified for the constant. Consider the following example:
TRUNCF DC
FL.12’276’
L’TRUNCF is equal to 2. Thus, a reference to TRUNCF addresses both the 2 bytes that
are assembled.
When more than one operand is specified in a DC instruction, or more than one
nominal value in a DC operand, the above rules about bit-length modifiers also
apply, except:
1. The first field allocated starts at a byte boundary, but the succeeding fields start
at the next available bit. For example, BL1 DC FL.12’-1,1000’ generates
X’FFF3E8’.
2. After all the constants have been assembled into their respective fields, the bits
remaining to make up the last byte are filled with zeros. For example,
BL2 DC FL.12’-1,1000,-2’ generates X’FFF3E8FFE0’
Chapter 5. Assembler instruction statements
141
If duplication is specified, filling with zeros occurs once at the end of all the
fields occupied by the duplicated constants. For example, BL3 DC 3FL.12’-2’
generates X’FFEFFEFFE0’.
3. The length attribute value of the symbol naming the DC instruction is equal to
the number of integral bytes needed to contain the bit length specified for the
first constant to be assembled. For example, the symbols BL1, BL2, and BL3 in
the preceding examples each have length attribute 2.
For double-byte data in C-type constants: If bit-lengths are specified, with a
duplication factor greater than 1, and a bit-length which is not a multiple of 8, then
the double-byte data is no longer valid for devices capable of presenting DBCS
characters. No error message is issued.
Storage requirement for constants: The total amount of storage required to
assemble a DC instruction is the sum of:
1. The requirements for the individual DC operands specified in the instruction.
The requirement of a DC operand is the product of:
v The sum of the lengths (implicit or explicit) of each nominal value
v The duplication factor, if specified
2. The number of bytes skipped for the boundary alignment between different
operands; such skipped bytes are filled with binary zeros.
Scale modifier
The scale modifier specifies the amount of internal scaling that you want for:
v Binary digits for fixed-point constants (H, F)
v Hexadecimal digits for floating-point constants (E, D, L)
The scale modifier can be used only with the above types of constants. It cannot be
used with EB, DB, and LB floating point constants.
The range for each type of constant is:
Fixed-point constant H
-187 to +346
Fixed-point constant F
-187 to +346
Floating-point constant E, EH
0 to 14
Floating-point constant D, DH
0 to 14
Floating-point constant L, LH
0 to 28
The scale modifier is written as Sn, where n is either a decimal self-defining term,
or an absolute expression enclosed in parentheses. Both forms of the modifier's
value n can be preceded by a sign; if no sign is present, a plus sign is assumed.
Scale modifier for fixed-point constants: The scale modifier for fixed-point
constants specifies the power of two by which the fixed-point constant must be
multiplied after its nominal value has been converted to its binary representation,
but before it is assembled in its final scaled form. Scaling causes the binary point to
move from its assumed fixed position at the right of the rightmost bit position. For
example:
SMOD DC FS24’6’ assembles to hexadecimal 06000000 which is the nominal value
(6) followed by 24 zero bits which are the fractional part (following the binary
point).
142
HLASM V1R6 Language Reference
SMOD DC FS24’6.5’ assembles to hexadecimal 06800000 where the fractional part
is 0.1 binary which is equal to 0.5 decimal.
Notes:
1. When the scale modifier has a positive value, it indicates the number of binary
positions occupied by the fractional portion of the binary number.
2. When the scale modifier has a negative value, it indicates the number of binary
positions deleted from the integer portion of the binary number.
3. When low-order positions are lost because of scaling (or lack of scaling),
rounding occurs in the leftmost bit of the lost portion. The rounding is reflected
in the rightmost position saved.
Scale modifier for hexadecimal floating-point constants: The scale modifier for
hexadecimal floating-point constants must have a positive value. It specifies the
number of hexadecimal positions that the fractional portion of the binary
representation of a floating-point constant is shifted to the right. The hexadecimal
point is assumed to be fixed at the left of the leftmost position in the fractional
field. When scaling is specified, it causes an unnormalized hexadecimal fraction to
be assembled (unnormalized means that the leftmost positions of the fraction
contain hexadecimal zeros). The magnitude of the constant is retained, because the
exponent in the characteristic portion of the constant is adjusted upward
accordingly. When non-zero hexadecimal positions are lost, rounding occurs in the
leftmost hexadecimal position of the lost portion. The rounding is reflected in the
rightmost position saved.
Exponent modifier
The exponent modifier specifies the power of 10 by which the nominal value of a
constant is to be multiplied before it is converted to its internal binary
representation. It can only be used with the fixed-point (H and F) and
floating-point (E, D, and L) constants. The exponent modifier is written as En,
where n can be either a decimal self-defining term, or an absolute expression
enclosed in parentheses.
The decimal self-defining term or the expression can be preceded by a sign. If no
sign is present, a plus sign is assumed. The range for the exponent modifier is -85
to +75. If a type extension is used to define a floating-point constant, the exponent
modifier can be in the range -231 to 231-1. If the nominal value cannot be
represented exactly, a warning message is issued.
Notes:
1. Do not confuse the exponent modifier with the exponent that can be specified
in the nominal value subfield of fixed-point and floating-point constants.
The exponent modifier affects each nominal value specified in the operand,
whereas the exponent written as part of the nominal value subfield only affects
the nominal value it follows. If both types of exponent are specified in a DC
operand, their values are added together before the nominal value is converted
to binary form. However, this sum must lie within the permissible range of -85
to +75, unless a type extension is specified.
2. The value of the constant, after any exponents have been applied, must be
contained in the implicitly or explicitly specified length of the constant to be
assembled.
Chapter 5. Assembler instruction statements
143
Subfield 6: Nominal Value
The syntax for coding the nominal value is shown in the subfield format operands
in “DC instruction” on page 129.
You must specify the nominal value subfield unless a duplication value of zero is
specified. It defines the value of the constant (or constants) described and affected
by the subfields that precede it. It is this value that is assembled into the internal
binary representation of the constant. Table 21 shows the formats for specifying
constants.
Table 21. Specifying constant values
Constant
Single
Multiple
Type
Nominal Value
Nominal Value
Page No.
C
'value'
not allowed
“Character constant—C” on
page 146
G
'<.v.a.l.u.e>'
not allowed
“Graphic constant—G” on
page 149
'value'
'value,value,...value'
B
“Binary constant—B” on page 145
X
“Hexadecimal constant—X” on page 150
H
“Fixed-point constants—F and H” on page 151
F
“Fixed-point constants—F and H” on page 151
P
“Decimal constants—P and Z” on page 154
Z
“Decimal constants—P and Z” on page 154
E
“Hexadecimal floating-point constants—E, EH,
D
“Hexadecimal floating-point constants—E, EH,
L
“Hexadecimal floating-point constants—E, EH,
(expression)
(expression,expression,...expression)
A
“Address constants” on page 156
Y
“Address constants” on page 156
S
“Address constants” on page 156
V
“Address constants” on page 156
R
“Address constants” on page 156
Q
(value)
(value,value,...value)
“Offset constant—Q” on
page 163
J
(value)
(value,value,...value)
“Length constant—J” on
page 164
As the above list shows:
v A data constant value (any type except A, Y, S, Q, J, R, and V) is enclosed by
apostrophes.
v An address constant value (type A, Y, S, V, R) or an offset constant (type Q) or a
length constant (type J) is enclosed by parentheses.
v To specify two or more values in the subfield, the values must be separated by
commas, and the whole sequence of values must be enclosed by the correct
delimiters; that is, apostrophes or parentheses.
v Multiple values are not permitted for character constants.
Spaces are allowed and ignored in nominal values for the quoted constant types
(BDEFHLPXZ). Spaces are significant for C and G constant types.
144
HLASM V1R6 Language Reference
How nominal values are specified and interpreted by the assembler is explained in
each of the subsections that follow. There is a subsection for each of the following
types of constant:
Binary
Character
Graphic
Hexadecimal
Fixed-Point
Decimal
Packed Decimal
Zoned Decimal
Address
Floating-Point
Literal constants are described in “Literal constants” on page 176.
Binary constant—B
The binary constant specifies the precise bit pattern assembled into storage. Each
binary constant is assembled into the integral number of bytes (see ▌1▐ in Table 22)
required to contain the bits specified, unless a bit-length modifier is specified.
The following example shows the coding used to designate a binary constant. BCON
has a length attribute of 1.
BCON
DC
B’11011101’
BTRUNC
DC
BL1’100100011’
BPAD
DC
BL1’101’
BFOUR
DC
B’1111 0100 1111 0100’
BTRUNC assembles with the leftmost bit truncated, as follows:
00100011
BPAD assembles with five zeros as padding, as follows:
00000101
Table 22. Binary constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
2. Type
B
3. Type Extension
Not Allowed
4. Program type
Allowed
5. Modifiers
Length:
1 to 256
(byte length)
.1
to .2048
(bit length)
Implicit length:
As needed
B DC B’10101111’
L’B = 1
▌1▐
(Length modifier
C DC B’101’
L’C = 1
▌1▐
not present)
Alignment:
Byte
Scale:
Not allowed
Exponent:
Not allowed
6. Nominal value
Chapter 5. Assembler instruction statements
145
Table 22. Binary constants (continued)
Subfield
Value
Example
Result
Represented by:
Binary digits
(0 or 1)
Enclosed by:
Apostrophes
Exponent allowed:
No
Number of values Multiple
per operand:
Padding:
With zeros at left
Truncation of
At left
assembled value:
Character constant—C
The character constant specifies character strings, such as error messages,
identifiers, or other text, that the assembler converts into binary representations.
The type extension specifies the character encoding; "E" for EBCDIC encoding, "A"
for ASCII encoding, and "U" for Unicode UTF-16 encoding. For example, with
EBCDIC encoding the character A assembles to hexadecimal C1; with ASCII
encoding the character A assembles to hexadecimal 41, with UTF-8 encoding the
character A assembles to hexadecimal 0041. When the type extension is omitted,
the TRANSLATE option (see High Level Assembler Programmer's Guide) specifies
the character encoding. The TRANSLATE option defaults to EBCDIC. For
information about type extension “A” see “ASCII data in character constants” on
page 148, and for information about type extension “U” see “Unicode UTF-16 data
from character constants” on page 148
Any of the 256 characters from the EBCDIC character set can be designated in a
character constant. Each character specified in the nominal value subfield is
assembled into one byte (see ▌1▐ in Table 23 on page 147). For more information,
see the discussion about the 82 invariant characters in “Character self-defining
term” on page 35.
A null nominal value is permitted if a length is specified. For example:
DC
CL3’’
is assembled as three EBCDIC spaces with object code X'404040', whereas
DC
CAL3’’
is assembled as three ASCII spaces with object code X'202020'.
Multiple nominal values are not allowed because a comma in the nominal value is
considered a valid character (see ▌2▐ in Table 23 on page 147) and is assembled
into its binary (EBCDIC) representation. For example:
DC
C’A,B’
is assembled as A,B with object code X'C16BC2'.
For a description of the binary and hexadecimal representations of the characters
that make up the standard character set, refer to the web page “Coded Character
Set Reference Material”, which is located at:
146
HLASM V1R6 Language Reference
Give special consideration to representing apostrophes and ampersands as
characters. Each apostrophe or ampersand you want as a character in the constant
must be represented by a pair of apostrophes or ampersands. Each pair of
apostrophes is assembled as one apostrophe, and each pair of ampersands is
assembled as one ampersand (see ▌3▐ in Table 23).
Table 23. Character constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
2. Type
C
3. Type Extension
U
U
DC
CU’UNICODE’
L’U = 14
A
A
DC
CA’ASCII’
L’A = 5
E
E
DC
CE’EBCDIC’
L’E = 6
4. Program type
Allowed
5. Modifiers
Length:
1 to 256
(byte length)
Must be a multiple
of 2 when the
Type Extension is U
.1
to .2048
(bit length)
(Not permitted
if Type Extension
of U is specified.)
Implicit length:
Evaluate as an even
C DC C’LENGTH’
L’C = 6
▌1▐
(Length modifier
number, if Type
not present)
Extension of U is
specified
Alignment:
Byte
Scale:
Not allowed
Exponent:
Not allowed
6. Nominal value
Object code
Represented by:
Characters
DC
C’A’’B’
X’C17DC2’
▌3▐
(all
256 eight bit
DC
CU’AA’
X’00410041’
combinations)
DC
CA’AB’
X’4142’
Enclosed by:
Apostrophes
Exponent allowed:
No (is interpreted as
character data)
Number of values
Object code
per operand:
One
DC
C’A,B’
X’C16BC2’▌2▐
Padding:
With spaces at right
(X'40' EBCDIC, X'20'
ASCII)
Truncation of
assembled value:
At right
In the following example, the length attribute of FIELD is 12:
Chapter 5. Assembler instruction statements
147
FIELD
DC
C’TOTAL IS 110’
However, in this next example, the length attribute is 15, and three spaces appear
in storage to the right of the zero:
FIELD
DC
CL15’TOTAL IS 110’
In the next example, the length attribute of FIELD is 12, although 13 characters
appear in the operand. The two ampersands are paired, and so count as only one
byte.
FIELD
DC
C’TOTAL IS &&10’
In the next example, a length of 4 has been specified, but there are five characters
in the constant.
FIELD
DC
3CL4’ABCDE’
The generated constant is:
ABCDABCDABCD
The same constant can be specified as a literal.
MVC
AREA(12),=3CL4’ABCDE’
On the other hand, if the length modifier is specified as 6 instead of 4, the
generated constant is:
ABCDE ABCDE ABCDE (with one trailing space)
ASCII data in character constants: For Character ASCII (CA) constants the
character string is converted to ASCII (code page 819), assuming that the characters
in the nominal value are represented in code page 37. Any paired occurrences of
ampersands and apostrophes are converted to a single occurrence of such a
character prior to conversion. The assembler then maps each EBCDIC character
into its ASCII equivalent. This constant is not modified by the TRANSLATE option.
Unicode UTF-16 data from character constants: For Character Unicode (CU)
constants the value is converted to Unicode UTF-16 using the code page identified
by the CODEPAGE assembler option. Any paired occurrences of ampersands and
apostrophes are converted to a single occurrence of such a character prior to
conversion. If necessary the value is padded with EBCDIC spaces on the right
(X'40'). The assembler then maps each EBCDIC character into its 2 byte Unicode
UTF-16 equivalent.
For example:
UA
DC
CU’UTF-16’
object code X’ 005500540046002D00310036’
UB
DC
CUL4’L’
object code X’ 004C0020’
UC
DC
CUL2’XYZ’
object code X’ 0058’
Double-byte data in character constants: When the DBCS assembler option is
specified, double-byte data can be used in a character constant. The start of
double-byte data is delimited by SO, and the end by SI. All characters between SO
and SI must be valid double-byte characters. No single-byte meaning is drawn
from the double-byte data. Hence, special characters such as the apostrophe and
ampersand are not recognized between SO and SI. The SO and SI are included in
the assembled representation of a character constant containing double-byte data.
If a duplication factor is used, SI/SO pairs at the duplication points are not
removed. For example, the statement:
148
HLASM V1R6 Language Reference
DBCS
DC
3C’<D1>
results in the assembled character string value of:
<D1><D1><D1>
Null double-byte data (SO followed immediately by SI) is acceptable and is
assembled into the constant value.
The following examples of character constants contain double-byte data:
DBCS0
DC
C’<>
DBCS1
DC
C’<.D.B.C.S>
DBCS2
DC
C’abc<.A.B.C>
DBCS3
DC
C’abc<.A.B.C>def’
The length attribute includes the SO and SI. For example, the length attribute of
DBCS0 is 2, and the length attribute of DBCS2 is 11. No truncation of double-byte
character strings within C-type constants is allowed, since incorrect double-byte
data is created.
It is possible to generate invalid DBCS data in these situations:
v You specify a bit-length modifier that causes truncation of the DBCS data or the
shift-out and shift-in characters.
v You specify the TRANSLATE option.
Graphic constant—G
When the DBCS assembler option is specified, the graphic (G-type) constant is
supported. This constant type allows the assembly of pure double-byte data. The
graphic constant differs from a character constant containing only double-byte data
in that the SO and SI delimiting the start and end of double-byte data are not
present in the assembled value of the graphic constant. Because SO and SI are not
assembled, if a duplication factor is used, no redundant SI/SO characters are
created. For example, the statement:
DBCS
DC
3G’<D1>
results in the assembled character string value of:
D1D1D1
Examples of graphic constants are:
DBCS1
DC
G’<.A.B.C>
DBCS2
DC
GL10’<.A.B.C>
DBCS3
DC
GL4’<.A.B.C>
Because the length attribute does not include the SO and SI, the length attribute of
DBCS1 is 6. The length modifier of 10 for DBCS2 causes padding of 2 double-byte
spaces at the right of the nominal value. The length modifier of 4 for DBCS3 causes
truncation after the first 2 double-byte characters. The length attribute of a graphic
constant must be a multiple of 2.
See also “Double-byte character set notation” on page 8.
Type attribute of G-type constant: Do not confuse the G-type constant character
with the type (data) attribute of a graphic constant. The type attribute of a graphic
constant is @, not G. See the general discussion about data attributes in “Data
attributes” on page 325, and “Type attribute (T')” on page 329.
Chapter 5. Assembler instruction statements
149
Table 24. Graphic constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
DC 3G’<.A>
Object code
X'42C142C142C1'
2. Type
G
3. Type Extension
Not allowed
4. Program type
Allowed
5. Modifiers
Length:
2 to 256, must be
multiple of 2(byte
length)bit length
not allowed
Implicit length:
As needed (twice
GC DC G’<.A.B> L'GC = 4
(Length modifier
the number of
not present)
DBCS characters)
Alignment:
Byte
6. Nominal value
Represented by:
DBCS characters
Object code
delimited by SO
DC
G’<.&.’>
X'4250427D'
and SI
DC
G’<.A><.B>
X'42C142C2'
Enclosed by:
Apostrophes
Number of values
Object code
per operand:
One
DC
G’<.A.,.B>
X'42C1426B42C2'
Padding:
With DBCS spaces
Object code
at right (X'4040')
DC
GL6’<.A>
X'42C140404040'
Truncation of
Object code
assembled value:
At right
DC
GL2’<.A.B>
X'42C1'
Hexadecimal constant—X
Hexadecimal constants generate large bit patterns more conveniently than binary
constants. Also, the hexadecimal values you specify in a source module let you
compare them directly with the hexadecimal values generated for the object code
and address locations printed in the program listing.
Each hexadecimal digit (see ▌1▐ in Table 25 on page 151) specified in the nominal
value subfield is assembled into four bits (their binary patterns can be found in
“Self-defining terms” on page 34). The implicit length in bytes of a hexadecimal
constant is then half the number of hexadecimal digits specified (assuming that a
high-order hexadecimal zero is added to an odd number of digits). See ▌2▐ and ▌3▐
in Table 25 on page 151.
An 8-digit hexadecimal constant provides a convenient way to set the bit pattern
of a full binary word. The constant in the following example sets the first and third
bytes of a word with all 1 bits.
TEST DC 0F,X’FF00FF00’
TEST DC A(X’FF00FF00’)
The DS instruction sets the location counter to a fullword boundary. (See “DS
instruction” on page 179.)
150
HLASM V1R6 Language Reference
The next example uses a hexadecimal constant as a literal and inserts a byte of all
1 bits into the rightmost 8 bits of register 5.
IC
5,=X’FF’
In the following example, the digit A is dropped, because 5 hexadecimal digits are
specified for a length of 2 bytes:
ALPHACON DC
3XL2’A6F4E’
Generates 6F4E 3 times
The resulting constant is 6F4E, which occupies the specified 2 bytes. It is
duplicated three times, as requested by the duplication factor. If it is specified as:
ALPHACON DC
3X’A6F4E’
Generates 0A6F4E 3 times
the resulting constant has a hexadecimal zero in the leftmost position.
0A6F4E0A6F4E0A6F4E
Table 25. Hexadecimal constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
2. Type
X
3. Type Extension
Not allowed
4. Program type
Allowed
5. Modifiers
Length:
1 to 256
(byte length)
.1
to .2048
(bit length)
Implicit length:
As needed
X
DC X’FF00A2’
L’X = 3
▌2▐
(Length modifier
Y
DC X’F00A2’
L’Y = 3
▌2▐
not present)
Alignment:
Byte
Scale:
Not allowed
Exponent:
Not allowed
6. Nominal value
Represented by:
Object code
Hexadecimal
DC
X’1F’
X’1F’ ▌1▐
digits
DC
X’91F’
X’091F’ ▌3▐
(0 to 9 and
A to F)
Enclosed by:
Apostrophes
Exponent allowed:
No
Number of values
per operand:
Multiple
Padding:
With zeros at left
Truncation of
assembled value:
At left
Fixed-point constants—F and H
Fixed-point constants let you introduce data that is in a form suitable for the
arithmetic operations of the binary fixed-point machine instructions. The constants
Chapter 5. Assembler instruction statements
151
you define can also be automatically aligned to the correct doubleword, fullword,
or halfword boundary for the instructions that refer to addresses on these
boundaries (unless the NOALIGN option has been specified; see “General
information about constants” on page 132). You can do algebraic operations using
this type of constant because they can have positive or negative values.
A fixed-point constant is written as a decimal number, which can be followed by a
decimal exponent. The format of the constant is as follows:
1. The nominal value can be a signed or unsigned (see ▌1▐ in Table 26) integer,
fraction, or mixed number (see ▌2▐ Table 26) followed by a signed exponent
(see ▌3▐ in Table 26). If a sign is not specified for either the number or
exponent, + is assumed. To generate unsigned data, precede the numeric value
with the letter U; signs are not allowed.
2. The exponent must lie within the permissible range (see ▌4▐ in Table 26). If an
exponent modifier is also specified, the algebraic sum (see ▌5▐ in Table 26) of
the exponent and the exponent modifier must lie within the permissible range.
Here are some examples of the range of values that can be assembled into
fixed-point constants:
Range of signed values that can be
Range of unsigned values that can be
Length
assembled
assembled
8
-263 to 263-1
0 to 264-1
4
-231 to 231-1
0 to 232-1
2
-215 to 215-1
0 to 216-1
1
-27 to 27-1
0 to 28-1
The range of values depends on the implicitly or explicitly specified length (if
scaling is disregarded). If the value specified for a particular constant does not lie
within the allowable range for a given length, the constant is not assembled, but
flagged as an error.
A fixed-point constant is assembled as follows:
1. If there is an exponent modifier, adjust the nominal value; that is, multiply the
nominal value by the corresponding power of ten.
2. Convert the resulting value from decimal to binary; if negative, this is in
two's-complement form.
3. If there is a scaling modifier, adjust the resulting binary number; that is,
multiply by the corresponding power of two.
4. Round the resulting number to a whole number.
5. If there is a duplication factor, apply it to the resulting whole number.
The example statement generates 3 fullwords of data. The location attribute of
CONWRD is the address of the first byte of the first word, and the length attribute is
4, the implied length for a fullword fixed-point constant. The expression CONWRD+4
can be used to address the second constant (second word) in the field.
CONWRD DC
3F’658474’
Table 26. Fixed-point constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
2. Type
F and H
152
HLASM V1R6 Language Reference
Table 26. Fixed-point constants (continued)
Subfield
Value
Example
Result
3. Type Extension
D permitted with type F
4. Program type
Allowed
5. Modifiers
Length:
1 to 8
(byte length)
.1
to .64
(bit length)
Implicit length:
Doubleword: 8 bytes
(Length modifier
Fullword: 4 bytes
not present)
Halfword: 2 bytes
Alignment:
Doubleword,
(Length modifier
fullword,
not present)
or halfword
Scale:
F:
-187 to +346
H:
-187 to +346
Exponent:
-85 to +75 ▌4▐
DC HE+75’2E-73’ ▌5▐
value=2x10²
6. Nominal value
Represented by:
Decimal
Doubleword
digits
DC FD’-200’ ▌1▐
(0 to 9)
DC FD’U7890123456’
Fullword
DC FS4’2.25’ ▌2▐
DC FS4’U2.25’
Halfword:
DC H’+200’
DC HS4’.25’
DC H’U200’
DC HS4’U0.25’
Enclosed by:
Apostrophes
Exponent allowed:
Yes
Doubleword:
DC FD’2E6’
DC FD’U2E6’
Fullword:
DC F’2E6’ ▌3▐
DC F’U2E6’
Halfword:
DC H’2E+1’
DC H’U2E+1’
Number of
values per
operand:
Multiple
Padding:
With sign bits at left
Truncation of
At left
assembled value:
(error message
issued)
Chapter 5. Assembler instruction statements
153
In the following example, the DC statement generates a 2 byte field containing a
negative constant. Scaling has been specified in order to reserve 6 bits for the
fractional portion of the constant.
HALFCON DC
HS6’-25.46’
In the following example, the constant (3.50) is multiplied by 10 to the power -2
before being converted to its binary format. The scale modifier reserves 12 bits for
the fractional portion.
FULLCON DC
HS12’3.50E-2’
The same constant can be specified as a literal:
AH
7,=HS12’3.50E-2’
The final example specifies three constants. The scale modifier requests 4 bits for
the fractional portion of each constant. The 4 bits are provided whether or not the
fraction exists.
THREECON DC
FS4’-10,25.3,U268435455’
Remember that commas separate operands. For readability, use spaces instead, as
shown in this example:
TWOCONS DC
F’123,445’
Two constants
ONECON DC
F’123 456’
One constant
Decimal constants—P and Z
The decimal constants let you introduce data in a form suitable for operations on
decimal data. The packed decimal constants (P-type) are used for processing by the
decimal instructions. The zoned decimal constants (Z-type) are in the form
(EBCDIC representation) you can use as a print image, except for the digit in the
rightmost byte.
The nominal value can be a signed (plus is assumed if the number is unsigned)
decimal number. A decimal point can be written anywhere in the number, or it can
be omitted. The placement of a decimal point in the definition does not affect the
assembly of the constant in any way, because the decimal point is not assembled
into the constant. It it only affects the integer and scaling attributes of the symbol
that names the constant.
The specified digits are assumed to constitute an integer (see ▌1▐ in Table 27 on
page 155). You can determine correct decimal point alignment either by defining
data so that the point is aligned or by selecting machine instructions that operate
on the data correctly (that is, shift it for purposes of decimal point alignment).
Decimal constants are assembled as follows:
Packed decimal constants: Each digit is converted into its 4 bit binary coded
decimal equivalent (see ▌2▐ in Table 27 on page 155). The sign indicator (see ▌3▐ in
Table 27 on page 155) is assembled into the rightmost 4 bits of the constant.
Zoned decimal constants: Each digit is converted into its 8 bit EBCDIC
representation (see ▌4▐ in Table 27 on page 155). The sign indicator (see ▌5▐ in
Table 27 on page 155) replaces the first four bits of the low-order byte of the
constant.
Here are the range of values that can be assembled into a decimal constant:
154
HLASM V1R6 Language Reference
Type of decimal constant
Range of values that can be specified
Packed
1031-1 to -1031
Zoned
1016-1 to -1016
For both packed and zoned decimals, a plus sign is translated into the hexadecimal
digit C, a minus sign into the digit D. The packed decimal constants (P-type) are
used for processing by the decimal instructions.
If, in a constant with an implicit length, an even number of packed decimal digits
is specified, one digit is left unpaired because the rightmost digit is paired with the
sign. Therefore, in the leftmost byte, the leftmost four bits are set to zeros and the
rightmost four bits contain the unpaired (first) digit.
Table 27. Decimal constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
2. Type
P and Z
3. Type Extension
Not allowed
4. Program type
Allowed
5. Modifiers
Length:
1 to 16
(byte length)
.1
to .128
(bit length)
Implicit length:
As needed
(Length modifier
Packed:
not present)
P DC P’+593’
L'P = 2
Zoned:
Z DC Z’-593’
L'Z= 3
Alignment:
Byte
Scale:
Not allowed
Exponent:
Not allowed
6. Nominal value
Represented by:
Decimal
Packed:
Object code
digits
DC P’5.5’
▌1▐
X'055C'
(0 to 9)
DC P’55’
▌1▐
X'055C'
DC P’+555’ ▌2▐
X'555C' ▌3▐
DC P’-777’
X'777D' ▌3▐
Zoned:
Object code
DC Z’-555’ ▌4▐
X'F5F5D5' ▌5▐
Enclosed by:
Apostrophes
Exponent allowed:
No
Number of values
per operand:
Multiple
Chapter 5. Assembler instruction statements
155
Table 27. Decimal constants (continued)
Subfield
Value
Example
Result
Padding:
Packed:
with binary
zeros at left
Zoned:
with EBCDIC
zeros (X'F0')
at left
Truncation of
assembled value:
At left
In the following example, the DC statement specifies both packed and zoned
decimal constants. The length modifier applies to each constant in the first operand
(that is, to each packed decimal constant). A literal cannot specify both operands.
DECIMALS DC
PL8’+25.8,-3874,+2.3’,Z’+80,-3.72’
The following example shows the use of a packed decimal literal.
UNPK
OUTAREA,=PL2’+25’
Address constants
An address constant is an absolute or relocatable expression, such as a storage
address, that is translated into a constant. Address constants can be used for
initializing base registers to facilitate the addressing of storage. Furthermore, they
provide a means of communicating between control sections of a multisection
program. However, storage addressing and control section communication also
depends on the USING assembler instruction and the loading of registers. See
“USING instruction” on page 222.
The nominal value of an address constant, unlike other types of constants, is
enclosed in parentheses. If two or more nominal values are specified in an address
constant, they are separated by commas, and the whole sequence is enclosed by
parentheses. There are seven types of address constants: A, Y, S, R, Q, J, and V.
Relocatable address constants cannot be specified with bit lengths.
Complex relocatable expressions: A complex relocatable expression can only
specify an A- or Y-type address constant. These expressions contain two or more
unpaired relocatable terms, or two or more negative relocatable terms in addition
to any absolute or paired relocatable terms. A complex relocatable expression
might consist of external symbols and designate an address in an independent
assembly that is to be linked and loaded with the assembly containing the address
constant.
The following example shows how, and why, a complex relocatable expression
might be used for an A or Y address constant:
EXTRN
X
B
DC
A(X-*)
Offset from B to X
Address constants—A and Y: The following sections describe how the different
types of address constants are assembled from expressions that normally represent
storage addresses, and how the constants are used for addressing within and
between source modules.
156
HLASM V1R6 Language Reference
In the A-type and Y-type address constants, you can specify any of the three
following types of assembly-time expressions whose values the assembler then
computes and assembles into object code. Use this expression computation as
follows:
v Relocatable expressions for addressing
v Absolute expressions for addressing and value computation
v Complex relocatable expressions to relate addresses in different source modules
Literals, which are relocatable forms, are not allowed as operands, but length,
scale, and integer attribute references to literals are allowed.
Here are some examples:
DC A(L’=F’1.23’)
DC A(I’=F’3.45’)
DC A(S’=FS6’7.89)
Notes:
1.
No bit-length modifier (see ▌1▐ in Table 28) is allowed when a relocatable or
complex relocatable expression (see ▌2▐ in Table 28) is specified. The only
explicit lengths that can be specified with relocatable or complex relocatable
address constants are:
v
2-8 bytes for AD-type constants
v
2, 3, or 4 bytes for A-type constants
v
2 bytes for Y-type constants
The linkage editor or binder or loader you use determines which lengths are
supported. Please see the appropriate product manual for more information.
For absolute operands, you can specify byte or bit lengths:
v Byte lengths 1 through 8, or bit lengths .1 through .128, for A-type constants
v Byte lengths 1 or 2, or bit lengths .1 through .16, for Y-type constants
2.
The value of the location counter reference (*) when specified in an address
constant varies from constant to constant, if any of the following, or a
combination of the following, are specified:
v Multiple operands
v Multiple nominal values (see ▌3▐ in Table 28)
v A duplication factor (see ▌4▐ in Table 28)
The location counter is incremented with the length of the previously
assembled constant.
3.
When the location counter reference occurs in a literal address constant, the
value of the location counter is the address of the first byte of the instruction.
The behavior of location counter references in A-type address constants is
different from that in S-type address constants (“Address constant—S” on page
160).
Table 28. A and Y address constants
Subfield
Value
Example
Result
1. Duplication factor Allowed
A DC
5AL1(*-A) ▌4▐
Object code
X'0001020304'
2. Type
A and Y
3. Type Extension
D permitted for A type
only
4. Program type
Allowed
Chapter 5. Assembler instruction statements
157
Table 28. A and Y address constants (continued)
Subfield
Value
Example
Result
5. Modifiers
Length:
A-type:
2 to 4 ▌1▐
(byte length)
AD-type:
1 to 8
(byte length)
Y-type:
2 only
(byte length)
Implicit length:
A-type: 4 bytes
(Length modifier
AD-type: 8 bytes
not present)
Y-type: 2 bytes
Alignment:
A-type: fullword
(Length modifier
AD-type: doubleword
not present)
Y-type: halfword
Scale:
Not allowed
Exponent:
Not allowed
6. Nominal value
Represented by:
Absolute,
A-type:
relocatable,
DC A(ABSOL+10)
or complex
relocatable
Y-type:
expressions ▌2▐
DC Y(RELOC+32)
A DC Y(*-A,*+4) ▌3▐
values=0,A+6
Enclosed by:
Parentheses
Exponent allowed:
No
Number of
values per
operand:
Multiple
Padding:
If an absolute term is
present, by sign
extension. Otherwise,
with zeros at left.
Truncation of
assembled value:
At left
Take care when using Y-type address constants and 2 byte A-type address
constants for relocatable addresses, as they can only address a maximum of 65,536
bytes of storage. Using these types of address constants for relocatable addresses
results in message ASMA066W being issued unless the assembler option RA2 is
specified.
Here is how the A-type and Y-type address constants are processed:
v If the nominal value is an absolute expression, it is computed to its 32 bit value>
it is then truncated or sign-extended on the left to fit the implicit or explicit
length of the constant.
158
HLASM V1R6 Language Reference
v If the nominal value is a relocatable or complex relocatable expression, it is not
completely evaluated until linkage edit time. The relocated address values are
then placed in the fields set aside for them at assembly time by the A-type and
Y-type constants.
In the following examples, the field generated from the statement named ACON
contains four constants, each of which occupies 4 bytes. The statement containing
the LM instruction shows the same set of constants specified as literals (that is,
address constant literals).
ACON
DC
A(108,LOP,END-STRT,*+4096)
LM
4,7,=A(108,LOP,END-STRT,*+4096)
A location counter reference (*) appears in the fourth constant (*+4096). The value
of the location counter is the address of the first byte of the fourth constant. When
the location counter reference occurs in a literal, as in the LM instruction, the value
of the location counter is the address of the first byte of the instruction.
Note: It is important to remember that expression evaluation for address constants
is restricted to using 32 bit internal arithmetic. The result is then sign-extended to
the length of the constant. This means that certain expressions in AD-type
constants might not yield expected results, especially if the resulting value is
negative.
PSECT reference—R: The R-type constant reserves storage for the address of the
PSECT of symbol1 as specified in the associated XATTR statement (“XATTR
instruction (z/OS and CMS)” on page 233). It is the caller's responsibility to
establish the definition of the R-type address constant referencing the called
routine's PSECT, and to pass that address to the called routine. This constant is
only available if the GOFF option is specified.
Note: If a program is to be reentrant, R-type address constants must not appear in
shared (read-only) text. They should be in the caller's PSECT, and be provided to
the called routine using an appropriate convention. That is, R-type address
constants referring to PSECTs should themselves reside in PSECTs. If not, there can
be only a single instantiation of the PSECT work area, and the program cannot be
reentrant.
Table 29. R address constants
Subfield
Value
Example
Result
1. Duplication factor
Allowed
2. Type
R
3. Type Extension
D
4. Program type
Allowed
5. Modifiers
Length:
R-type: 3 or 4 only
RD-type: 3, 4, or 8
(no bit length)
Implicit length:
R-type: 4 bytes
(Length modifier
RD-type: 8 bytes
not present)
Alignment:
R-type: Fullword
(Length modifier
RD-type: Doubleword
not present)
Chapter 5. Assembler instruction statements
159
Table 29. R address constants (continued)
Subfield
Value
Example
Result
Scale:
Not allowed
Exponent:
Not allowed
6. Nominal value
Represented by:
An ordinary symbol
DC R(PSECT1)
Enclosed by:
Parentheses
Exponent allowed:
No
Number of values
per operand:
Multiple
Padding:
With zeros at left
Truncation of
assembled value:
Not applicable
Address constant—S: Use the S-type address constant to assemble an explicit
address in base-displacement form. You can specify the explicit address yourself or
let the assembler compute it from an implicit address, using the current base
register and address in its computation.
The nominal values can be specified in two ways:
1. As one absolute or relocatable expression (see▌1▐ in Table 30 on page 161)
representing an implicit address.
2. As two absolute expressions (see ▌2▐ in Table 30 on page 161) the first of which
represents the displacement and the second, enclosed in parentheses, represents
the base register.
The address value represented by the expression in ▌1▐ in Table 30 on page 161, is
converted by the assembler into the correct base register and displacement value.
An S-type constant is assembled as a halfword and aligned on a halfword
boundary. An SY-type constant is assembled as 3 bytes and aligned on a halfword
boundary. The leftmost four bits of the assembled constant represent the base
register designation; the remaining 12 bits (S-type) or 20 bits (SY-type), the
displacement value.
Notes:
1. The value of the location counter (*) when specified in an S-type address
constant varies from constant to constant if one or more the following is
specified:
v Multiple operands
v Multiple nominal values
v A duplication factor
In each case the location counter is incremented with the length of the
previously assembled constant, except when multiple S-type address constants
are specified in a literal. In a literal, the same location counter value is used for
each of the multiple values.
2. If a length modifier is used, only 2 bytes for an S-type constant, or only 3 bytes
for an SY-type constant, can be specified.
3. S-type address constants can be specified as literals. The USING instructions
used to resolve them are those in effect at the place where the literal pool is
assembled, and not where the literal is used.
160
HLASM V1R6 Language Reference

 

 

 

 

 

 

 

Content      ..     7      8      9      10     ..