PRODAMP recognizes the following three data types:
the numeric data type with a length of 1 to 4 bytes,
the string with a length of 1 to 133 bytes and
the bit pattern with a length of 1 to 4 bytes.
The numeric data type with a length of 4 bytes is the only numeric data type used for variables and constants and is simply referred to as a numeric data type. It can hold an integer in the range -2147483648 to +2147483647. The integer -2147483648 is accepted as a literal only in the hexadecimal form (X'80000000').
This data type is also used for addressing diagnostic data. Note that only the first 31 bits are used to construct addresses of /390 objects; all 32 bits are used for x86 objects.
The addressing mode is an HSI-dependent constant for PRODAMP.
The numeric data types with a length of 1 to 3 occur with symbols only and constitute the numeric interpretation of fields 1 to 3 bytes in length. For numeric data types with a length of 2, the contents are interpreted as a signed number (halfword arithmetic).
Numeric literals may be specified in decimal or hexadecimal format.
Examples
123 -1234 X'0AFFE'
The string is used to represent character strings enclosed in apostrophes. Two consecutive apostrophes are used to represent a single apostrophe within a string. The maximum length of a string in PRODAMP is 133 characters. If a string contains nonprintable characters, it can be declared as a hexadecimal string. In this case, the Pascal convention of using the string #' as the left-hand delimiter and the apostrophe ' as the righthand delimiter is used.
Examples
'1' 'Long string literal', 'Value: X''01''', #'C100C600C600C500';
Bit patterns are data items with a length of 1 to 4 bytes in which each individual bit can be addressed. Bit pattern literals are defined either in binary (up to one byte long) or in hexadecimal form. The notation for binary definition is the same as for Assembler. For hexadecimal notation, the string P' is used as the left-hand delimiter and the apostrophe ' as the right-hand delimiter in order to avoid confusion with hexadecimal numeric literals.
PRODAMP also has the symbolic bit pattern constants TRUE and FALSE.
Examples
B'10101001' corresponds to P'A9' TRUE corresponds to P'01' or B'1' FALSE corresponds to P'00' or B'0'
Compatibility of data types
The following table shows the permissible type mixtures for assignments (see "Statements") and comparison operations.
|
|
*) | The entries in this line apply only to assignments. For comparisons, the operands may have to be regrouped to ensure that the left-hand operand is not “undefined”. |
The basic rule is: the type of an expression is determined by the type of the first term.
For assignments, “left” denotes the variable to the left of the assignment operator and “right” denotes the expression to the right of this operator. The field at the intersection point shows whether the assignment is permitted or prohibited and specifies the result type (the latter is interesting only if the type was previously undefined).
For comparison operations, “left” denotes the expression to the left of the comparison operator and “right” denotes the expression to the right of this operator. The field at the intersection point shows whether the comparison is permitted and how it should be interpreted.
(For an arithmetical comparison, for instance, the operator “IN” is prohibited.)
In expressions, types may be mixed in only two ways:
<numeric><operator><bit pattern> | (results in a numeric) and |
In the second case, only the operator “*
” is accepted (for string replication). Expressions in which the first term is undefined receive the type “numeric”.
Symbols are always “undefined” because the symbol file is accessed only when the procedure is executed. This can lead to undesired results, as shown in the following example.
Example
Let us assume you are interested in the rightmost bit in field EXVTAUDI. You thus want to mask out the high-order bits and write:
MY_BITS:=.EXVTAUDI-P'FE';
IF MY_BITS=P'01' THEN
In this case, EXVTAUDI is set to arithmetic, the bit pattern literal is also interpreted as arithmetic and the result in MY_BITS is either the arithmetical value -253 (X'FFFFFF03') if the bit is set or -254 if it is not set. The following IF statement is accepted by the compiler, because it regards MY_BITS as arithmetic and therefore converts the bit pattern to arithmetic again (see table 9). However, this was not what you wanted.
To get what you actually wanted you have to enter
MY_BITS:=P'0'+.EXVTAUDI-P'FE';
IF MY_BITS=P'01' THEN
Alternatively, you can initialize variables to ensure that the correct operations are generated when symbols are used.
In order to access the diagnosis object via symbols whose types are not known at compilation time, it is thus necessary to consider all the implications if you want to avoid unpleasant surprises. Systematically assigning all diagnostic data to initialized variables is one way of avoiding such problems.
The following table shows how the data types contained in the symbol files in the form of LSD codes (Assembler data types) are converted into the data types used by PRODAMP.
LSD | Ass. | Data | PRODAMP | Data | ||||
00 | C | n |
| Character | ||||
06 | H | 2 | NUMERIC | Signed binary | ||||
0A | Y | 2 | PATTERN | Unsigned binary | ||||
0A |
| 1 - 3 | PATTERN |
|