1. Find many more at website: www.go4as400.com
A programming guide to learn AS400
%ERROR
If an 'E' operation code extender is present on the calculation specification and error indicator is not present
then the error occurred will be handled by this operator extender ‘E’.
The errors in this case are identified using the function %ERROR built-in function.
But this operator extender’s use is limited only to the op-codes listed below:
ACQ
ADDDUR
ALLOC
CALL
CALLB
CALLP
CHAIN
CHECK
CHECKR
CLOSE
COMMIT
DEALLOC
DELETE
DSPLY
EXFMT
EXTRCT
FEOD
IN
OCCUR
OPEN
NEXT
OUT
POST
READ
RAEDE
READP
READPE
REL
RESET
ROLBK
REALLOC
SCAN
SETGT
SETLL
SUBDUR
SUBST
TEST
UNLOCK
UPDATE
WRITE
XLATE
XML-INTO
XML-SAX
The error will be handled using the built-in functions %STATUS and %ERROR.
Control resumes with the next ILE RPG operation.
Example – I
ERROR HANDLING USING E-OPERATOR EXTENDER BUT NOT HANDLING ERROR WITH %ERROR
Columns . . . :
6 80
AMITCC/QRPGLESRC
SEU==>
E_OP_EXTN3
FMT H HKeywords++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
*************** Beginning of data *************************************************
0001.00 HOPTION(*SRCSTMT)
130122
0002.00 FCUST
UF A E
DISK
USROPN
130122
0003.00
130121
0006.00 C
1
SETLL(E) CUSTR
130123
0008.00 C
EVAL
CSNAME='AMI'
130123
0009.00 C
UPDATE(E) CUSTR
130122
0011.00 C
SETON
LR
130122
****************** End of data ******************************************************
OUTPUT
Here you won't get any error but there will be logical error i.e. file CUST will not get updated.
2. Example – II
ERROR HANDLING USING E-OPERATOR EXTENDER AND WITH %ERROR BUILT-IN FUNCTION
Find many more at website: www.go4as400.com
A programming guide to learn AS400