Validation of Elementary Items

By default, the Parse Copybook Data activity requires the binary data of an elementary item to be in full compliance with its definition in a copybook. For example, packed decimal data can only have certain values for a sign nibble. Normally, Parse throws an error when a violation is encountered.

For COBOL copybooks, 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 exception is thrown.
  • Resulting XML content have no elements for the invalid items.

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 XML. Note, however, that parsing does not stop and any valid items found after an erroneous one are processed and returned in the XML.

This setting applies to a wide variety of items, including:

  • zoned and packed-decimal numbers
  • edited numerics
  • items with DATE attribute
  • external floating point items
    Note: Ignore Invalid Items is not a substitute for Allow Incomplete Records. It is applied to items that have enough bytes in the data. If you want to allow premature end of data than select Allow Incomplete Records.

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, the Plug-in cannot determine the number of occurrences of REP to read. In this case, parsing fails.

    Note: There is an exception from the above. If you selected Allow Incomplete Records and there are no bytes following COUNT, then Parse completes normally.
  • When an invalid item is used as a control field for a REDEFINE group. The Plug-in 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. Is this case Plug-in 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 XML but a member of a REDEFINE group is.