getVAGSysType()

The system function VGLib.getVAGSysType identifies the target system in which the program is running. The function is supported (at development time) if the program property VAGCompatibility is selected or (at generation time) if the build descriptor option VAGCompatibility is set to yes.

If the generated output is a Java™ wrapper, VGLib.getVAGSysType is not available. Otherwise, the function returns the character value that would have been returned by the VisualAge® Generator EZESYS special function word. If the current system was not supported by VisualAge Generator, the function returns the uppercase, string equivalent of the code returned by SysVar.systemType.

  VGLib.getVAGSysType( )
  returns (result CHAR(8))
result
A character string that contains the system type code, as shown in the next table.

VGLib.getVAGSysType returns the VisualAge Generator equivalent of the value in SysVar.systemType.

Value in sysVar.systemType Value returned by VGLib.getVAGSysType
AIX® "AIX"
DEBUG "ITF"
ISERIESC "OS400"
ISERIESJ "OS400"
LINUX "LINUX"
USS "OS390"
WIN "WINNT"
The value returned by VGLib.getVAGSysType can be used only as a character string; you cannot use the returned value with the operands is or not in a logical expression, as you can with sysVar.systemType:
  // valid ONLY for sysVar.systemType
  if sysVar.systemType is AIX
    call myProgram;
  end

The only place that VGLib.getVAGSysType can be used is as the source in an assignment or move statement.

The characteristics of VGLib.getVAGSysType are as follows:
Primitive type
CHAR
Data length
8 (padded with blanks)
Is value always restored after a converse?
Yes

It is recommended that you use sysVar.systemType instead of VGLib.getVAGSysType.

Definition considerations

The value of VGLib.getVAGSysType does not affect what code is validated at generation time. For example, the following add statement is validated even if you are generating for Windows®:
  mySystem CHAR(8);
  mySystem = VGLib.getVAGSysType();
  if (mySystem == "AIX")
    add myRecord;
  end
To avoid validating code that will never run in the target system, move the statements that you do not want to validate to a second program; then, let the original program call the new program conditionally:
  mySystem CHAR(8);
  mySystem = VGLib.getVAGSysType();

  if (mySystem == "AIX")
    call myAddProgram myRecord;
  end

An alternative way to solve the problem is available, but only if you use sysVar.systemType instead of VGLib.getVAGSysType; for details, see eliminateSystemDependentCode.

Feedback
(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.