Description

Converts from internal storage format to hex, octal, and binary formats.

Syntax

output = OConv (expression, "MX")

output = OConv (expression, "HEX")

output = OConv (expression, "MO")

output = OConv (expression, "'MB")

Parameters

OConv (DT) accepts the following arguments for its parameters.

ParametersDescription
expressionYields a decimal value. Scientific notation is accepted.
MXThe expression must be a decimal number (base 10) and is converted to the equivalent hexadecimal character set (base 16).
HEXThe expression must be a string of ASCII characters with a maximum length of 32,766 and is converted into a string of hexadecimal character sets.
MOThe expression must be a decimal number and is converted to an ASCII representation of an octal (base 8) number.
MBThe expression must be a decimal number and is converted to an ASCII representation of a binary (base 2) number. If expression yields an incorrect value a 0 (zero) will be returned.

An understanding of different number bases is helpful for the effective use of these specifications. Use the following table as a guide to conversions to different number bases.

Conversion CodeIconvOConv
MXhexadecimal to decimaldecimal to hex
MOoctal to decimaldecimal to octal
MBbinary to decimaldecimal to binary

Example

* Converting to hex, octal, and binary output.
* The value 13 is assigned to the variable identifier C.
A = 19
B = "MX"
C = OConv(A, B)
* The value 41 is assigned to the variable identifier C.
A = "A"
B = "HEX"
C = OConv(A, B)
/* The value 1100100 will be assigned to the variable identifier C. */
A = 1E2
B = "MB"
C = OConv(A, B)
  • No labels