EXPROPTS(*MAXDIGITS | *RESDECPOS | *ALWBLANKNUM | *USEDECEDIT)
The EXPROPTS keyword controls options related to expressions.
- *MAXDIGITS and *RESDECPOS
- You specify the *MAXDIGITS or *RESDECPOS values to control the type of precision
rules to be used for an entire program.
- Only one of *MAXDIGITS and *RESDECPOS can be specified. If neither one is specified, *MAXDIGITS is assumed.
- If *MAXDIGITS is specified or assumed, the default precision rules apply.
- If *RESDECPOS is specified, the "Result Decimal Position" precision rules apply and force intermediate results in expressions to have no fewer decimal positions than the result.
Note: Operation code extenders R and M are the same as EXPROPTS(*RESDECPOS) and EXPROPTS(*MAXDIGITS) respectively, but for single free-form expressions. - *ALWBLANKNUM
-
When *ALWBLANKNUM is specified, and the character operand of %DEC, %DECH, %FLOAT, %INT, %INTH, %UNS, or %UNSH is
blank or empty, the result is zero.
For XML-INTO and DATA-INTO, if the value provided for a numeric field is blank or empty, zero will be placed
in the field.
When *ALWBLANKNUM is not specified, a blank operand is considered to be an error.
- *USEDECEDIT
- When *USEDECEDIT is specified, the decimal point and digit separator characters specified by
the DECEDIT keyword are used when interpreting a character operand for %DEC, %DECH, %FLOAT, %INT, %INTH, %UNS, or %UNSH
and when interpreting numeric data for XML-INTO and DATA-INTO.
See Rules for converting character values to numeric values using built-in functions.
When *USEDECEDIT is not specified, the comma and period are both considered to represent a decimal point, and digit separators are not allowed.
- *STRICTKEYS
- *STRICTKEYS affects the rules for the search arguments specified by a list of keys or %KDS for keyed file operations.
- When *STRICTKEYS is not specified, a search argument must have the same data type as the key in the file, but the search argument can have any length or CCSID.
- When *STRICTKEYS is specified, the rules for search arguments are more strict.
When a search argument does not follow the rules, the message issued by the compiler has a reason code.
- For UCS-2 and graphic key fields, the CCSID of the search argument must be the same as the CCSID of the key. Reason code: CCSID.
- For character key fields:
- If DATA(*NOCVT) is in effect for the file, the CCSID of the search argument must be the same as the CCSID of the key. Reason code: CCSID.
- Otherwise, the CCSID of the search argument must be the job CCSID. Reason code: CCSID-NOT-JOB.
- The defined length of the search argument must be less than or equal to the defined length of the key. Reason code: LEN.
- For numeric key fields:
- The number of decimal positions of the search argument must be less than or equal to the number of decimal positions of the key. Reason code: DECIMALS.
- The number of integer positions of the search argument must be less than or equal to the number of integer positions of the key. Reason code: INTEGERS.
- The length of a float search argument must be less than or equal to the length of the key. Reason code: LEN.
- If either the key or the search argument is float, they both must be float. Reason code: FLOAT.
- The length of a timestamp search argument must be less than or equal to the length of the key. Reason code: LEN.
- The year range of a date search argument must be within the year range of the date format of the key. Reason code: DATFMT-YEARS.
- A time search argument with format *USA is only valid when the format of the key is also *USA. Reason code: TIMFMT-USA.
For example, the key for file MYFILE has type PACKED(5:2). Consider the following program:DCL-S price INT(5); price = 1234; CHAIN (price) MYFILE;
- If EXPROPTS(*STRICTKEYS) is not specified, the CHAIN operation is allowed, but it would fail with a numeric overflow error at runtime because the value 1234 cannot be assigned to a PACKED(5:2) value.
- If EXPROPTS(*STRICTKEYS) is specified, the compile fails with reason code INTEGERS because variable price can have up to five integer places, while the PACKED(5:2) key can only have up to three integer places.