%OPTION

Determine if a system option is set

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
status = %OPTION(option[, reset])

Return value

status

%OPTION returns a value of 1 if the specified Synergy DBL system option is currently set or a value of 0 if the option is not 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 a specific system option is set and optionally changes the setting.

Note

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

Status is solely based on how %OPTION processes the option argument, regardless of what is passed for the reset argument. For example, if option #23 is not currently set, and you call %option(23,1) in a loop, the first call returns 0. But now that option #23 is set, the next and all subsequent calls to %option(23,1) result in a return value of 1.

For information on determining whether a system option is set during debugging for Synergy .NET, see Determining whether a system option is set. For traditional Synergy use the SHOW OPTION command (see SHOW).

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)