Previous Topic: Review Generated PAD for UPDATENext Topic: Review Generated PAD for LIST


Review Generated PAD for DELETE

The generated delete Action Diagram reads each occurrence of the subject entity type and removes it from the database. It also contains READ statements for each related entity type that you have specified.

The following example shows a generated Process Action Diagram for DELETE CUSTOMER. The following example is a DELETE CUSTOMER Generated Process Action Diagram:

DELETE_CUSTOMER
IMPORTS: Entity View import customer
EXPORTS: Entity View export customer
LOCAL:
ENTITY ACTIONS: Entity View customer
READ customer
WHERE DESIRED customer number IS EQUAL TO input
customer number
WHEN successful
MOVE customer TO output customer
DELETE customer
WHEN not found

In this example, import, export, and entity action views are views of the subject entity type. The attribute view is the identifying attribute of the subject entity type.

If the read of the subject entity type is successful, the Action Diagram moves all attributes of the subject entity type CUSTOMER to the output view and deletes them.

The Action Diagram contains two entity actions, a read and a delete. The read has two branches for exception logic: WHEN successful and WHEN not found. If the read of the subject entity type is successful, the entity action view indicated in the MOVE statement following the WHEN successful branch is moved to output and deleted. Before the export view is deleted from the database, you may want to archive the data, perhaps on tape. If so, add an external action block for this purpose during Design.

If the subject entity type references an entity of another type, the generated delete also builds the necessary views for the related entity type and adds a WHERE clause to the basic READ statement.

As always, a delete action deletes all entity types paired with the subject entity type by a mandatory relationship. For example, if you delete occurrences of INVOICE, all associated occurrences of INVOICE LINE are also deleted.