FLAGS

Set runtime option flags

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall FLAGS(flags[, control])

Arguments

flags

The runtime option flags. Each flag is a single digit, and the digit positions are assigned ordinal numbers from right to left. Thus, the low‑order digit is digit number one. Synergy DBL examines the flags value digit by digit to determine which flags are set, and hence, which functions are to be performed. The Discussion contains a detailed description of the flags and their meanings. (n)

control

(optional) A value that controls how the individual digit positions in the flag specification value are interpreted. If control is not specified, each digit in flags is interpreted as follows: (n)

0

Reset the associated flag.

n

Set the associated flag, where n is any nonzero decimal number.

We recommend that you use the control value when setting and resetting your flags values. If control is present, its value is interpreted as follows:

0

Reset all flags whose corresponding digit position contains a nonzero number. Leave all other flags unmodified.

1

Set all flags whose corresponding digit position contains a nonzero number. Leave all other flags unmodified.

2

Set the flags variable to a value that reflects the current settings of the flags and leave all flags unmodified. Each digit of the flags variable is set to zero if the associated flag is currently reset or to one if the flag is set. If the length of the variable is less than 10, the settings are returned as in a decimal‑to‑decimal assignment. (See Moving decimal/packed data to a decimal/packed destination for more information about decimal‑to‑decimal assignments.)

Discussion

The FLAGS subroutine, like DFLAG, controls the settings of various runtime option flags. These flags control the way the runtime acts in response to the execution of Synergy DBL statements.

When program execution begins, all program‑controlled flags are normally reset, and the program can alter them as needed. The flag settings are not preserved across program chaining. In effect, the STOP statement resets all flags as its last action, even if another program is being started. The flag settings in one program do not affect the settings in a program that is running concurrently from another terminal.

Remember that the rightmost digit in the flag specification string corresponds to flag number one, as shown in figure 1. Because Synergy DBL interprets the flags argument as if it were storing it to a d10 variable, you don’t have to specify a flag if that flag and all flags to its left have a value of zero.

1. FLAGS runtime option flags.

All rules that apply when storing to a decimal variable apply here. For example, if you specify the following, Synergy DBL interprets your argument as 0000000100. (All flags corresponding to these zeros are cleared.)

xcall flags(00100)

A more detailed description of the flags is provided below. The flag specification digit position (which we refer to as the flag number) is shown on the left, and the description of the flag is listed on the right.

Flags for FLAGS Routine

Flag

Description

1

When flag 1 is set, the runtime applies European conventions to alpha variables during formatted transfers of decimal values. Specifically, the use of commas and periods are reversed (commas are used as decimal points, and periods are used as separators). For example,

alpha = 123456   ,"Z,ZZZ.XX"

normally assigns the value 1,234.56 to alpha. But when flag 1 is set, the European conventions are used, the assignment statement is coded as

alpha = 123456   ,"Z.ZZZ,XX"

and alpha has a value of 1.234,56.

When flag 1 is reset, the runtime applies American conventions to alpha variables. Commas are used as separators, and periods are used as decimal points.

If you are using xfServerPlus and you set flag 1, you need to set it in each routine. (xfServerPlus resets flag 1 after every call so that data passed across the wire is formatted properly.)

We recommend you use the LOCALIZE subroutine instead of flag 1. (See LOCALIZE.) The LOCALIZE subroutine overrides this flag.

2

When flag 2 is set, the runtime processes case‑sensitive terminal input. When the flag is reset, the runtime translates all lowercase input to uppercase before processing it.

3

Setting flag 3 protects the runtime against accidentally replacing an existing file with a new file. Normally, the runtime does not check for duplicate filenames, and OPENing a file in output mode or using the RENAM or ISAMC subroutines can overwrite an existing file. When flag 3 is set, the runtime checks that the file about to be created does not already exist. If it does, a “Cannot supersede existing file” error ($ERR_REPLAC) is generated. When flag 3 is reset, the runtime won’t check for duplicate filenames.

Flag 3 works differently on OpenVMS with RENAM, OPEN, and COPY. To generate an $ERR_REPLAC error, you must also specify the output filename’s version number in the RENAM, OPEN, or COPY statement.

4

Flag 4 is only useful with display terminals. When typing terminal input, the user can delete the most recently typed character by entering an ASCII delete code (using the del, delete, or rubout key, depending on the keyboard). The FLAGS subroutine uses the current terminal setting for the default ASCII delete code.

When flag 4 is set, typing a DEL code sends a backspace, a paint character, and another backspace to the screen. The most recent character is replaced with the paint character, and the cursor is left in the deleted character’s position. The default paint character is a blank, but you can redefine it using the PAINT subroutine. Use the %PAINT intrinsic function to determine the decimal character code for the current paint character. Pressing ctrl+u clears and repaints the current line and positions the cursor at its leftmost character position. ctrl+r is ignored.

When flag 4 is reset, the characters are echoed back in the order in which they are deleted (the reverse of the order in which they were input), with the first deleted character preceded by backslash and the last deleted character followed by a backslash. For example, if the user enters ABDCEFG, presses the rubout key three times, and then enters 123, the sequence appears on the screen as follows:

ABCDEFG\GFE\123

and the input is ABCD123.

This method of handling character deletions is inappropriate for most CRT applications.

When the user presses ctrl+u to delete a line, the two‑character ^U sequence is transmitted to the terminal, followed by a carriage return and a line feed. The cursor is thus positioned at the beginning of the next line to accept further input.

When the user presses ctrl+r, a ^R is echoed at the terminal, followed by a carriage return, a line feed, and the currently accumulated input line.

5

Setting flag 5 prevents input received from any channels opened to terminal‑type devices from being echoed back to the primary terminal. This flag is useful when the input is confidential, like a password. When flag 5 is reset, the characters that the user types are echoed on the screen.

6

Flag 6 is ignored on all systems except OpenVMS. It changes a file open for output to have no record attributes and disables carriage control on O mode files (except stream files). These files cannot be TYPEd or PRINTed.

7

Flag 7 suppresses the program termination message that is displayed at the terminal running the program when the STOP statement returns control to the monitor. When flag 7 is reset, the program termination message is displayed after the STOP statement is issued. If the program terminates abnormally, the appropriate error message is displayed regardless of the value of this flag.

8

Setting flag 8 ignores interrupt character(s) (ctrl+c on Windows, the stty setting for interrupt on UNIX, and ctrl+c and ctrl+y on OpenVMS) typed at the terminal. When flag 8 is reset, interrupt characters perform their normal functions.

On OpenVMS, we recommend using the SETCTL subroutine instead. (See SETCTL.)

9

Setting flag 9 permits terminal input for a READS statement without an explicit terminator. A field entry is terminated implicitly when the field is filled, but a user can still terminate input with a terminator character before the field is full. (In other words, flag 9 causes READS to terminate the same way GETS does.) When flag 9 is reset, the READS statement ignores any nonterminating character that the user types once the field is full and echoes an ASCII bell character to warn the user.

10

When flag 10 is set, the terminator character won’t be echoed on the screen during terminal input. When flag 10 is reset, the terminator character is echoed on the screen.

Tip

To make your code easier to maintain, use the flag number as the nonzero digit that sets the flag. For example, if flags contains a value of “7004301,” you know at a glance that flags 7, 4, 3, and 1 are set. (Of course, this tip won’t work with flag 10.)

See also

DFLAG.

Examples

The example below sets flag 3 and resets all other flags.

xcall flags(300)

The example below resets flag 3 and leaves all other flags unmodified.

xcall flags(300, 0)

The example below sets flag 3 and leaves all other flags unmodified.

xcall flags(300, 1)

The example below loads the current flag settings into a decimal variable called now.

xcall flags(now, 2)