Validation of Elementary Items
The Parse Copybook Data activity requires the binary data of an elementary item to be in full compliance with its definition in a copybook by default. For example, packed decimal data can only have certain values for a sign nibble. Normally, Parse throws an error in case of a violation.
However, this behavior is customizable using the Ignore Invalid Items field on a Parse activity. This setting turns off errors resulting from invalid content in the binary data in an elementary item.
When Ignore Invalid Items is selected:
- Any malformed data is ignored and no error is thrown.
- The item is not included in the resulting JSON.
For example, this copybook defines an unsigned item:
01 ZONED-UNSIGNED PIC 99.
F1E2 (in hexadecimal form) is not valid for this copybook because E is not a valid sign nibble. If Ignore Invalid Items is not selected, this results in a failure. However, if you select Ignore Invalid Items, then the item is quietly ignored and not included in the resulting JSON. However, that parsing does not stop, and any valid items found after an erroneous one are processed and returned.
Special Cases
There are several circumstances under which Ignore Invalid Items is not in effect:
- When an invalid item is used as an object of
OCCURS DEPENDING ON clause. For example:
01 COUNT PIC 9. 01 REP PIC X OCCURS 1 TO 10 TIMES DEPENDING ON COUNT
If COUNT is invalid, Parse cannot determine the number of occurrences of REP to read. In this case, parsing fails.
-
When an invalid item is used as a control field for a REDEFINE group. The connector requires a valid control field value to determine how to proceed.
Note: There are two cases when the failure does not occur. When Allow Incomplete Records is selected and the data ends prior to the REDEFINE group. In this case Data Conversion Connector does not need the control value to be valid. If during the control field matching (see Control values) Parse encounters only' ...'X and' ...'& control field values. These values operate directly on the binary content and do not require validity of a control field. In this case the control field is not included in resulting JSON but a member of a REDEFINE group is.