UniBasic Commands Reference - Rocket Software

UniBasic Commands Reference - Rocket Software UniBasic Commands Reference - Rocket Software

rocketsoftware.com
from rocketsoftware.com More from this publisher
11.04.2013 Views

Examples In the following statement, UniData moves the decimal three places to the left (0.012339), rounds to three decimal places, and then prints 0.012: PRINT OCONV("12.339","MR3") In the following statement, UniData moves the decimal two places to the left (0.12339), rounds to three decimal places, and then prints 0.123: 1-511 UniBasic Commands Reference PRINT OCONV("12.339","MR32") In the following example, UniData converts the value 123456789 to 123-45-6789 because it right-justifies it into the mask “####-##-####”: OUTPUT.VAL = OCONV("123456789","MR(####-##-####)") The following example is taken from the sample program in Appendix A, “Sample Program,” in Developing UniBasic Applications. It converts a price stored in internal format in the ORDERS file to display format, including two decimal places, commas separating thousands of dollars, and a preceding $. DISPLAY @(10,9+ENTRY):OCONV(ORDER.REC,"MR2$,"): The following statement is taken from the same sample program. This statement displays the price right-justified and formatted with commas separating thousands of dollars and a preceding $ as in $12,386.34. The right justification aligns data on the right. DISPLAY @(10,9+ENTRY):OCONV(ORDER.REC,"MR2$,"): In the following example, UniData converts the value 123456 to 1,234.56: OUTPUT.VAL = OCONV("123456","MR2$,") Related Command UniBasic ICONV Right Justify (MR)

OCONV Time (MT) Syntax OCONV(num.expr, "MT [H] [S] [c]") Description The OCONV time (MT) function converts the internal time of day from an integer between 0 and 86400 (the number of seconds in a day) to display format. Time is output in the following form: HH MM [SS] If the input value or conversion code is invalid, UniData returns the input value. Note: In BASICTYPE P, OCONV returns an empty string if UDT.OPTIONS 56 is on and the input value or conversion code is invalid. Parameters The following table describes each parameter of the syntax. Parameter Description num.expr Indicates a number to be converted. H Indicates that hours are to be formatted in 12-hour format with a.m. or p.m. suffixes. S Indicates that seconds are to be included in the output. c Specifies a delimiter to be placed between hours, seconds, and fractions of seconds. OCONV Time Conversion (MT) Parameters Note: A program that you can use to try out ICONV and OCONV conversion codes is provided in Developing UniBasic Applications.. OCONV Time (MT) 1-512

OCONV Time (MT)<br />

Syntax<br />

OCONV(num.expr, "MT [H] [S] [c]")<br />

Description<br />

The OCONV time (MT) function converts the internal time of day from an integer<br />

between 0 and 86400 (the number of seconds in a day) to display format. Time is<br />

output in the following form:<br />

HH MM [SS]<br />

If the input value or conversion code is invalid, UniData returns the input value.<br />

Note: In BASICTYPE P, OCONV returns an empty string if UDT.OPTIONS 56 is on<br />

and the input value or conversion code is invalid.<br />

Parameters<br />

The following table describes each parameter of the syntax.<br />

Parameter Description<br />

num.expr Indicates a number to be converted.<br />

H Indicates that hours are to be formatted in 12-hour format with a.m. or p.m.<br />

suffixes.<br />

S Indicates that seconds are to be included in the output.<br />

c Specifies a delimiter to be placed between hours, seconds, and fractions of<br />

seconds.<br />

OCONV Time Conversion (MT) Parameters<br />

Note: A program that you can use to try out ICONV and OCONV conversion codes<br />

is provided in Developing <strong>UniBasic</strong> Applications..<br />

OCONV Time (MT) 1-512

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!