Open System Testing Architecture

TOC PREV NEXT INDEX



CONVERT Command

Description:

This command allows the value in an integer variable to be converted to an ASCII string, or vice versa. The default radix for the conversion is 10, but this may be overridden by including a "RADIX" clause in the command.

For integer-to-character conversions, format options may be specified. These options can cause the ASCII string to be left- or right-justified within the output buffer, or to have leading zeros or spaces, or cause the conversion to be signed or unsigned.

In the format description below, the "|" characters indicate mutually exclusive options.

The default options are SIGNED and LEFT JUSTIFY. If RIGHT JUSTIFY is in operation, the default filling is LEADING ZEROS.

If the output buffer is too small to hold the output string, it will be filled with asterisk ("*") characters.

For character-to-integer conversions, leading and trailing spaces are removed form the ASCII string before the conversion. Specification of a non-numeric ASCII string, or of an ASCII string which is converted to a numeric outside the range of an interger*4, will cause a message to be logged to the audit file indicating an invalid character string to convert. The thread will be aborted.

The "ON ERROR GOTO err_label" clause can be specified to define a label to which control should be transferred in the event of an error.

Format:
 CONVERT variable1 TO variable2 {&}
 	 {,[SIGNED][UNSIGNED} {,LEADING [ZEROS]|[SPACES]} {&}
 	 {,[LEFT]|[RIGHT] JUSTIFY} {,RADIX=radix} {&}
 	 {,ON ERROR GOTO err_label}
Parameters:
variable1

A variable containing the variable to be converted.

variable2

A variable into which the converted variable is to be placed.

radix

An integer variable or literal in the range 2 to 36.

err_label

A label defined within the current scope of the script, to which control branches if an error occurs.

Examples:
 CONVERT Number To String
 CONVERT Number To Employee-Code, RIGHT JUSTIFY
 CONVERT Ascii-code To Numeric_code
 CONVERT Ascii-code To Hex_code, RADIX=16, &
 	 ON ERROR GOTO Conv_error
 

See also:

Output Stream Handling Commands


OpenSTA.org
Mailing Lists
Further enquiries
Documentation feedback
CYRANO.com
TOC PREV NEXT INDEX