Conditional Configuration

In some cases it is necessary to have entries in the configuration file that refer to a specific terminal or workstation. These cases may be handled by using the if..else..endif options in the configuration file.

The if command accepts one argument for testing. The argument appears in the form:

string1{=string2}

If string1 appears without string2, this is considered to be a test against the current FID(0). If string2 is present, string1 is searched for in the environment, with the result compared against string2.

Note:When comparing entries to the environment in BBj in a thin-client scenario, the comparison is made with the environment on the server-side. In BBj 12.0 and higher, the comparison is made on the client side. BUI clients cannot make use of conditional terminal configurations.

If the strings compared are equal, all of the lines appearing between the if and the next else or endif are executed. If the strings compared are not equal, all lines in the configuration file will be ignored until either an else or endif is encountered. If an else is encountered, the lines encountered until the next endif are executed.

Only one level of if testing is supported.

As an example, consider the case of a configuration where a terminal has a local printer, such as:

if T6
    alias P0 /dev/tty2a "local" CR,SLON=1B41,SLOFF=1B42
endif

This defines a printer "P0" (or replaces an existing definition) on the terminal that becomes "T6".

In BBj 23.01 and higher, the if command can specify multiple space-delimited terminal aliases, such as:

if T1 T2 T3
    alias P3 SYSPRINT "" FONT="Courier New",COLS=80,ROWS=62
else
    alias P9 SYSPRINT "" FONT="Courier New",COLS=80,ROWS=62
endif

This defines a SYSPRINT "P3" (or replaces an existing definition) on terminals "T1", "T2", and "T3", or a SYSPRINT "P9" for all other terminals. (The else block is optional).

All text following the IF is considered part of the conditional expression, including any trailing spaces or tabs that might not be visible with all text editors. Extra spaces at the end of a line could cause unpredictable behavior.