Exit states cannot be set across server
procedures. This becomes a major impediment in the following cases:
·
Server wants to return an error message
to client by means of an exit state
Note: COOL:Gen allows exit states to be
passed across procedures. But this practice is not valid for earlier versions
Best Practice:
Every client and server procedure does
the following:
·
In the beginning USE an init action
block
·
Just before exit USE an exit action
block
The client procedure looks like:
Import Views:
Export Views:
Local Views:
USE client_init_action_block ...
...
...
USE client_exit_action_block...
The server procedure looks like:
Import Views:
Export Views:
Local Views:
USE server_init_action_block ...
...
...
USE server_exit_action_block...
The client_init_action_block contains code as follows:
CASE of
exit_state_code
CASE 0
Set
exit_state as exit_state_a
CASE 1
Set
exit_state as exit_state_b
...
END CASE
The client_exit_action_block contains code as follows:
Move all import views to export views
The server_init_action_block contains code as follows:
Move all import views to export views
The server_exit_action_block contains code as follows:
CASE of exit_state
CASE exit_state_a
Set
exit_state_code to 0
CASE exit_state_b
Set
exit_state_code to 1
...
END CASE
Exit state is return_to_client
Note: return_to_client is the exit state to
transfer control to the client from the server. If a rollback is to be done,
then exit state is set to return_to_client_rb which has the rollback attached
to it.