|odynarray||An expression that resolves to a dynamic array, each element of which specifies a value in external (output) format.|
|code||An expression that resolves to a conversion code string. This conversion code specifies the type of conversion to perform. Conversion is from external format to internal format. Conversion codes are not case-sensitive. For descriptions of these code values, refer to the ICONV function. For a complete list of conversion codes, refer to the Conversion Codes table in the MultiValue Basic Quick Reference.|
The ICONVS function is a general-purpose conversion function used to convert each of the elements of a dynamic array from external (output) format to internal (storage) format. It returns a dynamic array of values. The type of conversion is specified by a code string that is specific to the type of data to be converted.
The ICONVS function converts dynamic array element values from external format to internal format. The OCONVS function converts dynamic array element values from internal format to external format. Note that the MCDX/MCXD, MCAX/MCXA, and MCWX/MCXW code pairs have the opposite meanings in OCONVS, reversing the ICONVS operation.
If a code value is not valid, the odynarray is returned unchanged. If a date element value is not valid, the empty string is returned for that element. If a time element value is not valid, the input data value for that element is returned unchanged. If a numeric element value is not valid, zero is returned for that element.
You can use the ICONV function to convert a single value from external format to internal format. For further details on conversions, refer to the ICONV function.
The following example converts dates to a uniform output format. First ICONVS performs date conversions from external to internal format, returning a dynamic array of elements containing internal dates. The OCONVS performs date conversions from internal to external format, returning all dates in the same default display format:
DateConversions: x="20 SEP 2006":@VM:"09-21-2006":@VM:"09/22/2006" idates=ICONVS(x,"D"); PRINT idates; Returns 14143ý14144ý14145 odates=OCONVS(idates,"D") PRINT odates; Returns 20 SEP 2006ý21 SEP 2006ý22 SEP 2006
The following example shows masked decimal conversions with rounding and zero padding:
MaskedDecimalConversions: x="123.40":@VM:"123.57":@VM:"123.4" PRINT ICONVS(x,"MD2")
For further examples of format conversion, see ICONV.