GETLOG

Translate an environment variable

WSupported on Windows
USupported on Unix
VSupported on OpenVMS
NSupported in Synergy .NET
xcall GETLOG(logical, translation, length)

Arguments

logical

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

translation

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

length

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)

Discussion

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.

Examples

subroutine chk_log
    a_log       ,a
record
    trans       ,a40
    len         ,d3
proc
    xcall getlog(a_log, trans, len)              ;Try to translate the logical
    if (.not. len)                               ;If no translation
      begin
        display(TTCHN, "Translation for " + a_log)   ;Prompt for a new translation 
        reads(TTCHN, trans, done)                    ; 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
      end
    return
endsubroutine