ADS supports error handling for assignment and arithmetic commands. This allows an application to handle errors such as data exception or decimal overflow rather than forcing ADS to abort the dialog execution. An ALLOWING clause specifies which error condition a dialog is prepared to handle.
Assignment Command Status Condition
The following condition names can be specified as assignment command status conditions in ALLOWING clauses:
Specifying ANY-DATA-ERROR allows a dialog to retain control following any error condition. After an exception condition is encountered, the data will be returned as if the command had never been attempted. The meaning of the exception conditions are defined in the IBM Principles of Operations Manual.
Example
The following example shows how the ALLOWING clause can be used to prevent application abends. The specified MOVE command moves a numeric field from an eight-byte field to a four-byte field. The application must be prepared to handle any error condition that might arise.
MOVE big-num TO little-num ALLOWING ANY-DATA-ERROR. IF DECIMAL-OVERFLOW-EXCEPTION DISPLAY ERROR MESSAGE TEXT 'SOURCE DATA TOO LARGE'. IF ANY-DATA-ERROR DISPLAY ERROR MESSAGE TEXT 'INVALID DATA VALUE'.
|
Copyright © 2014 CA.
All rights reserved.
|
|