Error messages in Servers
A Business Component implements the services that are associated with a Logical View. As it runs the service, it can detect errors. In this case, it must send the error information in its reply message to the client so that the client can take the appropriate action.
Principle
The following two types of errors
are possible:
- Standard errors that are detected after the standard accesses to Segments or the validation of the Logical View data. You can modify the messages that are associated with these errors.
- Specific errors that correspond to errors you describe with specific code.
When a Business Component detects an error, it performs a ROLLBACK before it sends back the reply with the errors. It gives the control back to the client without calling the next Business Component.
Implementation
- Enter the following options on O-type lines,
in the -GO Lines of the following entities:
- ACCESERR and DATAERR in the Business Component. These two options define the number of errors that the Business Component can detect before giving the control back to the calling program.
- ACCESERR, DATAERR, ERRLAB and ERRSERV in the Server Dialog for single-view development.
- Describe, in each Business Component and Logical View, the error
messages that are associated with the errors specified with specific
code. These errors correspond to the errors that are indicated in
the Business Component with the ERU (user error), ERR (error
on Data Element) or ERL (logical lock or unlock
error) micropatterns. You indicate the messages that are associated
with these errors on U-type lines in the -GE
Lines of the following entities:
- Business Component for the errors specified with ERU or ERL,
- Logical View for the errors on specified with ERR.
Note: You can also modify the messages that are associated with standard errors. These errors are detected after standard accesses to Segments or checks on Logical View data. - Create and describe the error message server to access the error
message file.To process the errors, the following four variables are generated in the WORKING-STORAGE SECTION of the Business Component:
- IER: Number of errors on Segment access, which is initialized by the ACCESERR option
- IED: Number of errors on Data Element, which is initialized by the DATAERR option
- K50L: Work index of the number of errors on Segment access
- K50D: Work index of the number of errors on Data Element
You must then generate the error messages. To do so, you must create an Error Message instance and associate it with the Dialog. The Error Message instance groups the generation options of the error messages for this Dialog. You must then generate the Error Message instance.
The generated file is a sequential file from which you create the error message file for your application, with the appropriate organization (relational table, VSAM file for example). An error message file includes 100-character records whose structure contains the following elements:- An access key (ERKEY, 29 characters)
- A code for the severity of the error (one character: E for error, W for warning)
- The message itself