How do the Utility Load Models(LOAD and FLOAD) handle referential integrity checking?

Document ID : KB000054641
Last Modified Date : 14/02/2018
Show Technical Document Details

Description:

The %ENFORCE automatic variable has always been present in the RC/Migrator IBM LOAD model.

This is a copy of the MODEL source line showing it in the LOAD syntax line.
LOAD DATA INDDN PTILOAD RESUME %RESUME LOG %LOG %ENFORCE %UNICODE

This variable resolves to a different value depending on the situation that it is faced with for a given table.
A reference to it can be found in the RC/Migrator User Guide: Chapter 4, Expert Profile, Utility Model Services, Conditional Automatic Symbols for All Objects.

The FAST LOAD(FLOAD) model works differently.

Solution:

The IBM LOAD(LOAD) model uses the %ENFORCE variable which normally resolves to "ENFORCE CONSTRAINTS" as it's loading because normally a PARENT table is being loaded or, after the PARENT, a CHILD table will be loaded and during the load the foreign keys on the CHILD are checked.

When a recursive RI relationship(PARENT is a CHILD of itself) is present, the relationships from the table to itself can?t be checked till after the records are loaded so the load must use "ENFORCE NO" and then CHECK DATA utilities are executed on the tablespace at the end in order to verify the RI to itself. It might also generate FAST CHECK code if the user activates the FAST CHECK Model member instead of the IBM Check Data. Fast Check will work if it is available to the user. Where "ENFORCE CONSTRAINTS" has been used during the load, no additional CHECK utility is generated for that specific tablespace as the RI Check has been done already.

The FAST LOAD(FLOAD) model does not use %ENFORCE. Fast Load is able to validate RI with the use of FAST CHECK if the customer has purchased it. However the RC/Migrator model FLOAD does not generate the code to ENFORCE CONSTRAINTS. Instead it loads the records, set?s the tablespace to Check Pending and uses either the IBM Check Data or Fast Check to validate the RI after the load. Fast Check can only be used if it's available to the user.