Operation codes that allow an error Indicator (ERR parameter in Free Format) also allow the OPCODE(E) operation code extender in RPG/400 Fixed Format.
If an error indicator, or an ‘E’ extender is coded on an operation, but the error which occurs is not related to that operation, any error indicator, or ‘E’ extender would be ignored, and the error would be treated like any other program error.
RPG/400 Fixed Format:
To enable the ‘E’ operation code extender handler, specify an ‘E’ (or ‘e’) after any of the op codes that are specified in the link at the bottom of this topic. You can also refer to the list of Operation Extenders and look at the op codes with the ‘E’ extender.
Coding the ‘E’ extender affects the value returned by the built-in function %ERROR. Before the operation begins, the value returned by this function is set to zero. If an exception occurs on the operation, the return values for the %Error function are updated accordingly, the appropriate data structure is updated, and control returns to the next sequential instruction. You can then use this function to test the returned values and determine what action to take. See Built-in Functions for more information.
To code the ‘E’ extender in Free Format, all op codes containing the ERR parameter can now also take a special value called *EXTENDED, which is equivalent to OPCODE(E) in RPG/400 Fixed Format.
ERR (Indicator Variable | *Extended)
The ERR parameter determines what the runtime will do if an error occurs while executing this command. The following rules apply:
ERR (Indicator Variable) - The specified Indicator is set if an error occurred.
ERR(*EXTENDED) - A program status flag is set whose status can be checked using the %ERROR built-in function. This is equivalent to coding the E extender in RPG Fixed Format (OPCODE(E)).
If the ERR keyword is not given and an error occurs, a run-time exception will be thrown, terminating the program.
Click here for a listing of the op codes that allow the ‘E’ extender in RPG Fixed Format, or allow the *Extended option with the ERR parameter,