OCONV Function

Performs English output conversions.

Syntax

OCONV(value, conversion)

Syntax Elements

value A DataBasic expression that evaluates to the value to be converted.

Note: The value to be converted cannot contain any system delimiters.

conversion A string containing one of the following English conversion codes:

D Converts date to external format (see D Code).

G Performs group extraction (see G Code).

MC Performs character conversion (see MC Codes).

MD Converts integer to decimal number, without alignment (see MD Code).

MF Performs literal insertions or currency formatting. Obsolescent, replaced by ML and MR.

ML Mask decimal, left align (see ML and MR Codes).

MP Converts packed decimal number to integer (see MP Code).

MR Mask decimal, right align (see ML and MR Codes).

MT Converts time to external format (see MT Code).

MX Converts ASCII characters to their hexadecimal codes.

T Extracts a character substring from an attribute value (see T Code). Note, however, that Substring Extraction is more efficient.

Tfile Converts by table/file translation (see Tfile Code). Inefficient if you need to access several items or attributes.

Comments

These conversions are formed exactly like English conversions and have the same capabilities.

Examples

DOLLARS = OCONV("123400","MD2")

Assigns the string value 1234.00 to the variable DOLLARS.

PRICE = OCONV("3*179*7","G1*1")

Extracts 179 from the string and assigns it to PRICE.

A = "6240"
B = "D"
XDATE = OCONV(A,B)

Assigns the string value 30 JAN 1985 (the external date) to XDATE.

A = "A31-1"
Y = OCONV(A,"TINV;X;3;3")
PRINT Y

Retrieves and prints the third attribute of item A31-1 in the INV file.

Go to top button