Previous Topic: Explicit SubscriptingNext Topic: Design Block Mode Presentation Logic


External Action Blocks

A procedure may need sometimes to make use of logic that is not defined using CA Gen. For example, you may wish to use an installation standard date manipulation routine that takes into account its own holidays and work schedules.

In another case, you may need to access data bases and files that are not yet supported by CA Gen. Access to logic not originally specified using CA Gen is achieved by using External Action Blocks.

An external action block is an action block that has only three components:

An external action block contains no action statements of its own.

The designation external on the action block definition indicates that a non-CA Gen-generated program will be used to obtain the data for the action block's export view.

Action blocks of this sort can be the object of a USE statement in normal Procedure Action Diagrams or Blocks.

During construction, CA Gen ensures that the program referenced by the external action block is properly referenced by CA Gen-generated programs.

The following sample code illustrates a CA Gen-defined Procedure Action Diagram that references an external date manipulation routine called Date Services:

Procedure Action Block Referencing an External Action

WHILE restart work restart_count IS LESS THAN target work restart count
AND returned work request_type IS NOT EQUAL TO E
SET restart work restart_count TO restart work restart_count + 1
USE get_transaction
     WHICH EXPORTS:  Work View returned work
                     Entity View returned customer
NOTE
     ... NOW, you must be positioned at the first customer transaction not 
     yet processed. If this is not a restarted execution, that will be the 
     first transaction on the input file; if it IS a restart, it will be the   
     transaction right after the last one for which a commit took place.

WHILE commit_ief_supplied count IS LESS THAN 100
AND returned work request_type IS NOT EQUAL TO E
EXIT STATE IS requested_operation_complete
SET message work result TO OPERATION COMPLETED
NOTE
     CREATE CUSTOMER, UPDATE CUSTOMER, and DELETE CUSTOMER are
     Elementary Processes for which Process Action
     Diagrams were created during BAA.
CASE OF returned work request_type
CASE A
USE create_customer
     WHICH IMPORTS: Entity View returned customer
     IF EXIT STATE IS NOT EQUAL TO requested_operation_complete
     SET message work result TO NOT ADDED
CASE C
USE update_customer
     WHICH IMPORTS: Entity View returned customer
     IF EXIT STATE IS NOT EQUAL TO requested_operation_complete
     SET message work result TO NOT CHANGED
CASE D
...

The following sample code shows the external action block definition of the Date Services routine:

External Action Block for Date Services

DATE_SERVICES
     IMPORTS: Entity View incoming work date
              Entity View incoming work request
     EXPORTS: Entity View exported work status
EXTERNAL