Caché MultiValue Basic Reference
OCONVS
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   
Search:    

Converts dynamic array element values from internal format to external format.
Synopsis
OCONVS(idynarray,code)
Arguments
idynarray An expression that resolves to a dynamic array, each element of which specifies a value in internal (storage) format.
code An expression that resolves to a conversion code string. This conversion code specifies the type of conversion to perform. Conversion is from internal format to external format. Conversion codes are not case sensitive. For descriptions of these code values, refer to the OCONV function. For a complete list of conversion codes, refer to the Conversion Codes table in the MultiValue Basic Quick Reference.
Description
The OCONVS function is a general-purpose conversion function used to convert the elements of a dynamic array from internal (storage) format to external (output) format. The type of conversion is specified by a code string that is specific to the type of data to be converted.
The OCONVS function converts dynamic array element values from internal format to external format. The ICONVS function converts dynamic array element values from external format to internal format. Note that the MCDX/MCXD, MCAX/MCXA, and MCWX/MCXW code pairs have the opposite meanings in ICONVS, reversing the OCONVS operation.
You can use the OCONV function to perform conversions for a single value. For available code values, further details on conversions, and additional program examples, refer to the OCONV function.
Examples
The following example shows date conversions:
DateConversions:
  x=14143:@VM:14144:@VM:14145
  PRINT OCONVS(x,"D")
  ! Returns 20 SEP 2006ý21 SEP 2006ý22 SEP 2006
The following example shows character-to-hexcode and hexcode-to-character conversions. It shows both the OCONVS conversions and the inverse ICONVS conversions:
CharConversions:
  odyn="m":@VM:"n":@VM:"o":@VM:"p"
  idyn=OCONVS(odyn,"MCAX")
  PRINT idyn;                ! Returns 6Dý6Eý6Fý70
  PRINT OCONVS(idyn,"MCXA"); ! Returns mýnýoýp

  PRINT ICONVS(odyn,"MCXA");    ! Returns 6Dý6Eý6Fý70
  PRINT ICONVS(idyn,"MCAX");    ! Returns mýnýoýp
See Also