Validating data

If you suspect that your program is trying to perform arithmetic on nonnumeric data or is receiving the wrong type of data on an input record, use the class test (the class condition) to validate the type of data.

About this task

You can use the class test to check whether the content of a data item is ALPHABETIC, ALPHABETIC-LOWER, ALPHABETIC-UPPER, DBCS, KANJI, or NUMERIC. If the data item is described implicitly or explicitly as USAGE NATIONAL, the class test checks the national character representation of the characters associated with the specified character class.

You can use the UVALID intrinsic function to check whether a national data item contains valid UTF-16 encoded data, or whether an alphanumeric or alphabetic item contains valid UTF-8 encoded data.

Related references  
Class condition (Enterprise COBOL for z/OS® Language Reference)
UVALID (Enterprise COBOL for z/OS Language Reference)