Главная Manuals High Level Assembler for z/OS & z/VM & z/VSE. Language Reference (Version 1 Release 6)
|
|
|
SET symbol specifications
SET symbols can be used in model statements, from which assembler language
statements are generated, and in conditional assembly instructions. The three types
of SET symbols are: SETA, SETB, and SETC. A SET symbol must be a valid
variable symbol.
The rules for creating a SET symbol are:
v The first character must be an ampersand (&)
v The second character must be an alphabetic character
v The remaining characters must be 0 to 61 alphanumeric
v Do not set the first four characters to &SYS, which is used for system variable
symbols
Examples:
&ARITHMETICVALUE439
&BOOLEAN
&C
&EASY_TO_READ
Local SET symbols need not be declared by explicit declarations. The assembler
considers any undeclared variable symbol found in the name field of a SETx
instruction as a local SET symbol, and implicitly declares it to have the type
specified by the SETx instruction. The instruction that declares a SET symbol
determines its scope and type.
The features of SET symbols and other types of variable symbols are compared in
Table 50.
Table 50. Features of SET symbols and other types of variable symbols
SETA, SETB, Symbolic
System Variable
Features
SETC symbols Parameters
Symbols
Can be used in:
|
Open code
Yes
No
&SYS_HLASM_PTF
|
&SYS_HLASM_RPM
&SYSASM
&SYSDATC
&SYSDATE
&SYSJOB
&SYSM_HSEV
&SYSM_SEV
|
&SYSOPT_CURR_OPTABLE
&SYSOPT_DBCS
&SYSOPT_OPTABLE
&SYSOPT_RENT
&SYSOPT_XOBJECT
&SYSPARM
&SYSSTEP
&SYSSTMT
&SYSTEM_ID
Macro definitions
Yes
Yes
&SYSTIME
&SYSVER
All
Chapter 9. How to write conditional assembly instructions
321
Table 50. Features of SET symbols and other types of variable symbols (continued)
SETA, SETB,
Symbolic
System Variable
Features
SETC symbols
Parameters
Symbols
Scope:
Local
Yes
Yes
&SYSADATA_DSN
&SYSADATA_MEMBER
&SYSADATA_VOLUME
&SYSCLOCK
&SYSECT
&SYSIN_DSN
&SYSIN_MEMBER
&SYSIN_VOLUME
&SYSLIB_DSN
&SYSLIB_MEMBER
&SYSLIB_VOLUME
&SYSLIN_DSN
&SYSLIN_MEMBER
&SYSLIN_VOLUME
&SYSLIST
&SYSLOC
&SYSMAC
&SYSNDX
&SYSNEST
&SYSPRINT_DSN
&SYSPRINT_MEMBER
&SYSPRINT_VOLUME
&SYSPUNCH_DSN
&SYSPUNCH_MEMBER
&SYSPUNCH_VOLUME
&SYSSEQF
&SYSTERM_DSN
&SYSTERM_MEMBER
&SYSTERM_VOLUME
Global
Yes
No
&SYSASM
&SYSDATC
&SYSDATE
&SYSJOB
&SYSM_HSEV
&SYSM_SEV
|
&SYSOPT_CURR_OPTABLE
&SYSOPT_DBCS
&SYSOPT_OPTABLE
&SYSOPT_RENT
&SYSOPT_XOBJECT
&SYSPARM
&SYSSTEP
&SYSSTMT
&SYSTEM_ID
&SYSTIME
&SYSVER
Yes¹
Values can be
No, read only
No, read only
changed within
value²
value²
scope of symbol
322
HLASM V1R6 Language Reference
Table 50. Features of SET symbols and other types of variable symbols (continued)
SETA, SETB, Symbolic
System Variable
Features
SETC symbols Parameters
Symbols
Notes:
1. The value assigned to a SET symbol can be changed by using the SETA, SETAF, SETB,
SETC, or SETCF instruction within the declared or implied scope of the SET symbol.
2. A symbolic parameter and the system variable symbols (except for &SYSSTMT,
&SYSM_HSEV, and &SYSM_SEV) are assigned values that remain fixed throughout their
scope. Wherever a SET symbol appears in a statement, the assembler replaces the
symbol's current value with the value assigned to it.
SET symbols can be used in the name, operation, and operand fields of macro
instructions. The value thus passed through the name field symbolic parameter
into a macro definition is considered as a character string and is generated as such.
If the COMPAT(SYSLIST) assembler option is specified, the value passed through
an operand field symbolic into a macro definition is also considered a character
string and is generated as such. However, if the COMPAT(SYSLIST) assembler
option is not specified, SET symbols can be used to pass sublists into a macro
definition.
Subscripted SET symbol specification
Here is the format of a subscripted SET symbol:
►► &symbol(subscript)
►◄
&symbol
Is a variable symbol.
subscript
Is an arithmetic expression with a value greater than or equal to 1.
Example:
&ARRAY(20)
The subscript can be any arithmetic expression allowed in the operand field of a
SETA instruction (see “Arithmetic (SETA) expressions” on page 359).
The subscript refers to one of the many positions in an array of values identified
by the SET symbol.
A subscripted SET symbol can be used anywhere an unsubscripted SET symbol is
allowed. However, subscripted SET symbols must be declared as subscripted by a
previous local or global declaration instruction, or implicitly as a local subscripted
SET symbol in a SETx instruction of the desired type.
The dimension (the maximum value of the subscript) of a subscripted SET symbol
is not determined by the explicit or implicit declaration of the symbol. The
dimension specified can be exceeded in later SETx instructions. Note, however, that
increasing the dimension of a subscripted SET symbol also increases the storage
required. For example, referencing only &ARRAY(1000000) still causes the
Chapter 9. How to write conditional assembly instructions
323
preceding 999999 elements to be allocated. You can determine the maximum
subscript using the N' attribute (see “Number attribute (N')” on page 336).
The subscript can be a subscripted SET symbol.
Created SET symbols
The assembler can create SET symbols during conditional assembly processing
from other variable symbols and character strings. A SET symbol thus created has
the form &(e), where e represents one or more of these:
v Variable symbols, optionally subscripted
v Strings of alphanumeric characters
v Other created SET symbols
After substitution and concatenation, e must consist of a string of up to 62
alphanumeric characters, the first of which is alphabetic. The assembler considers
the preceding ampersand and this string as the name of a SET variable. If this
created SET symbol has the same name as an existing SET symbol, they are treated
as identical. If this created SET symbol does not have the name of any existing SET
symbol, the usual rules for assigning type and scope apply.
You can use created SET symbols wherever ordinary SET symbols are permitted,
including declarations. A created SET symbol must not match the name of a
system variable symbol, nor the name of a symbolic parameter in a macro
prototype statement. You can also nest created SET symbols in other created SET
symbols.
Consider the following example:
&ABC(1) SETC
’MKT’,’27’,’$5’
Let &(e) equal &(&ABC(&I)QUA&I).
&I &ABC(&I) Created SET Symbol Comment
1
MKT
&MKTQUA1
Valid
2
27
&27QUA2
Invalid: character after ’&’ not alphabetic
3
$5
&$5QUA3
Valid
4
&QUA4
Valid
The name of a created SET symbol cannot match the name of a system variable
symbol or of a symbolic parameter in a macro definition.
The created SET symbol can be thought of as a form of indirect addressing. With
nested created SET symbols, you can perform this kind of indirect addressing to
any level.
In another sense, created SET symbols offer an associative storage facility. For
example, a symbol table of numeric attributes can be referred to by an expression
of the form &(&SYM)(&I) to yield the Ith attribute of the symbol name in &SYM. As
this example indicates, created SET symbols can be declared and used as arrays of
dimensioned variables.
Created SET symbols also enable you to achieve some of the effect of
multiple-dimensioned arrays by creating a separate name for each element of the
array. For example, a 3-dimensional array of the form &X(&I,&J,&K) might be
addressed as &(X&I.$&J.$&K), where &I, &J, and &K typically have numeric values.
Thus, &X(2,3,4) is represented by &X2$3
$4. The $ separators guarantee that
&X(2,33,55) and &X(23,35,5) are unique:
324
HLASM V1R6 Language Reference
&X(2,33,55) becomes &X2
$33$55
&X(23,35,5) becomes &X23$35
$5
Data attributes
The data, such as instructions, constants, and areas, that you define in a source
module, can be described by its:
v Type, which distinguishes a property of a named object or macro argument, for
example, fixed-point constants from floating-point constants, or machine
instructions from macro instructions
v Length, which gives the number of bytes occupied by the object code of the
named data
v Scaling, which shows the number of positions occupied by the fractional portion
of named fixed-point, floating-point, and decimal constants in their object code
form
v Integer, which shows the number of positions occupied by the integer portion of
named fixed-point and decimal constants in their object code form
v Count, which gives the number of characters that are required to represent the
named data, such as a macro instruction operand, as a character string
v Number, which gives the number of sublist entries in a macro instruction
operand
v Defined, which determines whether a symbol has been defined prior to the point
where the attribute reference is coded
v Operation Code, which shows if an operation code, such as a macro definition
or machine instruction, is defined prior to the point where the attribute reference
is coded
These characteristics are called the attributes of the symbols naming the data. The
assembler assigns attribute values to the ordinary symbols and variable symbols
that represent the data.
Specifying attributes in conditional assembly instructions allows you to control
conditional assembly logic, which, in turn, can control the sequence and contents
of the statements generated from model statements. The specific purpose for which
you use an attribute depends on the kind of attribute being considered. Here are
the attributes and their main uses:
Table 51. Data attributes
Attribute
Purpose
Main Uses
Type
Gives a letter that identifies type of
v In tests to distinguish
data represented
between different data
types
v For value substitution
v In macros to discover
missing operands
Length
Gives number of bytes that data
v For substitution into length
occupies in storage
fields
v For computation of storage
requirements
Scaling
Refers to the position of the decimal
v For testing and regulating
point in fixed-point, floating-point, and
the position of decimal
decimal constants
points
v For substitution into a
scale modifier
Chapter 9. How to write conditional assembly instructions
325
Table 51. Data attributes (continued)
Attribute
Purpose
Main Uses
Integer
Is a function of the length and scale
v To keep track of significant
attributes of decimal, fixed-point, and
digits (integers)
floating-point constants
Count
Gives the number of characters
v For scanning and
required to represent data
decomposing character
strings
v As indexes in substring
notation
Number¹
Gives the number of sublist entries in a
v For scanning sublists
macro instruction operand sublist, or
v As a counter to test for end
the maximum subscript of a
of sublist
dimensioned SET symbol to which a
v For testing array limits
value has been assigned.
Defined
Shows whether the symbol referenced
v To avoid defining a symbol
has been defined prior to the attribute
again if the symbol
reference
referenced has been
previously defined
Operation Code
Shows whether a given operation code
v To avoid assembling a
has been defined prior to the attribute
macro or instruction if it
reference
does not exist.
Notes:
1. The number attribute of &SYSLIST(n) and &SYSLIST(n,m) is described in “&SYSLIST
System Variable Symbol” on page 276.
Attribute reference
►► attribute_notation' ordinary_symbol
►◄
variable_symbol
literal
character_string
attribute_notation'
Is the attribute whose value you want, followed by a apostrophe. Valid
attribute letters are “D”, “O”, “N”, “S”, “K”, “I”, “L”, and “T”.
ordinary_symbol
Is an ordinary symbol that represents the data that possesses the attribute. An
ordinary symbol cannot be specified with the operation code attribute.
variable_symbol
Is a variable symbol that represents the data that possesses the attribute.
literal
Is a literal that represents the data that possesses the attribute. A literal cannot
be specified with the operation code attribute or count attribute.
character_string
Is a character string that represents the operation code in the operation code
attribute.
Examples:
326
HLASM V1R6 Language Reference
T’SYMBOL
L’&VAR
K’&PARAM
O’MVC
S’=P’975.32’
The assembler substitutes the value of the attribute for the attribute reference.
Reference to the count (K'), defined (D'), number (N'), operation code (O'), and
type (T') attributes can be used only in conditional assembly instructions or within
macro definitions. The length (L'), integer (I'), and scale (S') attribute references can
be in conditional assembly instructions, machine instructions, assembler
instructions, and the operands of macro instructions.
Attributes of symbols and expressions
Table 52 shows attribute references (in the columns) and types of symbols (in the
rows). Each intersection shows whether (“Yes”) or not (“No”) you can validly
apply the attribute reference to that symbol type, or (for SET symbols) to the value
of the symbol.
Table 52. Attributes and related symbols
Operation
Symbols
Type
Length
Scale
Integer
Count
Number
Defined
Code
Specified
T'
L'
S'
I'
K'
N'
D'
O'
In open code:
Ordinary
Yes
Yes
Yes
Yes
No
No
Yes
No
symbols
System variable
Yes
No
No
No
Yes
Yes
No
No
symbols with
global scope
Literals in
Yes
Yes
Yes
Yes
No
No
Yes
No
macro
instruction
operands
In macro
definitions:
Ordinary
Yes
Yes
Yes
Yes
No
No
Yes
No
symbols
Symbolic
Yes
Yes
Yes
Yes
Yes
Yes
Yes
Yes
parameters
System variable
symbols:
&SYSLIST
Yes
Yes
Yes
Yes
Yes
Yes
Yes
No
All others
Yes
No
No
No
Yes
Yes
No
No
Literals in
Yes
Yes
Yes
Yes
No
No
Yes
No
macro instruction
operands
Chapter 9. How to write conditional assembly instructions
327
The values of attribute references can be used in ordinary and conditional
assembly expressions, as shown in Table 53.
Table 53. Using attribute values
Operation
Symbols
Type
Length
Scale
Integer
Count Number Defined Code
Specified
T'
L'
S'
I'
K'
N'
D'
O'
In open code:
SETB¹, SETA,
SETA,
SETA,
SETA,
SETA,
SETA,
SETB¹,
SET symbols
SETC
SETB²
SETB²
SETB²
SETB²
SETB²
SETB²
SETC
In ordinary
No
Yes
Yes
Yes
No
No
No
No
assembly:
In macro
SETB¹, SETA,
SETA,
SETA,
SETA,
SETA,
SETA,
SETB¹,
definitions:
SETC
SETB²
SETB²
SETB²
SETB²
SETB²
SETB²
SETC
SET symbols
Notes:
1.
Only in character relations.
2.
Only in arithmetic relations.
The value of an attribute for an ordinary symbol specified in an attribute reference
comes from the item named by the symbol. The symbol must appear in the name
field of an assembler or machine instruction, or in the operand field of an EXTRN
or WXTRN instruction.
The value of an attribute reference to an expression is the value of that attribute
reference to its leftmost term.
Notes:
1. You cannot refer to the names of instructions generated by conditional
assembly substitution or macro generation until the instruction is generated.
2. If you use a symbol qualifier to qualify an ordinary symbol in an attribute
reference, the qualifier is ignored.
The value of an attribute for a variable symbol specified in an attribute reference
comes from the value substituted for the variable symbol as follows:
SET Symbols and System Variable Symbols
For SET symbols and all system variable symbols other than &SYSLIST, the
attribute values come from the current value of these symbols.
Symbolic Parameters and &SYSLIST
For symbolic parameters and the system variable symbol, &SYSLIST, the
values of the count and number attributes come from the operands of
macro instructions. The name field entry of the call is an “operand”, and is
referenced as &SYSLIST(0). The values of the type, length, scale, and
integer attributes, however, come from the values represented by the macro
instruction operands, as follows:
1. If the operand is a sublist, the entire sublist and each entry of the
sublist can possess attributes. The whole sublist has the same attributes
as those of the first suboperand in the sublist (except for the count
attribute, which can be different, and the number attribute which is
relevant only for the whole sublist).
328
HLASM V1R6 Language Reference
2. If the first character or characters of the operand (or sublist entry)
constitute an ordinary symbol, and this symbol is followed by either an
arithmetic operator (+, -, *, or /), a left parenthesis, a comma, or a
space, then the value of the attributes for the operand are the same as
for the ordinary symbol.
3. If the operand (or sublist entry) is a character string other than a sublist
or the character string described in the previous point, the type
attribute is undefined (U) and the length, scale, and integer attributes
are invalid.
Because the count (K'), number (N'), and defined (D') attribute references
are allowed only in conditional assembly instructions, their values are
available only during conditional assembly processing. They are not
available at ordinary assembly time.
The system variable symbol &SYSLIST, with a valid subscript, can be used
in an attribute reference to refer to a macro instruction operand, and, in
turn, to an ordinary symbol. Thus, any of the attribute values for macro
instruction operands and ordinary symbols in the following subsections
can also be substituted for an attribute reference containing &SYSLIST (see
“&SYSLIST System Variable Symbol” on page 276).
Type attribute (T')
The type attribute has a value of a single alphabetic character that shows the type
of data represented by:
v An ordinary symbol
v A macro instruction operand
v A SET symbol
v A literal
v A system variable symbol
The type attribute can change during an assembly. The lookahead search might
assign one attribute, whereas the symbol table at the end of the assembly might
display another.
The type attribute reference can be used in the operand field of a SETC instruction
or as one of the values used for comparison in the operand field of a SETB or AIF
instruction.
The type attribute can also be specified outside conditional assembly instructions.
Then, the type attribute value is not used for conditional assembly processing, but
is used as a value at assembly time.
The following letters are used for the type attribute of data represented by
ordinary symbols and outer macro instruction operands that are symbols that
name DC or DS statements.
A
A-, J-type address constant, implied length, aligned (also CXD instruction
label)
B
Binary constant
C
Character constant
D
Long floating-point constant, implicit length, aligned
E
Short floating-point constant, implicit length, aligned
F
Fullword fixed-point constant, implicit length, aligned
G
Fixed-point constant, explicit length
H
Halfword fixed-point constant, implicit length, aligned
K
Floating-point constant, explicit length
Chapter 9. How to write conditional assembly instructions
329
L
Extended floating-point constant, implicit length, aligned
P
Packed decimal constant
Q
Q-type address constant, implicit length, aligned
R
A-, S-, Q-, J-, R-, V-, or Y-type address constant, explicit length
S
S-type address constant, implicit length, aligned
V
R-, V-type address constant, implicit length, aligned
X
Hexadecimal constant
Y
Y-type address constant, implicit length, aligned
Z
Zoned decimal constant
@
Graphic (G) constant
When a literal is specified as the name field on a macro call instruction, and if the
literal has previously been used in a machine instruction, the type attribute of the
literal is the same as for data represented by ordinary symbols or outer macro
instructions operands.
The following letters are used for the type attribute of data represented by
ordinary symbols (and outer macro instruction operands that are symbols) that
name statements other than DC or DS statements, or that appear in the operand
field of an EXTRN or WXTRN statement:
I
Machine instruction
J
Control section name
M
The name field on a macro instruction, when the name field is:
v A valid symbol not previously defined
v A valid literal not previously defined
T
Identified as an external symbol by EXTRN instruction
W
CCW, CCW0, or CCW1 instruction
$
Identified as an external symbol by WXTRN instruction
The following letter is used for the type attribute of data represented by inner and
outer macro instruction operands only:
O Omitted operand (has a value of a null character string). Such an operand
need not be a null string: a macro operand such as (,,) has a null first
suboperand.
The following attribute is used for the type attribute of the value of variable
symbols:
N The value is numeric
The following letter is used for symbols or macro instruction operands that cannot
be assigned any of the above letters:
U
Undefined, unknown, or unassigned
The common use of the U type attribute is to describe a valid symbol that
has not been assigned any of the type attribute values described above. If
the assembler is not able to determine what the named symbol represents,
it also assigns the U type attribute. Thus, the U type attribute can mean
undefined, or unknown, or unassigned at the time of the reference. Consider
the following macro definition:
Name
Operation
Operand
macro
MAC1 &op1,&op2
&A
setc T’&op1
&B
setc T’&op2
DC C’&A’
DC containing type attribute for op1
DC C’&B’
DC containing type attribute for op2
mend
330
HLASM V1R6 Language Reference
When the macro MAC1 is called in Figure 43, neither of the operands has
previously been defined, however GOOD_SYMBOL is a valid symbol name,
whereas ?BAD_SYMBOL? is not a valid symbol name. The type attribute for
both operands is U, meaning GOOD_SYMBOL is undefined, and ?BAD_SYMBOL?
is unknown.
When the macro MAC1 is called in Figure 44, GOOD_SYMBOL is a valid symbol
000000
00000 00004
8 a csect
9
mac1 GOOD_SYMBOL,?BAD_SYMBOL?
000000 E4
10+
DC C’U’
DC containing type attribute for op1
000001 E4
11+
DC C’U’
DC containing type attribute for op2
12
end
Figure 43. Undefined and unknown type attributes
name, and has been defined in the DC instruction at statement 12.
?BAD_SYMBOL? is a not valid symbol name, and the assembler issues an
error message at statement 13. The type attribute for GOOD_SYMBOL is C,
meaning that the symbol represents a character constant. The type attribute
for ?BAD_SYMBOL? is U, meaning that the type is unknown.
000000
00000 00006
8 a csect
9
mac1 GOOD_SYMBOL,?BAD_SYMBOL?
000000 C3
10+
DC C’C’
DC containing type attribute for op1
000001 E4
11+
DC C’U’
DC containing type attribute for op2
000002 A9
12 GOOD_SYMBOL dc cl1’z’
000003 A9
13 ?BAD_SYMBOL? dc cl1’z’
** ASMA147E Symbol too long, or first character not a letter - ?BAD_SYMBOL?
14
end
Figure 44. Unknown type attribute for invalid symbol
The type attribute value U, meaning undefined, unknown, or unassigned, is
assigned to the following:
v Ordinary symbols used as labels:
- For the LTORG instruction
- For the EQU instruction without a third operand
- For DC and DS statements that contain variable symbols, for example,
U1 DC &X’1’
- That are defined more than once, even though only one instance of
the label is generated due to conditional assembly statements. A
lookahead scan for attributes of a symbol might encounter more than
one occurrence of a symbol, in which case the assembler cannot yet
tell which statements will be generated. In such cases, type attribute
U is assigned. At a later time, when the symbol has been generated,
its type attribute is changed to the correct value for the type of
statement it names.
v SETC variable symbols that have a value other than a null character
string or the name of an instruction that can be referred to be a type
attribute reference
v System variable symbols except:
- &SYSDATC, &SYSM_HSEV, &SYSM_SEV, &SYSNDX, &SYSNEST,
&SYSOPT_DBCS, &SYSOPT_RENT, &SYSOPT_XOBJECT, and
&SYSSTMT, which always have a type attribute value of N
Chapter 9. How to write conditional assembly instructions
331
- Some other character type system variable symbols can be assigned
the value of a null string, in which case they have a type attribute
value of O
v Macro instruction operands that specify a literal that is not a duplicate of
a literal used in a machine instruction
v Inner macro instruction operands that are ordinary symbols
Notes:
1.
Ordinary symbols used in the name field of an EQU instruction have the type
attribute value U. However, the third operand of an EQU instruction can be
used explicitly to assign a type attribute value to the symbol in the name field.
2.
The type attribute of a sublist is set to the same value as the type attribute of
the first element of the sublist.
3.
High Level Assembler and earlier assemblers treat the type attribute differently:
v
Because High Level Assembler allows attribute references to statements
generated through substitution, certain cases in which a type attribute of U
(undefined, unknown, or unassigned) or M (macro name field) is given
under the DOS/VSE Assembler, might give a valid type attribute under High
Level Assembler. If the value of the SETC symbol is equal to the name of an
instruction that can be referred to by the type attribute, High Level
Assembler lets you use the type attribute with a SETC symbol.
v
Because High Level Assembler allows attribute references to literals, certain
cases in which a type attribute of U (undefined, unknown, or unassigned) is
given by Assembler F and Assembler H for a macro operand that specifies a
literal, might give a valid type attribute under High Level Assembler. If the
literal specified in the macro instruction operand is a duplicate of a literal
specified in open code, or previously generated by conditional assembly
processing or macro generation, High Level Assembler gives a type attribute
that shows the type of data specified in the literal. The COMPAT(LITTYPE)
option causes High Level Assembler to behave like Assembler H, always
giving a type attribute of U for the T' literal.
v
When a type attribute reference is made outside conditional assembly
instructions, its value is treated as a character self-defining term. For
example, if the symbol A is defined in this statement:
A
DC
A(*)
then the symbol A has type attribute 'A' in conditional assembly instructions.
However, if this statement is followed by
DC
A(T’A)
Generates X’000000C1’
the generated data is the same as if you had written
DC
A(C’A’)
Generates X’000000C1’
Length attribute (L')
The length attribute has a numeric value equal to the number of bytes occupied by
the data that is named by the symbol specified in the attribute reference.
Evaluation of length attribute references for conditional assembly statements is
handled differently from references in ordinary assembly.
In conditional assembly statements, the operand of a length attribute reference
must be either an ordinary symbol whose length attribute is either known, or can
332
HLASM V1R6 Language Reference
be determined in lookahead mode (Figure 45); or it must be a variable symbol
whose value is that of an ordinary symbol satisfying the same rules.
In ordinary assembly statements, the operand of a length attribute reference can be
a character-valued conditional assembly expression whose value is that of an
ordinary symbol.
Here is an example to clarify this distinction:
&B
SETC
’B’
AB
DC
C’A&B’
Valid in ordinary assembly
LAB
DC
AL1(L’A&B)
Valid in ordinary assembly
&N
SETA
L’A&B
Invalid in conditional assembly
&T1
SETB
(L’A&B EQ 2)
Invalid in conditional assembly
&T2
SETB
(2 EQ L’A&B)
Invalid in conditional assembly
The two SETB statements receive different diagnostic messages, because the errors
are detected during different parts of the assembler's analysis of the SETB
expressions.
In conditional assembly statements, the operand of a length attribute reference
must be an ordinary or variable symbol, and not a character expression.
The length attribute can also be specified outside conditional assembly instructions.
Then, the length attribute value is not available for conditional assembly
processing, but is used as a value at assembly time.
Figure 45 is an example showing the evaluation of the length attribute for an
assembler instruction in statement 1 and for a conditional assembly instruction in
statement 8.
000000
E740
1 CSYM DC
CL(L’ZLOOKAHEAD)’X’ Length resolved later
2 &LEN SETA
L’CSYM
** ASMA042E
Length
attribute of symbol is unavailable; default=1
3
DC
C’&LEN ’ REAL LENGTH NOT AVAILABLE
000002 F140
+
DC
C’1 ’
REAL LENGTH NOT AVAILABLE
4 &TYP SETC T’CSYM
5
DC
C’&TYP ’ TYPE IS KNOWN
000004 C340
+
DC
C’C ’
TYPE IS KNOWN
6 &DEF SETA D’CSYM
7
DC
C’&DEF ’ SYMBOL IS DEFINED
000006 F140
+
DC
C’1 ’
SYMBOL IS DEFINED
8 &LEN SETA L’zlookahead Length resolved immediately
9 CSYM2 DC
CL(&len)’X’
000008 E740
+CSYM2 DC
CL(2)’X’
10 &LEN SETA L’CSYM2
11
DC
C’&LEN ’ REAL LENGTH NOW AVAILABLE
00000A F240
+
DC
C’2 ’
REAL LENGTH NOW AVAILABLE
00000C 0001
12 ZLOOKAHEAD DC
H’1’
13
END
Figure 45. Evaluation of length attribute references
In statement 2 the length of CSYM has not been established because the definition of
CSYM in statement 1 is not complete. The reference to the length attribute results in
a length of 1 and error message ASMA042E. However, statement 5 shows that the
type attribute is assigned, and statement 7 shows that the defined attribute is
Chapter 9. How to write conditional assembly instructions
333
assigned. In comparison, the length attribute for symbol CSYM2 is available
immediately, as it was retrieved indirectly using the conditional assembly
instruction in statement 8.
During conditional assembly, an ordinary symbol used in the name field of an
EQU instruction has a length attribute value that depends on the order of the
symbol's definition and the reference to its length attribute.
v If the first operand of the EQU instruction is a self-defining term, the length
attribute value is 1.
v If the first operand of the EQU instruction is a symbol whose value and length
attribute are defined, the length attribute value is that of the symbol in the first
operand.
v If the first operand of the EQU instruction is a defined symbol and the EQU
instruction specifies a length value in the second operand, the length attribute
value is that of the second operand.
At assembly time, the symbol has the same length attribute value as the first term
of the expression in the first operand of the EQU instruction. However, the second
operand of an EQU instruction can be used to assign a length attribute value to the
symbol in the name field. This second operand cannot be a forward reference to
another EQU instruction.
Notes:
1. The length attribute reference, when used in conditional assembly processing,
can be specified only in arithmetic expressions.
2. When used in conditional assembly processing, a length attribute reference to a
symbol with the type attribute value of M, N, O, T, U, or $ is flagged. The
length attribute for the symbol has the default value of 1.
Scale attribute (S')
The scale attribute can be used only when referring to fixed-point, floating-point,
or decimal constants. The following table shows the numeric value assigned to the
scale attribute:
Constant
Types
Type of DC or DS
Value of Scale
Allowed
Allowed
Attribute Assigned
Fixed-Point
H and F
Equal to the value of the scale modifier
(-187 through +346)
Floating Point
D, E, and L
Equal to the value of the scale modifier(0
through 14 — D, E)(0 through 28 — L)
Decimal
P and Z
Equal to the number of decimal digits
specified to the right of the decimal
point(0 through 31 — P)(0 through 16 —
Z)
The scale attribute can also be specified outside conditional assembly instructions.
Then, the scale attribute value is not used for conditional assembly processing, but
is used as a value at assembly time.
Notes:
1. The scale attribute reference can be used only in arithmetic expressions.
334
HLASM V1R6 Language Reference
2. When no scale attribute value can be determined, the reference is flagged and
the scale attribute is 1.
3. If the value of the SETC symbol is equal to the name of an instruction that can
validly define the scale attribute, the assembler lets you use the scale attribute
with a SETC symbol.
4. Binary floating-point constants return an attribute of 0.
5. Decimal floating-point constants return an attribute of 0.
6. The scale attribute reference can only be used in arithmetic expressions in
conditional assembly instructions, and in absolute and relocatable expressions
in assembler and machine instructions.
Integer attribute (I')
The integer attribute has a numeric value that depends on the length and scale
attribute values of the data being referred to by the attribute reference. The
formulas relating the integer attribute to the length and scale attributes are given
in Table 54.
The integer attribute can also be specified outside conditional assembly
instructions. Then, the integer attribute value is not used for conditional assembly
processing, but is used as a value at assembly time.
Notes:
1. The integer attribute reference can be used only in arithmetic expressions.
2. When no integer attribute value can be determined, the reference is flagged and
the integer attribute is 1.
3. If the value of the SETC symbol is equal to the name of an instruction that can
validly define the integer attribute, the assembler lets you use the integer
attribute with a SETC symbol.
4. Binary floating-point constants return an attribute of 0.
5. Decimal floating-point constants return an attribute of 0.
6. The integer attribute reference can only be used in arithmetic expressions in
conditional assembly instructions, and in absolute and relocatable expressions
in assembler and machine instructions.
Table 54. Relationship of integer to length and scale attributes
Formula Relating Integer to
Values of the Integer
Constant Type
Length and Scale Attributes
Examples
Attribute
Fixed-point(H and F)
I’ = 8*L’-S’-1
HALFCON DC HS6’-25.93’
I’ = 8*2-6-1
= 9
ONECON DC FS8’100.3E-2’
I’ = 8*4-8-1
= 23
when L’ ≤ 8
Floating-point
I’ = 2*(L’-1)-S’
SHORT
DC ES2’46.415’
I’ = 2*(4-1)-2
(D, E, and L)
= 4
LONG
DC DS5’-3.729’
I’ = 2*(8-1)-5
= 9
when L’ > 8
I’ = 2*(L’-1)-S’-2
EXTEND DC LS10’5.312’
I’ = 2*(16-1)-10-2
L-type only
= 18
Chapter 9. How to write conditional assembly instructions
335
Table 54. Relationship of integer to length and scale attributes (continued)
Formula Relating Integer to
Values of the Integer
Constant Type
Length and Scale Attributes
Examples
Attribute
Decimal¹
I’ = 2*L’-S’-1
PACK
DC P’+3.513’
I’ = 2*3-3-1
Packed (P)
= 2
I’ = L’-S’
ZONE
DC Z’3.513’
I’ = 4-3
= 1
Zoned (Z)
Note:
1. The value of the integer attribute is equal to the number of digits to the left of the assumed decimal point after
the constant is assembled, and the value of the scale attribute is equal to the number of digits to the right of the
assumed decimal point.
Count attribute (K')
The count attribute applies only to macro instruction operands, to SET symbols,
and to the system variable symbols. It has a numeric value equal to the number of
characters:
v That constitute the macro instruction operand, or
v That are required to represent as a character string the current value of the SET
symbol or the system variable symbol.
Notes:
1. The count attribute reference can be used only in arithmetic expressions.
2. The count attribute of an omitted macro instruction operand has a value of 0.
3. Doubled quotes ('') in quoted character strings count as one character. Doubled
ampersands (&&) in quoted character strings count as two characters. For more
information about character pairs see “Evaluation of character expressions” on
page 389.
4. These pairing rules mean that the length attribute of a character variable
substituted into a character constant might be different from the count attribute
of the substituted variable.
5. The count attribute differs from the Number (N') attribute, described below.
Number attribute (N')
The number attribute applies to the operands of macro instructions and
subscripted SET symbols.
When applied to a macro operand, the number attribute is a numeric value equal
to the number of sublist entries.
When applied to a subscripted SET symbol, the number attribute is equal to the
highest element to which a value has been assigned in a SETx instruction.
Consider the example in Figure 46 on page 337.
336
HLASM V1R6 Language Reference
1
macro
2
MAC1 &op1
3
lcla &SETSUB(100)
4 &SETSUB(5) seta 20,,,70
5 &B
seta N’&SETSUB
6 &C
seta N’&op1
7
DC C’Highest referenced element of SETSUB = &B’
8
DC C’Number of sublist entries in OP1 = &C’
9
mend
000000
00000 0004C
10 a
csect
11
MAC1 (1,(3),(4))
000000 C889878885A2A340
12+
DC C’Highest referenced element of SETSUB = 8’
000028 D5A4948285994096
13+
DC C’Number of sublist entries in OP1 = 3’
14
end
Figure 46. Number attribute reference
N’&op1 is equal to 3 because there are three subscripts in the macro operand in
statement 11: 1, (3), and (4).
N’&SETSUB is equal to 8 because &SETSUB(8), assigned the value 70 in statement 4, is
the highest referenced element of the &SETSUB array entries.
Notes:
1. The number attribute reference can be used only in arithmetic expressions.
2. N'&SYSLIST refers to the number of positional operands in a macro instruction,
and N'&SYSLIST(n) refers to the number of sublist entries in the n-th operand.
3. For positional macro parameters, either explicitly named or implicitly named as
&SYSLIST(n):
a. If the first character of an operand is a left parenthesis, count the number of
unquoted and unnested commas between it and the next matching right
parenthesis. That number plus one is the number attribute of the operand.
b. If there is no initial left parenthesis, the number attribute is one.
4. For all other system variable symbols, the number attribute value is always
one. This is also true for &SYSMAC. The range of the subscript for &SYSMAC
is 0 - &SYSNEST.
5. N' is always zero for unsubscripted set symbols. The number attribute (N'),
when used with a macro instruction operand, examines its list structure, not
the number of characters in the operand. (The number of characters is
determined by the count (K') attribute.)
Defined attribute (D')
The defined attribute shows whether the ordinary symbol or literal referenced has
been defined prior to the attribute reference. A symbol is defined if it has been
encountered in the operand field of an EXTRN or WXTRN statement, or in the
name field of any other statement except a TITLE statement or a macro instruction.
A literal is defined if it has been encountered in the operand field of a machine
instruction. The value of the defined attribute is an arithmetic value that can be
assigned to a SETA symbol, and is equal to 1 if the symbol has been defined, or 0
if the symbol has not been defined.
The defined attribute can reference:
v Ordinary symbols not constructed by substitution
v Macro instruction operands
Chapter 9. How to write conditional assembly instructions
337
v SETC symbols whose value is an ordinary symbol
v System variable symbols whose value is an ordinary symbol
v Literals
Here is an example of how you can use the defined attribute:
Name
Operation
Operand
AIF
(D’A).AROUND
A
LA
1,4
.AROUND
ANOP
In this example, assuming there has been no previous definition of the symbol A,
the statement labeled A is assembled, since the conditional-assembly branch around
it is not taken. However, if by an AGO or AIF conditional-assembly branch the
same statement is processed again, the statement at A is not assembled:
Name
Operation
Operand
.UP
AIF
(D’A).AROUND
A
LA
1,4
.AROUND
ANOP
AGO
.UP
You can save assembly time using the defined attribute which avoids lookahead
mode (see “Lookahead” on page 340 for more information). You can use the
defined attribute in your program to prevent the assembler from making this
time-consuming forward scan. This attribute reference can be used in the operand
field of a SETA instruction or as one of the values in the operand field of a SETB
or AIF instruction.
Notes:
1. D' applied to a SETA or SETB symbol, or to a system variable symbol, is an
error.
2. D' applied to a SETC symbol or symbolic parameter is valid only if the value of
the SETC symbol or symbolic parameter is a valid ordinary symbol or literal.
Operation code attribute (O')
The operation code attribute shows whether a given operation code has been
defined prior to the attribute reference. The operation code can be represented by a
character string or by a variable symbol containing a character string. The variable
must be set using a SETC assembler instruction prior to being referenced by the
operation code (O') attribute.
The operation code attribute has a value of a single alphabetic character that shows
the type of operation represented.
This attribute reference can be used in the operand field of the SETC instruction or
as one of the values used in the operand field of a SETB or AIF instruction.
The following letters are used for the value of the operation code attribute:
A
Assembler operation code
E
Extended mnemonic operation code
M
Macro definition
O
Machine operation code
S
Macro definition found in library
338
HLASM V1R6 Language Reference
U
Undefined, unknown, unassigned, or deleted operation code
Notes:
1. The operation code (O') attribute can only be used in a conditional assembly
statement.
2. The assembler does not enter lookahead mode to resolve the operation code
type, therefore only operation codes defined at the time the attribute is
referenced return an operation code type value other than U.
3. When the operation code is not an assembler instruction or a machine
instruction, and the operation code is not a previously defined macro, then all
libraries in the library data set definition list are searched. This might have an
adverse impact on the performance of the assembly, depending on the number
of libraries assigned in the assembly job and the number of times the operation
code attribute is used.
Examples:
Name
Operation
Operand
&A
SETC
O’MVC
&A contains the letter O, because MVC is a machine operation code:
Name
Operation
Operand
&A
SETC
’DROP’
&B
SETC
O’&A
&B contains the letter A, because DROP is an assembler operation code.
The following example checks to see if the macro MAC1 is defined. If not, the
MAC1 macro instruction is bypassed. This prevents the assembly from failing
when the macro is not available.
Name
Operation
Operand
&CHECKIT SETC
O’MAC1
AIF
(’&CHECKIT’ EQ ’U’).NOMAC
MAC1
.NOMAC
ANOP
Redefined Operation Codes: If an operation code is redefined using the OPSYN
instruction then the value returned by a subsequent operation code attribute
reference represents the new operation code. If the operation code is deleted using
the OPSYN instruction then the value returned is U.
Sequence symbols
You can use a sequence symbol in the name field of a statement to branch to that
statement during conditional assembly processing, thus altering the sequence in
which the assembler processes your conditional assembly and macro instructions.
You can select the model statements from which the assembler generates assembler
language statements for processing at assembly time.
A sequence symbol consists of a period (.) followed by an alphabetic character,
followed by 0 to 61 alphanumeric characters.
Examples:
Chapter 9. How to write conditional assembly instructions
339
.BRANCHING_LABEL#1
.A
Sequence symbols can be specified in the name field of assembler language
statements and model statements; however, sequence symbols must not be used as
name entries in the following assembler instructions:
ALIAS
EQU
OPSYN
SETC
AREAD
ICTL
SETA
SETAF
CATTR
LOCTR
SETB
SETCF
DXD
Also, sequence symbols cannot be used as name entries in macro prototype
instructions, or in any instruction that already contains an ordinary or a variable
symbol in the name field.
Sequence symbols can be specified in the operand field of an AIF or AGO
instruction to branch to a statement with the same sequence symbol as a label.
Scope: A sequence symbol has a local scope. Thus, if a sequence symbol is used in
an AIF or an AGO instruction, the sequence symbol must be defined as a
label in the same part of the program in which the AIF or AGO instruction
appears; that is, in the same macro definition or in open code.
Symbolic Parameters:
If a sequence symbol appears in the name field of a macro instruction, and
the corresponding prototype statement contains a symbolic parameter in
the name field, the sequence symbol does not replace the symbolic
parameter wherever it is used in the macro definition. The value of the
symbolic parameter is a null character string.
Example:
MACRO
&NAME
MOVE
&TO,&FROM
Statement 1
&NAME
ST
2,SAVEAREA
Statement 2
L
2,&FROM
ST
2,&TO
L
2,SAVEAREA
MEND
------------------------------------------------------------------
.SYM
MOVE
FIELDA,FIELDB
Statement 3
------------------------------------------------------------------
+
ST
2,SAVEAREA
Statement 4
+
L
2,FIELDB
+
ST
2,FIELDA
+
L
2,SAVEAREA
The symbolic parameter &NAME is used in the name field of the prototype
statement (Statement 1) and the first model statement (Statement 2). In the
macro instruction (Statement 3), a sequence symbol (.SYM) corresponds to
the symbolic parameter &NAME. &NAME is not replaced by .SYM and, therefore,
the generated statement (Statement 4) does not contain an entry in the
name field.
Lookahead
Symbol attributes are established in either definition mode or lookahead mode.
340
HLASM V1R6 Language Reference
|
|