Previous Topic: Use Flow or Remote Use and Exit StatesNext Topic: Use Server-Supplied Error Information


Use Exit States and an Action Block

The exit state and action block technique is similar to the flow or remote use and exit states technique.

The exit state and action block technique provides a robust error handling mechanism because the client can detect what has happened in the server. This mechanism can be very effective in all types of applications. It provides an application the ability to easily display messages by using the capabilities of CA Gen, and the technique lets a client procedure detect what has happened in the server.

With this technique, an error code is returned from the server to the client to indicate the results of the requested action. This is in addition to the exit state that causes the returns on flow or returning from the remote use.

The exit state is used to display the message. The returned error code is used by the client to execute action diagram logic based upon the server's results. This error code is view matched as part of the data returned on a flow or view matched with the remote use statement.

Setting exits states in the server procedure will communicate the message to the client workstation. In addition, the returns on property for the flow is defined as Execute First so that the returned error code can be evaluated.

An action block in the server can set the returned error code. The exit state set is evaluated and converted to an error code that is then returned to the client.

The conversion action block logic would consist of one large case of exit state statement with a case for every exit state. At the client procedure, the message is automatically displayed by the window manager (see the Using a Flow or Remote Use and Exit States section in this chapter). The error code returned is then evaluated in the client procedure to determine what processing may be required as a result of the server action.

The following list explains advantages of this technique:

The following list explains disadvantages of this technique: