ICONV()

ICONV(), ICONVS()

Top  Previous  Next

 

The ICONV() function performs input conversion. Data is converted from its external representation to the internal form. This function is typically used to convert data entered at the keyboard. The ICONVS() function is identical to ICONV() except that it works on each element of a dynamic array, returning the result in a similarly delimited dynamic array.

 

 

Format

 

ICONV(expr, conv.spec)

ICONVS(expr, conv.spec)

 

where

 

exprevaluates to the data to be converted.

 

conv.specevaluates to the conversion specification. This may be a multivalued 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 ICONV() function converts the value of expr to its internal representation according to the conversion codes in conv.spec. The result of ICONV() is stored internally as a string regardless of whether the value is a number or not except for the MO and MX conversions which always produce an integer value.

 

The ICONV() 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. A null string is returned for all codes except ML and MR which result of conversion of the leading numeric portion of the input data or the entire input data if there is no leading numeric portion.
2The conversion code was invalid. A null string is returned.
3The conversion has been performed but the result is possibly incorrect. Examples are:

The day number in a date conversion was beyond the end of the month. The returned value will be extended into the following month (e.g. 31 June becomes 1 July). This feature can be suppressed using the NO.DATE.WRAPPING option.

A character encoding conversion (X) on a non-ECS system has returned data in which characters outside the 8 bit set have been replaced by some substitute character.

 

 

See also:

Conversion codes, OCONV()