ENVRN

Identify the current operating system and runtime

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows
USupported on UNIX
VSupported on OpenVMS
xcall ENVRN(system[, runtime])

Arguments

system

The variable to be loaded with the code of the current operating system: (a or n)

-1 = Other systems

6 = OpenVMS

8 = UNIX

24 = Windows 8

25 = Windows Server 2012

26 = Windows 8.1

27 = Windows Server 2012 R2

28 = Windows 10

29 = Windows Server 2016 and 2019

31 = Windows UWP

100 = Mono Linux

runtime

(optional) The variable to be loaded with the system code of the current runtime: (or n)

004 = IBM AIX 32-bit

020 = Oracle Solaris 32-bit (SPARC)

028 = Linux 32-bit

101 = Windows 32-bit (x86)

104 = Windows 64-bit (x64)

200 = HP OpenVMS Alpha

202 = HP OpenVMS I64 and VSI OpenVMS Integrity

304 = IBM AIX 64-bit

320 = Oracle Solaris 64-bit (SPARC)

428 = Linux 64-bit (x64)

509 = HP-UX 64-bit (Itanium)

Discussion

The ENVRN subroutine returns decimal codes that identify the operating system and, optionally, the runtime on which the program is running. You can use these values to control program actions that depend on the operating system or runtime.

Tip

When running on Synergy .NET, if you write an agnostic program that is 64 on 64 and 32 on 32, you can use ENVRN to determine the platform. On a 64-bit system, the agnostic program will return 104, while on a 32-bit system, the same program will return 101.

Examples

.define TTCHN           ,1
record
    opsys               ,d2
proc
    open(TTCHN, i, "tt:")
    xcall envrn(opsys)
    display(TTCHN, "This program is running on ")
    case opsys of
      begincase
      6:
        writes(TTCHN, "OpenVMS")
      8:
        writes(TTCHN, "UNIX")
      24:
        writes(TTCHN, "Windows 8")
      25:
        writes(TTCHN, "Windows Server 2012")
      endcase
    else 
        writes(TTCHN, "something new")
    stop
end