Description

Converts a Boolean true (1) or false (0) string into any characters.

Syntax

output = OConv (string, "B [ tf ] ")

-OR -

output = OConv (string, "B [ true,false ]")

-OR -

output = OConv (string,"BX" [ tf ] ") (for International Default Conversions)

Parameters

The OConv (B) function has the following parameters.

ParameterDescription
stringstring can contain any character or word. Any non-zero numbers and any non-null strings are treated as Boolean true. Number zero is treated as Boolean false. A null string is retained as a null string.
BIndicates a Boolean conversion. If no additional options are provided, the conversion examines the default Boolean conversion in the currently active language/national data set, and uses the first letter of the true string and the first letter of the false string found there. In the default language/national data set, "B" is interpreted the same as "B Yes, No".
- or - 
BXBX is used for international default conversions. Requires that a language is set in the environment, in field 15 (@environ.set<ENV_LND_DEFAULT$> ), eg LND_GERMAN_D, LND_FRENCH_F, etc., etc., etc. The language needs to be set within the SYSENV record prior to start.
tfIf the tf option is used, a true string is converted to the t character. Any false string is converted to the f character.
true,falseIf the option true,false is used, a true string is converted to the true word. False strings are converted to the false word. If you do not specify values for either the tf or the true,false arguments, the default is the value in the default language set.

Example

/* Assigns the true string, as found in the language national data set to display. */
 
true = 1
display = OConv(true, "B")
 
/* The program fragment uses the return value of Status() after an OSRead command to set the results of the operation. Note that due to the return value of Status(), the "true" condition is the error condition. */
 
Conv = "BError,OK"
OSRead FILE From "C:\AUTOEXEC.BAT"
status = OConv(Status(), Conv)
 
/* if the Language is set to French the value of this will be 'OUI' */
this = Oconv(1, 'BX')
  • No labels