The documentation updates provided here only cover the changes introduced in Natural Optimizer Compiler Version 8.3 and Version 8.4.
This is an extract of the chapter Optimizer Options and only describes the changes specific to the Natural Optimizer Compiler Version 8.3 and Version 8.4.
ARCH option specifies the hardware architecture
level to be used for generating code for executable Natural objects.
When you specify an
ARCH value, the Natural
Optimizer Compiler generates newer and faster machine instructions that can
improve the performance of the generated code. You cannot specify a value that
is higher than the architecture level of your current machine. An executable
Natural object cataloged with an
ARCH level can only run on a
machine with the same or a higher architecture level. Therefore, we recommend
not to use the
ARCH option if the cataloged objects are intended
to execute on any machine, especially on a machine with a lower architecture
level (for example, BS2000).
For detailed information on architecture levels, see the related literature from IBM (z/Architecture, Principles of Operation).
The following architecture levels are supported by the
ARCH option of the Natural Optimizer Compiler:
|Architecture Level||IBM Hardware Facility Required|
||Specifies that no architecture level is used. This is the default setting for compatibility with all mainframe platforms supported by Natural.|
||These values are not evaluated and
||(Applies to Natural Optimizer
Compiler Version 8.4 and above only.)
ARCH value greater zero, the Natural
Optimizer Compiler generates instructions up to the facility level described in
the table above. An
ARCH value higher than the architecture level
of the underlying machine is rejected at compile time. The attempt to start a
program compiled with an
ARCH level on a machine with a lower
architecture level, causes a NAT1394 runtime error. You
can display information on the current machine by using the
This section covers the following topics:
ARCH=10 is set, the Natural Optimizer
Compiler generates instructions provided by the Decimal-Floating-Point (DFP)
Zoned-Conversion Facility for the numeric operations described in the following
section. This can significantly improve the execution speed for statements that
use these operations.
- Operations Optimized by ARCH=10
The following arithmetic operations on variables of the Natural data formats I (integer), N (numeric unpacked) and P (packed numeric) benefit from
N:=Ponly if the number of packed digits is less than or equal to 15.
Arithmetic operations, such as
MULTIPLYstatements, but only if both of the following conditions apply:
At least one of the operands used is in the format N or I.
The operation result does not exceed 34 (integer + precision) digits.
Comparisons, such as
DECIDEstatements, but only if both of the following conditions apply:
At least one of the operands used is in the format N.
Both operands are in different formats.
ARCH=11 is set, the Natural Optimizer
Compiler uses machine instructions introduced with the DFP Packed-Conversion
Facility. In addition to the numeric operations optimized with
ARCH=11 also optimizes operations that use packed variables
Applies to Natural Optimizer Compiler Version 8.4 and above only.
ARCH=12 is set, the Natural Optimizer
Compiler generates machine instructions introduced with the Vector
Packed-Decimal Facility (VPD) in the z14 hardware class. This can improve the
execution speed for assignments, comparisons, and calculations if at least one
packed operand is used.
VPD machine instructions are generated for the same Natural operations described for Architecture Level 11, except they are applied only to arithmetic operations whose results do not exceed 31 (integer + precision) digits.
ARCH=10 is used, the Natural Optimizer
Compiler generates machine instructions introduced with the
Decimal-Floating-Point (DFP) Zoned-Conversion Facility or the DFP
Packed-Conversion Facility. These instructions execute faster than the standard
machine code instructions for arithmetic operations, but they do not accept
data which is improper in terms of the zoned numeric data type (N).
This may cause runtime errors, when an N-field is defined
REDEFINE section of an alpha or binary variable and the
N-field is not properly initialized before used in an arithmetic operation.
A numeric zoned field carries one digit in one byte. Usually, each byte contains x’F’ in the left halfbyte (Zone bits) and the digit value (0-9) in the right halfbyte (Numeric bits). This applies for all bytes, except for the last one, which contains (A-F) in the left halfbyte (Sign bits).
A sign halfbyte (C,A,F,E) represents a positive value, whereas (B,D) stands for a negative value. A value other than (0-9) inside the numeric halfbytes (N) and a value other than (A-F) inside the sign halfbyte (S) is considered invalid. The data inside the zone halfbytes (Z) is not regarded by arithmetic conversion instructions and can have any value (0-F).
Example for a variable defined as (N6):
|ZN||ZN||ZN||ZN||ZN||SN||Sign is||Value is||Works with
ARCH=9 (or lower) is used, invalid sign
halfbytes (0-9) are automatically corrected by the generated code to a positive
sign (F). This turns N-fields with a blank contents into valid data with value
zero. The same applies for Hexa zero data.
ARCH=10 (or 11) is used, invalid sign
halfbytes (0-9) remain unchanged and lead to a program check (Data exception)
when accessed by a DFP instruction. If such an abend occurs, Natural issues a
error instead of a NAT0954
to clearly indicate that the error is caused by an N-variable that does not
contain valid numeric data.
If a numeric halfbyte (N) contains a value other than (0-9), a program check (Data exception) happens regardless of the ARCH level used.
Do not use
ARCH=10 (or 11) to catalog a program
which operates unclean numeric data, with a sign value other than (A-F).
OPTIONS MCG=(PGEN,ARCH=9) DEFINE DATA LOCAL 1 #A (A6) 1 REDEFINE #A 2 #N (N6) END-DEFINE /* ARCH=9 ARCH=10 #A := H'F1F2F3F4F5F6' ADD 1 TO #N WRITE #N /* ok ok #A := H'F3F2F6F3F3D2' ADD 1 TO #N WRITE #N /* ok ok #A := H'404040404040' ADD 1 TO #N WRITE #N /* ok NAT7024 #A := H'000000000000' ADD 1 TO #N WRITE #N /* ok NAT7024 #A := H'121314151617' ADD 1 TO #N WRITE #N /* ok NAT7024 #A := H'516B727A12F1' ADD 1 TO #N WRITE #N /* NAT0954 NAT7024 END
ARCH=10 (or 11) is used, Natural
can issue a NAT1305
(truncated numeric value) instead of a
error (intermediate result too large) for the following reason: The DFP numeric
format is used for calculating intermediate results and an overflow is only
detected at the end of the arithmetic operation when the DFP is converted into
the format of the result.
ARCH=12 is used, the Natural Optimizer
Compiler generates machine instructions introduced with the Vector
Packed-Decimal Facility (VPD) which are compatible in terms of data
incorrectness with the code generated with
ARCH=9 or below.
Numeric data fields (N) with incorrect sign representations (0-9) are converted into the positive sign value (F). This accepts numeric fields with a blank or hex00 content and treats them as value zero. A data exception (abend) does not occur in these cases.
The Natural Optimizer Compiler generates optimized code for Natural statements with Unicode strings if the following requirements are met:
|All statements||All operands used in the statement must be of the type Unicode.|
UNICC option controls the generation of
optimized code for
DECIDE FOR and
ON statements that contain Unicode operands.
Valid values for
||Generates optimized code and checks
||Generates optimized code analogous to
The code optimized with
||Optimized code is not generated.