%SYSID
Return the ID of the system where the source is being compiled
WSupported on Windows
|
USupported on Unix
|
VSupported on OpenVMS
|
NSupported in Synergy .NET
|
runtime = %SYSID
Return value
runtime
The variable to be loaded with the system code of the current runtime: (a or n)
004 = IBM AIX 32-bit
028 = Linux 32-bit
101 = Windows 32-bit (x86)
104 = Windows 64-bit (x64)
200 = OpenVMS Alpha
202 = OpenVMS IA64 / Integrity
304 = IBM AIX 64-bit
428 = Linux 64-bit (x64)
Discussion
%SYSID is evaluated at compile time as a literal value corresponding to the system where the source code is compiled. This allows it to be used for conditional compilations. For example, if a program is compiled on 32-bit Windows and run on Linux, the return value would be 101 for 32-bit Windows.
In Synergy .NET, the platform being targeted (e.g., -platform=x86) is irrelevant. %SYSID will return 101 or 104 depending on the compiler in use (32-bit or 64-bit).
Examples
The example below writes “Program compiled for Alpha VMS” if the source code is being compiled on HP OpenVMS Alpha.
.if (%SYSID .eq. 200) writes(1, "Program compiled for Alpha VMS") .endc
The following example writes “Program not compiled for this machine” if the machine on which the program is currently running does not have the same system ID as the machine on which the source code was compiled.
xcall envrn(system, machine) if (machine .ne. %SYSID) writes(1, "Program not compiled for this machine")