OCONV(), OCONVS()

Top  Previous  Next

 

The OCONV() function performs output conversion. Data is converted from its internal representation to the external form. This function is typically used to convert data for display or printing. The OCONVS() function is identical to OCONV() except that it works on each element of a dynamic array, returning the result in a similarly delimited dynamic array.

 

 

Format

 

OCONV(expr, conv.spec)

OCONVS(expr, conv.spec)

 

where

 

exprevaluates to the data to be converted.

 

conv.specevaluates to the conversion specification. This may be a multi-valued string containing more than one conversion code separated by value marks. Each conversion will be carried out in turn on the result of the previous conversion.

 

 

The OCONV() function converts the value of expr to its external representation according to the conversion codes in conv.spec.

 

If conv.spec is a null string, OCONV() returns expr as its result.

 

The OCONV() function sets the STATUS() function value to indicate whether the conversion was successful. Possible values are

 

0Successful conversion.
1Data to convert was invalid for the conversion specification.
2The conversion code was invalid.

 

Conversions that result in a non-zero STATUS() value return the string that failed to convert as the function result. For an OCONV() function where conv.spec is not multi-valued or where the first stage of a multiple conversion fails, the function would return expr. If one or more stages of a multi-valued conv.spec have been completed, the returned value is the result of the last successful stage.

 

 

See also:

Conversion codes, ICONV()