OCONV


The OCONV statement is used to convert internal representations of data to their external form.

 

COMMAND SYNTAX

OCONV(expression1, expression2)

 

SYNTAX ELEMENTS

expression1 may evaluate to any data type but must be be relevant to the conversion code. expression2 should evaluate to a conversion code from the list below. Alternatively, expression2 may evaluate to a user exit known to the jBC language or supplied by the user (see external interfaces documentation).

 

NOTES

OCONV will return the result of the conversion of expression1 by expression2. Valid conversion codes are shown below:

Conversion Action
D{n{c}} Converts an internal date to an external date format. The numeric argument n specifies the field width allowed for the year and can be 0 to 4 (default 4). The character c causes the date to be return in the form ddcmmcyyyy. If it is not specified the month name is return in abbreviated form.
DI Allow the conversion of an external date to the internal format even though an output conversion is expected.
DD Returns the day in the current month.
DM Returns the number of the month in the year.
DMA Returns the name of the current month.
DJ Returns the number of the day in the year (0-366).
DQ Returns the quarter of the year as a number 1 to 4
DW Returns the day of the week as a number 1 to 7 (Monday is 1).
DWA Returns the name of the day of the week.
DY{n} Returns the year in a field of n characters.
F Given a prospective filename for a command such as CREATE-FILE this conversion will return a filename that is acceptable to the version of UNIX jBASE is running on.
MCA Removes all but alphabetic characters from the input string.
MC/A Removes all but the NON alphabetic characters in the input string.
MCN Removes all but numeric characters in the input string
MC/N Removes all but NON numeric characters in the input string
MCB Returns just the alphabetic and numeric characters from the input string
MC/B Remove the alphabetic and numeric characters from their input string.
MCC;s1;s2 Replaces all occurrences of string s1 with string s2
MCL Converts all upper case characters in the string to lower case characters
MCU Converts all lower case characters in the string to upper case characters.
MCT Capitalizes each word in the input string; e.g. JIM converts to Jim
MCP{c} Converts all non printable characters to a period character "." in the input string. If the character "c" is supplied then this character is used instead of the period.
MCPN{n} In the same manner as the MCP conversion all non printable characters are replaced. However the replacing character is followed by the ASCII hexadecimal value of the character that was replaced.
MCNP{n} Performs the opposite conversion to MCPN. The ASCII hexadecimal value following the tilde character is converted back to its original binary character value.
MCDX Converts the decimal value in the input string to its hexadecimal equivalent.
MCXD Converts the hexadecimal value in the input string to its decimal equivalent.
Gncx Extracts x groups separated by character c skipping n groups, from the input string.
MT{HS} Performs time conversions.
MD Converts the supplied integer value to a decimal value.
MP Converts a packed decimal number to an integer value.
MX Converts ASCII input to hexadecimal characters.
T Performs file translations given a cross reference table in a record in a file.

It is also possible to create customized conversion codes that can be used in a jBASE application.


jBC