Translate an environment variable

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall GETLOG(logical, translation, length)



An expression that contains the environment variable or logical assignment to translate. (a)


The variable that will be loaded with the translation or value of the environment variable or logical assignment. (a)


The variable that will be loaded with the length of the variable or logical. If no variable or logical is found, length has a value of zero. (n)


The GETLOG subroutine translates an environment variable (or logical assignment on OpenVMS) and stores the translation in an alpha variable. If no environment variable or logical is found, the translation value will not be altered. On UNIX and OpenVMS, a maximum of 254 characters can be returned.

You can use the GETLOG subroutine to alter a program’s behavior based on the value of a particular environment variable.

Length must be at least three digits.

On Windows, GETLOG only returns a value for environment variables that are set in the environment. For a list of environment variables that are not set in the environment, see Synergy initialization files.

On UNIX, environment variables are case‑sensitive.

On OpenVMS, only logicals are checked on OpenVMS; DCL symbols are not. You can also use GETLOG to check whether logical assignments are set up incorrectly, in which case you can issue an appropriate error message rather than waiting for the program to fail on an OPEN statement.


subroutine chk_log
    a_log       ,a
    trans       ,a40
    len         ,d3
    xcall getlog(a_log, trans, len)              ;Try to translate the logical
    if (.not. len)                               ;If no translation
        display(TTCHN, "Translation for " + a_log)              ;Prompt for a new
        reads(TTCHN, trans, done)                               ; translation for
                                                                ; the logical
        xcall setlog (a_log, trans, len)        ;Set logical to new translation
        if (.not. len)                           ;If setting logical doesn’t work
          writes(TTCHN, "Error setting" + a_log)                ;Display error