Using the CONTAINSERRORS function

You may not want to map the input data if it contains any invalid data. In this example or situation, use the CONTAINSERRORS function. The CONTAINSERRORS function has one input argument that is the name of the object you want to test. The CONTAINSERRORS function returns "true" if the argument contains any invalid object or returns "false" if the argument does not contain any invalid object.

The CONTAINSERRORS function only operates on a valid object.

For example, if you have the same input file as in the example above, the third Customer record is invalid. You are mapping the input to the output file of CustomerEntry(s). If the entire input contains any invalid object, do not produce any output. If the entire input is valid, map the Customer(s) to CustomerEntry(s), using the functional map MakeEntry.

The map rule on CustomerEntry(s) uses the CONTAINSERRORS function to check if the entire List contains any errors. If List contains an error, no output is produced. If List does not contain errors, the Customer(s) will be mapped to CustomerEntry(s).

The result is no output, because List does contain an error - the third Customer record is invalid.