Operation extenders provide a method to modify the behavior of the operation code. Note: All RPG IV operation codes that support resulting indicator 2—the error indicator—also support the E operation extender. Table 5.7 lists the operation extenders and their purposes.
Operation Extender | Description |
---|---|
A | Always Dump. Cause the DUMP operation code to function even when the DUMP (*YES) keyword is not specified on the Header specification. |
D | Test Date. Check the result field for a valid date (TEST opcode). |
D | Operand Descriptor. Generates descriptive information about each parameter passed to the called procedure (CALLB opcode). |
E | Error Event. This operation extender is used with operation codes that support error trapping. In traditional RPG III, resulting indicator 2 is used to signal that an error has occurred. In RPG IV, specifying the E operation extender allows the error event to be signaled via the %STATUS and %ERROR built-in functions. When the E operation extender is used, resulting indicator 2 is not required. If the E operation extender is not specified, the state of %ERROR and %STATUS does not change. |
H | Half-Adjust. Used to round the result up to the nearest decimal value. This is accomplished by adding 5*10-(n+1) to the absolute value of the result. Where n = number of decimal positions. For a DEC (5,2) field, the following applies: 1.006 half-adjust to 1.01 -1.006 half-adjust to -1.01 |
M | Maximum Digits. When computing numeric result values, the maximum number of allowable digits is used for intermediate result values. This is default behavior. |
N | Read without Locking. Used when accessing database records from files that are opened for update. This operation extender allows records to be read, but does not place a lock on the record (database input opcodes only). |
N | Set pointer to *NULL. Used with the DEALLOC operation code to cause *NULL (X'00) to move moved into the pointer specified on the Result field (DEALLOC opcode only). |
P | Pad Result. Used to replace the data in the result field. The P operation extender allows a single operation to replace the contents of the result field. For character fields, blanks are used to pad the result. For numeric fields, zeros are used. |
R | Result Field Digits. When computing numeric result values, the result field's decimal positions are used for the intermediate result values for the expression. |
T | Test Time. Check the result field for a valid time. |
Z | Test Timestamp. Check the result field for a valid timestamp. |