Determines whether a reference to a scalar pictured value has a value that is valid with respect to its picture specification.
VALID(x)
x is a reference to a scalar pictured value.
VALIDATE_FILE: PROCEDURE (BALANCES, REC_COUNT); DECLARE BALANCES FILE RECORD; DECLARE REC_COUNT FIXED BIN(31); DECLARE TOTAL PICTURE '999V.99'; DO I = 1 TO REC_COUNT; READ FILE(BALANCES) INTO (TOTAL); IF ^VALID(TOTAL) THEN DO; PUT LIST('Invalid total value:', TOTAL); PUT SKIP; END; END; END VALIDATE_FILE;
None.
Description
The VALID function determines whether x, a reference to a scalar pictured value, has a value that is valid with respect to its picture specification. The result is a bit string of length one that indicates if the character-string value of x can be edited into the picture declared for x.
If the character-string value of x can be edited into the picture declared for x, the result value is '1' B; otherwise, the result is '0' B.
The VALID function can be used when a pictured data item or a pictured item that is a member of a structure is read using the READ statement. Record input done with READ does not perform the validation that is normally done when a value is assigned to a pictured data item.