The INVALID command is used for data cleansing purposes. This command examines source field/columns where invalid data can and frequently does exist (i.e. a character value in a numeric field), especially in IMS, VSAM and Flat File data. The command can specify individual source field/columns and/or ALL source field/columns of either numeric or character datatypes. The latter option is particularly useful for IMS and VSAM source data where numeric columns, particularly those that are packed decimal often contain invalid data.
INVALID <source_field> | <source_datastore>.<datatype> SETNULL | SETSPACE | SETZERO | SETFZERO | SET 'constant' |SETEXP | KEEP | EXCEPTION)
Keyword | Description |
---|---|
<source_field> | <source_datastore>.<datatype> |
Name of a specific source field/column, generally qualified by its description alias, that may contain invalid data for the data type as defined in the corresponding source data structure. Alternatively, a source datastore and data type ( can be specified which will result in all source fields/columns of all records read for that source datastore to be evaluated for invalid data for the data type as defined in the corresponding source data structure. |
SETNULL |
Sets the value of the source data field/column to null. |
SETSPACE |
Sets the value of the source data field/column to spaces. |
SETZERO |
Sets the value of the source data field/column to a zero (0). |
SETFZERO |
Sets the value of the source data field/column to a zero point zero (0.0) for floating point data (source description fields containing decimal places) and zero (0) for integers. |
SET |
'constant' Sets the value of the source data field/column to a the value of the constant. |
SETEXP |
Specifies that an exception should cause the Apply Engine to terminate. While the effect on processing is the same as would happen without the INVALID command being specified, it indicates that it has been previously determined that the condition cannot be resolved simply by changing the data to a predetermined the value. |
KEEP | Specifies that the value of the source data field/column will NOT be changed even if it is subject to a subsequent qualifying INVALID command. |
EXCEPTION |
Allows exceptions to the INVALID rules. For example,
Specifies that the input date can be 9999999 or 0000000 and not be set to NULL. |
Example 1:
INVALID source_description.source-field1 SETZERO;
Example 2:
INVALID CDCIN.ALLNUM SETZERO;
Example 3:
INVALID CDCIN.<segment_alias>.source-field KEEP;
Example 4:
INVALID CDCIN.<segment_alias>.source-field KEEP;