Главная Manuals High Level Assembler for z/OS & z/VM & z/VSE. Language Reference (Version 1 Release 6)
|
|
|
The expression for the data address should be such that the address is 0 - 231-1,
after possible relocation. This is the case if the expression refers to a location
within one of the control sections that are link-edited together. An expression such
as *-1000000000 yields an acceptable value only when the value of the location
counter (*) is 1000000000 or higher at assembly time.
If symbol is an ordinary symbol or a variable symbol that has been assigned an
ordinary symbol, the ordinary symbol is assigned the value of the address of the
first byte of the generated channel command word. The length attribute value of
the symbol is 8.
Here is an example of a CCW1 statement:
A
CCW1
X’0C’,BUF1,X’00’,L’BUF1
The object code generated (in hexadecimal) for the above examples is:
0C 00 yyyy xxxxxxxx
where yyyy is the length of BUF1 and xxxxxxxx is the address of BUF1. BUF1 can
reside anywhere in in 24 bit or 31 bit virtual storage.
CEJECT instruction
The CEJECT instruction conditionally stops the printing of the assembler listing on
the current page, and continues the printing on the next page.
►►
CEJECT
►◄
sequence_symbol
number_of_lines
sequence_symbol
Is a sequence symbol.
number_of_lines
Is an absolute value that specifies the minimum number of lines that must be
remaining on the current page to prevent a page eject. If the number of lines
remaining on the current page is less than the value specified by
number_of_lines, the next line of the assembler listing is printed at the top of a
new page.
You can use any absolute expression to specify number_of_lines.
If number of lines is omitted, the CEJECT instruction behaves as an EJECT
instruction.
If zero, a page is ejected unless the current line is at the top of a page.
If the line before the CEJECT statement appears at the bottom of a page, the
CEJECT statement has no effect. A CEJECT instruction without an operand
immediately following another CEJECT instruction or an EJECT instruction is
ignored.
Notes:
1. The CEJECT statement itself is not printed in the listing unless a variable
symbol is specified as a point of substitution in the statement, in which case the
statement is printed before substitution occurs.
Chapter 5. Assembler instruction statements
121
2. The PRINT DATA and PRINT NODATA instructions can alter the effect of the
CEJECT instruction, depending on the number of assembler listing lines that
are required to print the generated object code for each instruction.
CNOP instruction
The CNOP instruction aligns any instruction or other data on a specific halfword
boundary. This ensures an unbroken flow of executable instructions, since the
CNOP instruction generates no-operation instructions to fill the bytes skipped to
achieve specified alignment. If a control section has not been established, CNOP
initiates an unnamed (private) control section.
►►
CNOP byte,boundary
►◄
symbol
symbol
Is one of the following:
v An ordinary symbol
v A variable symbol that has been assigned a character string with a value that
is valid for an ordinary symbol
v A sequence symbol
The name is assigned to the next halfword aligned location. If there is a single
byte before that location, it is skipped for alignment. Zero or more NOP(R)s
might be generated at or after that location.
byte
Is an absolute expression that specifies at which even-numbered byte the
location counter is set. The value of the expression must be 0 to boundary-2.
boundary
Is an absolute expression that specifies the byte specified by boundary is in a
section of code of length boundary, with the section of code starting on a
multiple of the boundary value. A value of 4 indicates the byte is in a fullword,
a value of 16 indicates the byte is in a quadword, a value of 4096 indicates the
byte is in a page. The maximum value for boundary is linked to the SECTALGN
value. Values greater than 16 are only available if the GOFF option is specified.
Table 15 shows examples of valid pairs of byte and boundary. Examples of valid
CNOP values:
Table 15. Valid CNOP values
Values
Specify
0,4
Beginning of a word
2,4
Middle of a word
0,8
Beginning of a doubleword
2,8
Second halfword of a doubleword
4,8
Middle (third halfword) of a doubleword
6,8
Fourth halfword of a doubleword
0,16
Beginning of a quadword
122
HLASM V1R6 Language Reference
Table 15. Valid CNOP values (continued)
Values
Specify
2,16
Second halfword of a quadword
4,16
Third halfword of a quadword
6,16
Fourth halfword of a quadword
8,16
Fifth halfword of a quadword
10,16
Sixth halfword of a quadword
12,16
Seventh halfword of a quadword
14,16
Eighth halfword of a quadword
Figure 22 shows the position in a doubleword that each of these pairs specifies.
Both 0,4 and 2,4 specify two locations in a doubleword.
┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│
Quadword
│
├────────────────────────────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────┤
│
Doubleword
│
Doubleword
│
├─────────────────────────────────┬──────────────────────────────────┼─────────────────────────────────┬──────────────────────────────────┤
│
Fullword
│
Fullword
│
Fullword
│
Fullword
│
├───────────────┬─────────────────┼────────────────┬─────────────────┼───────────────┬─────────────────┼────────────────┬─────────────────┤
│ Halfword
│
Halfword
│
Halfword
│
Halfword
│ Halfword
│
Halfword
│
Halfword
│
Halfword
│
├───────┬───────┼────────┬────────┼────────┬───────┼────────┬────────┼───────┬───────┼────────┬────────┼────────┬───────┼────────┬────────┤
│ Byte
│ Byte │ Byte
│ Byte
│ Byte
│ Byte
│ Byte
│ Byte
│ Byte
│ Byte │ Byte
│ Byte
│ Byte
│ Byte
│ Byte
│ Byte
│
├───────┴───────┴────────┴────────┴────────┴───────┴────────┴────────┼───────┴───────┴────────┴────────┴────────┴───────┴────────┴────────┤
│0,4
2,4
0,4
2,4
0,4
2,4
0,4
2,4
│
│0,8
2,8
4,8
6,8
0,8
2,8
4,8
6,8
│
│0,16
2,16
4,16
6,16
8,16
10,16
12,16
14,16
│
└─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Figure 22. CNOP alignment
Use the CNOP instruction, for example, when you code the linkage to a
subroutine, and you want to pass parameters to the subroutine in fields
immediately following the branch and link instructions. These parameters—for
example, channel command words—can require alignment on a specific boundary.
The subroutine can then address the parameters you pass through the register with
the return address, as in the following example:
CNOP
6,8
LINK
BALR
2,10
CCW
1,DATADR,X’48’,X’50’
CNOP values of 4094,4096 would be used to align on the last halfword of a page.
Assume that the location counter is aligned at a doubleword boundary. Then the
CNOP instruction causes the following no-operations to be generated, thus
aligning the BALR instruction at the last halfword in a doubleword as follows:
BCR
0,0
BC
0,X’700’
BALR
2,10
LINK
CCW
1,DATADR,X’48’,X’50’
After the BALR instruction is generated, the location counter is at a doubleword
boundary, thus ensuring that the CCW instruction immediately follows the branch
and link instruction.
The CNOP instruction forces the alignment of the location counter to start on a
multiple of the boundary value. It does not affect the location counter if the
counter is already correctly aligned. If the specified alignment requires the location
counter to be incremented, no-operation instructions are generated to fill the
skipped bytes. Any single byte skipped to achieve alignment to the first
Chapter 5. Assembler instruction statements
123
no-operation instruction is filled with zeros, even if the preceding byte contains no
machine language object code. A length attribute reference to the name of a CNOP
instruction is always invalid. Message ASMA042E is issued, and a default value of
1 is assigned.
COM instruction
The COM instruction identifies the beginning or continuation of a common control
section.
►►
COM
►◄
symbol
symbol
Is one of the following:
v An ordinary symbol
v A variable symbol that has been assigned a character string with a value that
is valid for an ordinary symbol
v A sequence symbol
The COM instruction can be used anywhere in a source module after the ICTL
instruction.
If symbol denotes an ordinary symbol, the ordinary symbol identifies the common
control section. If several COM instructions within a source module have the same
symbol in the name field, the first occurrence initiates the common section and the
rest indicate the continuation of the common section. The ordinary symbol denoted
by symbol represents the address of the first byte in the common section, and has a
length attribute value of 1.
If symbol is not specified, or if name is a sequence symbol, the COM instruction
initiates, or indicates the continuation of, the unnamed common section.
See “CSECT instruction” on page 126 for a discussion on the interaction between
COM and the GOFF assembler option.
The location counter for a common section is always set to an initial value of 0.
However, when an interrupted common control section is continued using the
COM instruction, the location counter last specified in that control section is
continued.
If a common section with the same name (or unnamed) is specified in two or more
source modules, the amount of storage reserved for this common section is equal
to that required by the longest common section specified.
The source statements that follow a COM instruction belong to the common
section identified by that COM instruction.
Note:
1. The assembler language statements that appear in a common control section are
not assembled into object code.
124
HLASM V1R6 Language Reference
2. When establishing the addressability of a common section, the symbol in the
name field of the COM instruction, or any symbol defined in the common
section, can be specified in a USING instruction.
3. An AMODE cannot be assigned to a common section.
In the following example, addressability to the common area of storage is
established relative to the named statement XYZ.
L
1,=A(XYZ)
USING
XYZ,1
MVC
PDQ(16),=4C’ABCD’
COM
XYZ
DS
16F
PDQ
DS
16C
A common control section can include any assembler language instructions, but no
object code is generated by the assembly of instructions or constants appearing in a
common control section. Data can only be placed in a common control section
through execution of the program.
If the common storage is assigned in the same manner by each independent
assembly, reference to a location in common by any assembly results in the same
location being referenced.
COPY instruction
Use the COPY instruction to obtain source statements from a source language
library and include them in the program being assembled. You can thus avoid
writing the same, often-used sequence of code over and over.
►►
COPY member
►◄
sequence_symbol
sequence_symbol
Is a sequence symbol.
member
Name of the source language library member to be copied from either a
system macro library or a user macro library. In open code, member can also be
a variable symbol that has been set to the member name.
The source statements that are copied into a source module:
v Are inserted immediately after the COPY instruction.
v Are inserted and processed according to the standard instruction statement
coding format, even if an ICTL instruction has been specified.
v Must not contain either an ICTL or ISEQ instruction.
Chapter 5. Assembler instruction statements
125
v Can contain other COPY statements. There are no restrictions on the number of
levels of nested copy instructions. However, the COPY nesting must not be
recursive. For example, assume that the source program contains the statement:
COPY A
and library member A contains the statement:
COPY B
In this case, the library member B must not contain a COPY A or COPY B
statement.
v Can contain macro definitions. Note, however, that if a source macro definition
is copied into a source module, both the MACRO and MEND statements that
delimit the definition must be contained in the same level of copied code.
v The scope of any sequence symbols defined by the statements within the COPY
member are the same as that of the COPY statement itself. That is, if the COPY
statement appears in open code then any sequence symbols defined by
statements within the member also have open code scope. Take care to define
symbols only once, because COPYing the same member more than once can
cause looping due to backward AGO or AIF branches in the source file.
Notes:
1. The COPY instruction can also be used to copy statements into source macro
definitions.
2. The rules that govern the occurrence of assembler language statements in a
source module also govern the statements copied into the source module.
3. Whenever the assembler processes a COPY statement, whether it is in open
code or in a macro definition, the assembler attempts to read the source
language library member specified in the COPY statement. This means that all
source language library members specified by COPY statements in a source
program, including those specified in macro definitions, must be available
during the assembly. The HLASM Programmer's Guide describes how to
specify the libraries when you run the assembler, in these sections:
v CMS: “Specifying macro and copy code libraries: SYSLIB”
v z/OS: “Specifying macro and copy code libraries: SYSLIB”
v z/VSE: “Specifying macro and copy code libraries: LIBDEF job control
statement”
4. If an END instruction is encountered in a member during COPY processing, the
assembly is ended. Any remaining statements in the COPY member are
discarded.
CSECT instruction
The CSECT instruction initiates an executable control section or indicates the
continuation of an executable control section.
►►
CSECT
►◄
symbol
symbol
Name of the control section, or a variable symbol that has been set to the
126
HLASM V1R6 Language Reference
name, or a sequence symbol. If symbol is omitted or is a sequence symbol then
the statement starts or continues the unnamed control section.
The CSECT instruction can be used anywhere in a source module after any ICTL
or *PROCESS statements. If it is used to initiate the first executable control section,
it must not be preceded by any instruction that affects the location counter and
thus causes a control section to be initiated.
If symbol denotes an ordinary symbol, the ordinary symbol identifies the control
section. If several CSECT instructions within a source module have the same
symbol in the name field, the first occurrence initiates the control section and the
rest indicate the continuation of the control section. The ordinary symbol denoted
by symbol represents the address of the first byte in the control section, and has a
length attribute value of 1.
If symbol is not specified, or if it is a sequence symbol, the CSECT instruction
initiates, or indicates the continuation of the unnamed control section.
If the first control section is initiated by a START instruction, the CSECT
instruction which continues the section must have the same name as the START
instruction.
z/VM and z/OS
When the GOFF option is not specified a control section is initiated or
resumed by the START, CSECT, RSECT, and COM statements. Any
machine language text created by statements that follow such control
section declarations belongs to the control section, and is manipulated
during program linking and binding as an indivisible unit.
When the GOFF option is specified, the behavior of CSECT, RSECT, and
COM statements is different. By default, the assembler creates a definition
of a text class named B_TEXT, to which subsequent machine language text
belongs if no other classes are declared. If you specify other class names
using the CATTR statement, machine language text following such CATTR
statements belongs to that class.
The combination of a section name and a class name defines an element,
which is the indivisible unit manipulated during linking and binding. All
elements with the same section name are “owned” by that section, and
binding actions (such as section replacement) act on all elements owned by
a section.
When the GOFF option is specified, and if no CATTR statements are
present, then all machine language text is placed in the default class
B_TEXT. The behavior of the elements in the bound module is essentially
the same as the behavior of control sections when the OBJECT option is
specified. However, if additional classes are declared, a section name can
best be thought of as a “handle” by which elements within declared classes
are owned.
The beginning of a control section is aligned on a boundary determined by the
SECTALGN option. However, when an interrupted control section is continued
using the CSECT instruction, the location counter last specified in that control
section is continued. Consider the coding in Figure 23 on page 128:
Chapter 5. Assembler instruction statements
127
ALPHA
START
┐
┌───────────────────────┐
BALR
12,0
├───────────────────────────►│ ALPHA
│
USING
│
┌────────────────────────►│
│
│
│
│
│
┘
│
│
│
NEWCSECT CSECT
┐
│
├ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┤
├──┼────────────────────────►│ NEWCSECT
│
│
│
│
│
┘
│
│
│
ALPHA
CSECT
┐
│
│
│
├──┘
│
│
│
│
│
┘
│
│
Figure 23. How the location counter works
The source statements following a CSECT instruction that either initiate or indicate
the continuation of a control section are assembled into the object code of the
control section identified by that CSECT instruction.
The end of a control section or portion of a control section is marked by:
v Any instruction that defines a new or continued control section
v The END instruction
The CSECT instruction can interact with any LOCTR instructions that are present.
For more information about this interaction, see “LOCTR instruction” on page 196.
CXD instruction
The CXD instruction reserves a fullword area in storage. The linker or loader
inserts into this area the total length of all external dummy sections specified in the
source modules that are assembled and linked into one program. If a control
section has not previously been established, CXD initiates an unnamed (private)
control section. See “Using external dummy sections” on page 59.
►►
CXD
►◄
symbol
symbol
Name of the fullword field, or a variable symbol that has been set to the name,
or a sequence symbol. If symbol is omitted or is a sequence symbol, the
fullword field has no name.
The linker or loader inserts into the fullword-aligned fullword area reserved by the
CXD instruction the total length of storage required for all the external dummy
sections specified in a program. If the GOFF assembler option is specified, CXD
returns the length of the B_PRV class. See “DXD instruction” on page 185.
If symbol denotes an ordinary symbol, the ordinary symbol represents the address
of the fullword area. The ordinary symbol denoted by symbol has a length attribute
value of 4.
These examples show how external dummy sections can be used:
128
HLASM V1R6 Language Reference
ROUTINE A
ALPHA
DXD
2DL8
BETA
DXD
4FL4
OMEGA
CXD
DC
Q(ALPHA)
DC
Q(BETA)
ROUTINE B
GAMMA
DXD
5D
DELTA
DXD
10F
ZETA
DXD
XL22
DC
Q(GAMMA)
DC
Q(DELTA)
DC
Q(ZETA)
ROUTINE C
EPSILON DXD
4H
ZETA
DXD
4F
DC
Q(EPSILON,ZETA)
Each of the three routines is requesting an amount of work area. Routine A wants
2 doublewords and 4 fullwords; Routine B wants 5 doublewords, 10 fullwords, and
22 bytes; Routine C wants 4 halfwords and 4 fullwords. During program linking,
identically named dummy sections are combined, retaining their strictest alignment
and longest length. For example, Routines B and C both request storage named
ZETA: the resulting allocation is 22 bytes on a fullword boundary. When program
linking is complete, the sum of these individual dummy external section lengths is
placed in the location of the CXD instruction labeled OMEGA. Routine A can then
allocate the amount of storage that is specified in the CXD location, and each
dummy external section's offset within the allocated storage is found in the Q-type
offset constant referencing its name. Q-type offset constants are described at
“Offset constant—Q” on page 163.
DC instruction
You use the DC instruction to define the data constants you need for program
execution. The DC instruction causes the assembler to generate the binary
representation of the data constant you specify into a particular location in the
assembled source module; this is done at assembly time.
The DC instruction's name — Define Constant — is misleading: DC simply creates
initial data in an area of the program. The contents of that area might be modified
during program execution, so the original data is not truly “constant”. If you want
to declare values that are more likely to behave like constants, use literals
(“Literals” on page 42); the assembler attempts to detect and diagnose instructions
Chapter 5. Assembler instruction statements
129
that might change the contents of a field defined by a literal. If a control section
has not been established previously, DC initiates an unnamed (private) control
section.
The DC instruction can generate the following types of constants:
Table 16. Types of data constants
Type of
Constant
Function
Example
Address
Defines address mainly
L
5,ADCON
for the use of
ADCON
DC
A(SOMWHERE)
fixed-point and other
instructions
Binary
Defines bit patterns
FLAG
DC
B’00010000’
Character
Defines character strings
CHAR
DC
C’string of characters’
or messages
Decimal
Used by decimal
ZAP
AREA,PCON
instructions
PCON
DC
P’100’
AREA
DS
PL3
Fixed-point
Used by the fixed-point
L
3,FCON
and other instructions
FCON
DC
F’100’
Floating-point
Used by floating-point
LE
2,ECON
instructions
ECON
DC
E’100.50’
Graphic
Defines character strings
DBCS
DC
G’<.D.B.C.S. .S.T.R.I.N.G>’
or messages that contain
pure double-byte data
Hexadecimal
Defines large bit
PATTERN
DC
X’FF00FF00’
patterns
Zoned
Defines numeric
ZONEVVAL
DC
Z’-123’
characters
,
►►
DC
▼
operand
►◄
symbol
symbol
Is one of the following:
v An ordinary symbol
v A variable symbol that has been assigned a character string with a value that
is valid for an ordinary symbol
v A sequence symbol
If symbol denotes an ordinary symbol, the ordinary symbol represents the
address of the first byte of the assembled constant. If several operands are
specified, the first constant defined is addressable by the ordinary symbol. The
other constants can be reached by relative addressing.
130
HLASM V1R6 Language Reference
operand
An operand of six subfields. The first five subfields describe the constant. The
sixth subfield provides the nominal values for the constants.
A DC operand has this format:
►►
type
►
duplication_factor
type_extension
program_type
►
nominal_value
►◄
modifier
duplication_factor
Causes the nominal_value to be generated the number of times indicated by this
factor. See “Subfield 1: Duplication Factor” on page 136.
type
Further determines the type of constant the nominal_value represents. See
“Subfield 2: Type” on page 137.
type_extension
Determines some of the characteristics of the constant. See “Subfield 3: Type
Extension” on page 138.
program_type
assign a programmer determined 32 bit value to the symbol naming the DC
instruction, if a symbol was present. See “Subfield 4: Program type” on page
139.
modifier
Describes the length, the scaling, and the exponent of the nominal_value. See
“Subfield 5: Modifier” on page 139.
nominal_value
Defines the value of the constant. See “Subfield 6: Nominal Value” on page
144.
For example, in:
10EBP(7)L2’12’
the six subfields are:
v Duplication factor is 10
v Type is E
v Type extension is B
v Program type is P(7)
v Modifier is L2
v Nominal value is 12
If all subfields are specified, the order given above is required. The first, third,
fourth, and fifth subfields can be omitted, but the second and sixth must be
specified in that order.
Chapter 5. Assembler instruction statements
131
Rules for DC operands
1. The type subfield and the nominal value must always be specified unless the
duplication factor is zero. If the duplication factor is zero, only the type must
be specified.
2. The duplication factor, type extension, program type, and modifier subfields are
optional.
3. When multiple operands are specified, they can be of different types.
4. When multiple nominal values are specified in the sixth subfield, they must be
separated by commas and be of the same type. Multiple nominal values are not
allowed for character or graphic constants, because a comma is part of the
nominal value of the constant; it is not possible to specify multiple nominal
values.
5. The descriptive subfields, apart from the program type, apply to all the
nominal values. The program type applies to only the symbol naming the DC
instruction, if a symbol was present. Separate constants are generated for each
separate operand and nominal value specified.
6. No spaces are allowed:
v Between subfields
v Between multiple operands
General information about constants
Constants defined by the DC instruction are assembled into an object module at
the location at which the instruction is specified. However, the type of constant
being defined, and the presence or absence of a length modifier, determines
whether the constant is to be aligned on a particular storage boundary or not (see
“Alignment of constants”).
Symbolic Addresses of Constants: The value of the symbol that names the DC
instruction is the address of the first byte (after alignment) of the first or only
constant.
Length attribute value of symbols naming constants
The length attribute value assigned to the symbols in the name field of the
constants is equal to one of:
v The implicit length (see “Implicit Length” in Table 17 on page 133) of the
constant when no explicit length is specified in the operand of the constant.
v The explicit length (see “Value of Length Attribute” in Table 17 on page 133) of
the constant.
If more than one operand is present, the length attribute value of the symbol is the
length in bytes of the first constant specified, according to its implicit or explicit
length.
Alignment of constants
The assembler aligns constants on different boundaries according to the following:
v On boundaries implicit to the type of constant (see “Implicit Boundary
Alignment” in Table 18 on page 133) when no length is specified.
v On byte boundaries (see “Boundary Alignment” in Table 18 on page 133) when
an explicit length is specified.
Bytes that are skipped to align a constant at the correct boundary are not
considered part of the constant. They are filled with binary zeros.
132
HLASM V1R6 Language Reference
Notes:
1. The automatic alignment of constants and areas does not occur if the
NOALIGN assembler option has been specified.
2. Alignment can be forced to any boundary by a preceding DS or DC instruction
with a zero duplication factor. This occurs whether or not the ALIGN option is
set.
Table 17. Length attribute value of symbol naming constants
Type of
Implicit
Value of Length
constant
Length
Examples
Attribute¹
B
as needed
DC
B’10010000’
1
C
as needed
DC
C’ABC’
3
DC
CL8’WOW’
8
CU
as needed
DC
CU’ABC’
6
DC
CUL4’XX’
4
G
as needed
DC
G’<DaDb>’
4
DC
GL8’<DaDb>’
8
X
as needed
DC
X’COFFEE’
3
DC
XL2’FFEE’
2
H
2
DC
H’32’
2
F
4
DC
FL3’32’
3
FD
8
DC
FD’32’
8
P
as needed
DC
P’123’
2
DC
PL4’123’
4
Z
as needed
DC
Z’123’
3
DC
ZL10’123’
10
E
4
DC
E’565.40’
4
D
8
DC
DL6’565.40’
6
L
16
DC
LL12’565.40’
12
LQ
16
DC
LQ’565.40’
16
Y
2
DC
Y(HERE)
2
A
4
DC
AL1(THERE)
1
AD
8
DC
AD(WHERE)
8
S
2
2
DC
S(THERE)
V
4
DC
VL3(OTHER)
3
VD
8
DC
VD(BIGOTHER)
8
J
4
DC
J(CLASS)
4
JD
4
DC
JD(LARGECLASS)
8
Q
8
DC
QL1(LITTLE)
1
DC
QD(BIGLITTLE)
QD
4
8
DC
R(APSECT)
RD
8
4
DC
RD(BPSECT)
8
Note:
1. Depends on whether an explicit length is specified in the constant.
Table 18. Alignment of constants
Implicit
Type of
Boundary
Boundary
constant
Alignment
Examples
Alignment¹
B
byte
DC B’1011’
byte
C
byte
DC C’Character string’
byte
CU
byte
DC CU’Character string’
byte
Chapter 5. Assembler instruction statements
133
Table 18. Alignment of constants (continued)
Implicit
Type of
Boundary
Boundary
constant
Alignment
Examples
Alignment¹
G
byte
DC
G’<.D.B.C.S
.S.T.R.I.N.G>
byte
X
byte
DC
X’20202021202020’
byte
H
halfword
DC H'25'
halfword
DC HL3'25'
byte
F
fullword
DC F'225'
fullword
DC FL7'225'
byte
FD
doubleword
DC FD'225'
doubleword
P
byte
DC P'2934'
byte
Z
byte
DC Z'1235'
byte
DC ZL2'1235'
byte
E
fullword
DC E'1.25'
fullword
DC EL5'1.25'
byte
D
doubleword
DC
8D'95'Yes
doubleword
DC
8DL7'95'
byte
L
doubleword
DC L'2.57E65'
doubleword
LQ
quadword
DC LQ'0.1'
quadword
Y
halfword
DC Y(HERE)
halfword
A
fullword
DC AL1(THERE)
byte
AD
doubleword
DC AD(WHERE)
doubleword
S
halfword
DC S(LABEL)
halfword
DC SL2(LABEL)
byte
V
fullword
DC V(EXTERNAL)
fullword
DC VL3(EXTERNAL)
byte
VD
doubleword
DC VD(BIGOTHER)
doubleword
J
fullword
DC J(CLASS)
fullword
JD
doubleword
DC JD(LARGECLASS)
doubleword
Q
fullword
DC QL1(DUMMY)
byte
QD
doubleword
DC QD(BIGDUMMY)
doubleword
R
fullword
DC R(APSECT)
fullword
RD
doubleword
DC RD(BPSECT)
doubleword
Note:
1. Depends on whether an explicit length is specified in the constant.
Padding and truncation of values
The nominal values specified for constants are assembled into storage. The amount
of space available for the nominal value of a constant is determined:
v By the explicit length specified in the length modifier, or
v If no explicit length is specified, by the implicit length according to the type of
constant defined (see Appendix B, “Summary of constants,” on page 413).
134
HLASM V1R6 Language Reference
The padding and truncation rules apply to single nominal values.
Padding
If more space is available than is needed to accommodate the binary representation
of the nominal value, the extra space is padded:
v With binary zeros on the left for the binary (B), hexadecimal (X), fixed-point
(H,F), packed decimal (P), and all address (A,Y,S,V,J,Q,R) constants having
relocatable arguments.
v With sign extension for constants having constant arguments that support sign
extension of the nominal value (H, F, Y, A), as described in Table 26 on page 152.
v With ASCII spaces on the right (X'20') for CA-type character constants.
v With EBCDIC zeros on the left (X'F0') for the zoned decimal (Z) constants.
v With EBCDIC spaces on the right (X'40') for the character (C and CE-type)
constants.
v With EBCDIC spaces on the right (X'40') for the Unicode character (CU) constant
prior to translation.
v With double-byte spaces on the right (X'4040') for the graphic (G) constants.
Notes:
1. In floating-point constants (E,D,L), the fraction is extended to occupy the extra
space available.
2. Padding is on the left for all constants except character constants and graphic
constants.
Truncation
If less space is available than is needed to accommodate the nominal value, the
nominal value is truncated and part of the constant is lost. Truncation of the
nominal value is:
v On the left for the binary (B), hexadecimal (X), fixed-point (H and F), and
decimal (P and Z)
v On the right for the character (C) constant, the Unicode character (CU) constant,
and the graphic (G) constant
v On the left for absolute or relocatable address (A and Y), the external address
(V), offset (Q), length (J) and PSECT address (R) constants. The actual value
stored and any possible truncation is dependent on the values inserted by the
linker/binder and the length of the constant.
Notes:
1. If significant bits are lost in the truncation of fixed-point constants, error
diagnostic message ASMA072E Data item too large is issued.
2. Floating-point constants (E, D, L) are not truncated. They are rounded to fit the
space available—see Figure 24 on page 165 for rounding modes.
3. The above rules for padding and truncation also apply when using the
bit-length modifier (see “Subfield 5: Modifier” on page 139).
4. Double-byte data in C-type constants cannot be truncated because truncation
creates incorrect double-byte data. Error ASMA208E Truncation into
double-byte data is not permitted is issued if such truncation is attempted.
5. Truncation of double-byte data in CU-type and G-type constants is permitted
because the length modifier restrictions (see “Subfield 5: Modifier” on page 139)
ensure that incorrect double-byte data cannot be created by truncation.
However, truncating bit-length constants might create incorrect double-byte
data.
Chapter 5. Assembler instruction statements
135
Subfield 1: Duplication Factor
The syntax for coding the duplication factor is shown in the subfield format
operands in “DC instruction” on page 129.
You can omit the duplication factor. If specified, it causes the nominal value or
multiple nominal values specified in a constant to be generated the number of
times indicated by the factor. It is applied after the nominal value or values are
assembled into the constant. Symbols used in subfield 1 need not be previously
defined. This does not apply to literals.
The duplication factor can be specified by an unsigned decimal self-defining term
or by an absolute expression enclosed in parentheses.
The factor must have a positive value or be equal to zero.
Notes:
1.
A duplication factor of zero is permitted, except for literals, with the following
results:
v No value is assembled.
v Alignment is forced according to the type of constant specified, if no length
attribute is present (see “Alignment of constants” on page 132).
v The length attribute of the symbol naming the constant is established
according to the implicitly or explicitly specified length.
When the duplication factor is zero, the nominal value can be omitted. The
alignment is forced, even if the NOALIGN option is specified.
When the duplication factor is zero for a literal, the assembler issues message
ASMA067S Illegal duplication factor.
2.
If duplication is specified for an address constant whose nominal value
contains a location counter reference, the value of the location counter reference
is incremented by the length of the constant before each duplication is done
(see “Address constants—A and Y” on page 156). If the duplication factor is
zero, the value of the location counter reference is not incremented by the
length of each constant that was generated for a non-zero duplication factor.
Thus, in the following two statements, the first generates an ASMA072E error
message for "Data item too large", but the second does not:
A
DC 0Y(0,32768-(*-A))
B
DC Y(0,32768-(*-B))
However, if duplication is specified for an address-type literal constant
containing a location counter reference, the value of the location counter
reference is not incremented by the length of the literal before each duplication
is done. The value of the location counter reference is the location of the first
byte of the literal in the literal pool, and is the same for each duplication.
The location counter value is that of the instruction in which the literal appears
for A-type constants, but for S-type constants it is the location where the literal
appears.
When a bit-length constant of type A, B, F, H, P, X, Y, or Z is specified with a
duplication factor:
v Each nominal value is right-aligned in the specified field.
v Each nominal value is padded on the left with zeros or sign bits, according
to the type.
136
HLASM V1R6 Language Reference
If unfilled bits remain after each constant is generated, any remaining bits in
the last byte are filled with zero bits. That is, padding within a constant is
different from filling after a group of constants.
3. If a bit-length constant is specified with a duplication factor, each nominal
value is right-aligned in the specified field and padded on the left with zeros or
sign bits, according to the type. If unfilled bits remain after each constant is
generated, any remaining bits in the last byte are filled with zero bits. Thus,
padding within a constant is different from padding after a group of constants.
4. The maximum value for the duplication factor is 224-1, or X'FFFFFF' for OBJ
object files, 232-1, or X'7FFFFFFF' for GOFF object files. If the maximum value
for the duplication factor is exceeded, the assembler issues a message.
Possibilities include ASMA067S Illegal duplication factor and ASMA068S
Length error.
Subfield 2: Type
The syntax for coding the type is shown in the subfield format operands in “DC
instruction” on page 129.
You must specify the type subfield. From the type specification, the assembler
determines how to interpret the constant and translate it into the correct format.
The type is specified by a single-letter code as shown in Table 19, the type
extension as shown in Table 20 on page 138.
Further information about these constants is provided in the discussion of the
constants themselves under “Subfield 6: Nominal Value” on page 144.
Table 19. Type codes for constants
Code
Constant Type
Machine Format
C
Character
8 bit code for each character
G
Graphic
16 bit code for each character
X
Hexadecimal
4 bit code for each hexadecimal digit
B
Binary
Binary format
F
Fixed-point
Signed, fixed-point binary format; normally a fullword
H
Fixed-point
Signed, fixed-point binary format; normally a halfword
E
Floating-point
Short floating-point format; normally a fullword
D
Floating-point
Long floating-point format; normally a doubleword
L
Floating-point
Extended floating-point format; normally two
doublewords
P
Decimal
Packed decimal format
Z
Decimal
Zoned decimal format
A
Address
Value of expression in fixed-point binary format;
normally a fullword
Y
Address
Value of expression in fixed-point binary format;
normally a halfword
S
Address
Base register and displacement value; a halfword
V
Address
Space reserved for external symbol addresses; normally a
fullword
J
Address
Space reserved for length of class or DXD; normally a
fullword
Chapter 5. Assembler instruction statements
137
Table 19. Type codes for constants (continued)
Code
Constant Type
Machine Format
Q
Address
Space reserved for external dummy section offset
R
Address
Space reserved for PSECT addresses; normally a fullword
The type, with an optional type extension specification, indicates to the assembler:
1. How to assemble the nominal values specified in subfield 6; that is, which
binary representation or machine format the object code of the constant must
have.
2. At what boundary the assembler aligns the constant, if no length modifier is
present.
3. How much storage the constant occupies, according to the implicit length of
the constant, if no explicit length modifier is present (for details, see “Padding
and truncation of values” on page 134).
Subfield 3: Type Extension
The syntax for coding the type extension is shown in the subfield format operands
in “DC instruction” on page 129.
You can omit the type extension subfield. If specified, the assembler, using this
field with the type subfield, determines how to interpret the constant and translate
it into the correct format. The type extension is specified by a single-letter code as
shown in Table 20.
Table 20. Type extension codes for constants
Type
Type Extension
Description
C
A
ASCII character constant
E
EBCDIC character constant
U
Unicode UTF-16 character constant
E
H
Hexadecimal floating-point constant
B
Binary floating-point constant
D
Decimal floating-point constant
D
H
Hexadecimal floating-point constant
B
Binary floating-point constant
D
Decimal floating-point constant
L
H
Hexadecimal floating-point constant
B
Binary floating-point constant
D
Decimal floating-point constant
Q
Hexadecimal floating-point, quadword alignment
F
D
Doubleword fixed-point constant
A
D
Doubleword address constant
V
D
Doubleword address constant
J
D
Doubleword address constant
Q
D
Doubleword address constant
Q
Y
20 bit address constant (GOFF only)
R
D
Doubleword address constant
138
HLASM V1R6 Language Reference
Table 20. Type extension codes for constants (continued)
Type
Type Extension
Description
S
Y
20 bit address constant
The type extension specification, with the type subfield, indicates to the assembler:
1. How to assemble the nominal values specified in subfield 6; that is, which
binary representation or machine format the object code of the constant must
have.
2. At what boundary the assembler aligns the constant, if no length modifier is
present.
3. How much storage the constant occupies, according to the implicit length of
the constant, if no explicit length modifier is present (for details, see “Padding
and truncation of values” on page 134).
Subfield 4: Program type
The syntax for coding the program type is shown in the subfield format operands in
“DC instruction” on page 129.
You can omit the program type subfield. If specified, the assembler assigns the
value to the symbol naming the DC instruction, if a symbol was present. It can be
specified as a decimal, character, hex, or binary self-defining term and is stored as
a 32 bit value. The value is not used in any way by the assembler, and can be
queried by using the SYSATTRP built-in function.
The program type is specified within a P prefixed set of parenthesis - P(). For
example:
Prog1
DC CP(7)’Perth’
Program type is 7
Prog2
DC
3XP(C’APC’)’FF’ Program type is C’APC’
Symbols used in subfield 4 need not be previously defined, except in literals. For
example:
PV
EQU
240
LA
1,=FP(PV)’99’
Literal
SYM
DC
FP(Rate5)’35.92’
Rate5
EQU
5
All expressions in program type must be evaluatable when the DC is processed.
If program type is omitted, the assembler assigns a null to the program type, and
querying the value using the SYSATTRP built-in function returns a null value.
If there are multiple operands and the first has no P-type, but one of the
subsequent operands does have a P-type, then the program type is assigned from
the first operand specifying a program type value. For example:
alabel dc f’1’,hp(33)’32760’
results in a program type of 33 being assigned to alabel.
Subfield 5: Modifier
The syntax for coding the modifier is shown in the subfield format operands in “DC
instruction” on page 129.
Chapter 5. Assembler instruction statements
139
You can omit any of the modifiers from the modifier subfield. Modifiers describe
the length in bits or bytes you want for a constant (in contrast to an implied
length), and the scaling and exponent for the constant.
The three modifiers are:
v The length modifier (L), that explicitly defines the length in bits or bytes you
want for a constant. For example:
LENGTH DC
XL10’FF’
v The scale modifier (S), that is only used with the fixed-point or floating-point
constants (for details, see “Scale modifier” on page 142). For example:
SCALE
DC
FS8’35.92’
v The exponent modifier (E), that is only used with fixed-point or floating-point
constants, and indicates the power of 10 by which the constant is to be
multiplied before conversion to its internal binary format. For example:
EXPON
DC
EE3’3.414’
If multiple modifiers are used, they must appear in this sequence: length, scale,
and exponent. For example:
ALL3
DC
DL7S3E50’2.7182’
Symbols used in subfield 5 need not be previously defined, except in literals. For
example:
SYM
DC
FS(X)’35.92’
X
EQU
7
Length modifiers
Length modifiers can be:
v Byte-length modifiers — where the value of the modifier determines the number
of bytes of storage allocated to a constant.
v Bit-length modifiers — where the value of the modifier determines the number
of bits of storage allocated to a constant.
When no length is specified, for character and graphic constants (C and G),
hexadecimal constants (X), binary constants (B), and decimal constants (P and Z),
the whole constant is assembled into its implicit length.
Byte-length modifier: The length modifier indicates the number of bytes of
storage into which the constant is to be assembled. It is written as Ln, where n is
either a decimal self-defining term or an absolute expression enclosed by
parentheses. It must have a positive value.
When the length modifier is specified:
v Its value determines the number of bytes of storage allocated to a constant. It
therefore determines whether the nominal value of a constant must be padded
or truncated to fit into the space allocated (see “Padding and truncation of
values” on page 134).
v No boundary alignment, according to constant type, is provided (see
“Alignment of constants” on page 132).
v Its value must not exceed the maximum length allowed for the various types of
constant defined.
v The length modifier must not truncate double-byte data in a C-type constant,
except for bit-length modifiers.
v The length modifier must be a multiple of 2 in a G-type or CU-type constant.
140
HLASM V1R6 Language Reference
|
|