Although you can code only one error procedure in the program, that single procedure can evaluate and handle several types of errors. The following code segment uses a SELECT construct to distinguish error handling for several errors:
<<ERROR>> PROCEDURE
SELECT $ERROR-CLASS
WHEN 'DVW'
SET $RC = 1660
LIST $ERROR-DVW-DBID
LIST $ERROR-DVW-STATUS
LIST $ERROR-DVW-INTERNAL-STATUS
WHEN 'NUM'
SET $RC = 8
PROCESS NEXT MAIN-LOOP
WHEN OTHER
SET $RC = 12
ENDSELECT
SET WOR‑NUM = $RC
NOTIFY 'Program Abending - ' WOR‑NUM
LIST ERROR
BACKOUT
QUIT RUN
ENDPROC
In this example, if $ERROR‑CLASS is NUM, the program can recover; otherwise, the program terminates. The value of the $RC is either 1660, indicating a dataview error, or 12, indicating some other error. By testing for other $ERROR‑CLASS values, you can set the $RC to reflect the error condition encountered.
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|