%OPTION

Determine if a system option is set

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
status = %OPTION(option[, reset])

Return value

status

%OPTION returns a value of 1 if the specified Synergy DBL system option has been set or a value of 0 if the option has not been set. (i)

Arguments

option

The number of a Synergy DBL system option. (See System Options for a complete list of Synergy DBL system options.) (n)

reset

(optional) Sets or resets a system option at runtime: (n)

0 = Reset the system option.

nonzero = Set the system option.

Discussion

%OPTION determines whether or not a specific system option is set and optionally changes the option.

Note

In an xfServer system, %OPTION only affects the client program.

Examples

In the example below, %OPTION checks whether the CRT‑mode system option (#5) has been set, possibly by the DBLOPT environment variable. If it’s not set, the FLAGS subroutine sets the CRT‑mode flag.

if (.not. %option(5))
  xcall flags(4000, 1)

The following subroutine lists the system options set.

subroutine show_opts
.define MAXOPT ,54
record
    i           ,i2
    setflg      ,i1,    0
proc
    display(15, "These system options are set: ")
    for i from 1 thru MAXOPT
      begin
        if (%option(i))
          begin
            if (.not. setflg)
              setflg = 1
            writes(15, "Option " + %string(i))
          end
      end
    if (.not. setflg)
      writes(15, "none") 
    xreturn 
endsubroutine

The following example sets system option #16 and then resets the option to its previous state:

savopt16 = %option(16, 1)
.
.
.
savopt16 = %option(16, savopt16)