Converting the Type of an Operand

You can convert an operand to a different type. For instance, you can change an integer operand to a string, or a string operand to an integer. You can convert variables and message tokens.

To convert an integer operand into a string, include the variable reference within quotation marks (“ ”). To convert a string operand into an integer, specify # before the variable reference. All characters in the string operand must be digits, or a run-time error occurs. Note that a plus or minus sign may precede the digits.

The message tokens _TOKENn and _NEGTOKENn are always considered strings even when the token is made up entirely of digits. You must use the # operator to convert these tokens for use in arithmetic expressions.

The following example converts the value of the integer variable ErrorCount to a string:

"\ErrorCount\"

The following example converts the value of the third token from a string variable to an integer:

#\_TOKEN3\

The following example converts a value from a string to an integer. The fifth and sixth characters of the member of the group variable DiskError, named by token 3, are converted to an integer.

#\DiskError:3[5,6]\

Note: In the preceding example, the fifth and sixth characters must be integers; otherwise, a run-time error occurs.