Empty table is ignored on load when RC/Extract extract dataset contains no data
search cancel

Empty table is ignored on load when RC/Extract extract dataset contains no data

book

Article ID: 246077

calendar_today

Updated On:

Products

RC/Extract for DB2 for z/OS

Issue/Introduction

An RC/Extract for Db2 for z/OS (RCX) job was created to delete the data from several Db2 objects of a single database located in a Db2 ssid.
An empty extract dataset was generated for those Db2 objects by creating a source definition with a where-clause that resulted in zero datasets fulfilling this clause.
  
Afterwards the RC/Extract job was run to load this empty dataset into another Db2 SSID and activated the "empty table on load" parameter. It was expected to clean-up
the selected database Db2 objects by executing the Load job with empty datasets, however the Load job did not change any data in the target Db2 ssid.

Resolution

RC/Extract is working as designed in the scenario when zero rows are extracted.  Specifically the logic of the SQL Load processing relies on the presence
of extracted rows in order to activate the 'Empty Target Table Before Loading' processing.  If no rows exist in the Extract dataset, this processing will not be executed.  
This applies whether the source extract definition is utilizing Tables or Views.

There must be extracted rows for the target table deletion option to work properly.