Functions are available to determine the category of the error that was encountered. For example, $ERROR‑CLASS returns the classification of the error, such as NUM for numeric, DVW for dataview, PGM for program, SYS for system, and FTL for fatal. SYS (system) and FTL (fatal) errors always execute the default error procedure and terminate the run.
The following example tests $ERROR‑CLASS for NUM. NUM is set when a numeric field contains an invalid numeric value. If $ERROR‑CLASS is NUM, the return code is set to 8. Since recovery is possible, the program continues with the next iteration of a processing loop.
<<ERROR>> PROCEDURE
SELECT $ERROR‑CLASS
WHEN 'NUM'
SET $RC = 8
PROCESS NEXT MAIN‑LOOP
WHEN OTHER
SET $RC = 12
ENDSELECT
LIST ERROR
BACKOUT
QUIT RUN
ENDPROC
|
Copyright © 2015 CA Technologies.
All rights reserved.
|
|