THEN DELETE
You can specify the THEN DELETE directive at the source reference level in the IMPORT SOURCE statement, rather than within dataset definitions.
By specifying the delete operation at the source level, you apply the delete operations earlier in the data pipeline, directly at the source level, ensuring that deletions are processed as soon as the source data is imported.
Hard Delete
THEN DELETE directive to the source reference in the import statement. It ensures that records marked for deletion in the source dataset are excluded during the import process. IMPORT SOURCE SALES_LOG FILTEREDBY (ACTION = 'D') AS SALES_DEL;
IMPORT SOURCE SALES THEN DELETE SALES_DEL [SALES_ID] MATCHING [SALES_ID];In this example, deletions are applied immediately when the SALES dataset is imported, based on the SALES_DEL dataset, which contains the records marked for deletion.
Soft Delete
You apply the THEN DELETE deletion logic after the data has been imported. The soft delete process executes, based on a list of records that you provide in the THEN DELETE directive. This method allows for the deletion to be handled separately from the import process, while still ensuring that deleted records are flagged in the dataset.
IMPORT SOURCE SALESDEL
IMPORT SOURCE SALES DELETETYPE[SOFT] THEN DELETE [SALESDEL[SALES_ID] MATCHING [SALES_ID]]
DEFINE DATASET SALES_SD_F FROM SALES END
In this example, the SALESDEL dataset, which contains deletion records, is used in conjunction with the THEN DELETE directive. Records from SALES that match the IDs in SALESDEL are flagged as deleted, based on the DELETETYPE[SOFT] directive