$VALIDATE_NUMERIC_DATA

From m204wiki
Jump to navigation Jump to search

Function

Detects invalid numeric data when data is read into an image from an external source.

Syntax

$VALIDATE_NUMERIC_DATA('%variable' | '%imagename:itemname', s1, s2, s3, s4, s5)

Where:

  • %variable is a string expression enclosed in single quotation marks that resolves to the name of an item in an image. The value of this string is the standard format for referencing an image item: %imagename:itemname, which is also enclosed in single quotation marks.
  • If the argument identifies an array item, up to five subscripts can be used, s1-s5. If an array is not specified, these arguments are ignored. On an array, as many of these parameters are used as the number of dimensions on the array. If any needed subscript parameter is not specified, then a value of 1 is used.

Example

If %imagename:itemname identifies an array, then you must identify the particular array element to validate. To do so, note the number of subscripts of the array, and specify the same number of optional subscript arguments (the s1-s5 arguments). For example, to validate %IMAGE:ARRAY(1,2), code

%RC=$VALIDATE_NUMERIC_DATA('%IMAGE:ARRAY',1,2)

Usage

The image item whose name is passed is looked up in the image definition.

  • If the item is a numeric type, the contents of the data area of the image are checked to see if the data that corresponds to the item is in the correct format.
  • If the item is an array, the element identified by the subscripts is tested.

The numeric return code values have the following meanings:

Return code Means...
0 Return code zero indicates good data. Either item is numeric and the data is of the correct format, or the item is not numeric (no validation performed).
1 Item is numeric and the data is invalid.
2 On an array element, at least one subscript is out-of-bounds.
3 Item named does not exist.