Attachmate Worldwide  |   Contact Us  |   NetIQ.com
Home » Support » Solution Library

Technical Notes

Using Verastream Scripting Language to Determine the Operating System
Technical Note 10015
Last Reviewed 06-Sep-2007
Applies To
Verastream Integration Broker version 9.7 or higher
Summary

This sample Verastream Scripting Language (VSL) code allows you to determine what operating system platform a Verastream process is running on.

The code can be cut and pasted into the Process Integrator VSL editor. Or, the code can be defined and loaded in a sub-application, if you first remove the FUNCTION START START section.

Determining the Operating System

Use the VSL STATUS on STATUS command to determine the operating system platform, reroute the status output to a string, and then parse the string.

The following code sample checks for UNIX (U), Microsoft Windows (N), or OpenVMS (V). The default is OpenVMS.

Linux is returned as UNIX, and Windows NT 3.5 through Windows 2000 are all returned as Windows NT. However, there are usually differences in the long string returned by these operating systems, and you can edit the script to determine specific systems based on this information. This code could also be expanded to recognize the AS/400, HP3000, and OS/390 operating systems.

FUNCTION START START
{
    INIT  BASE
    check OS_type
    FERROR BASE osType + ': ' + status
}

FUNCTION check OS_type
#=============================================================
# Call STATUS STATUS to check the OS platform.  Put the long
# string in status, and a one character code in osType.
#=============================================================
{
    # Override STATUS, to send result to status
    # string in order to obtain OS in use.
    
    MSG_FIELD   STATUS status
    STATUS      STATUS
    {
        TEST BASE substring(status,1,5) == 'WinNT'
        SET osType 'N'
    ALT
        TEST BASE substring(status,1,4) == 'UNIX'
        SET osType 'U'
    ALT
        SET osType 'V'
    }
    
    # Cancel the override of STATUS out redirection
    MSG_FIELD   STATUS
}

FUNCTION MSG status
#============================================================
# This function must be defined to reroute the STATUS output
# to the string called status.
#============================================================
{
    void
}

FIELD status               string(150)
FIELD osType               string(1) STATIC INIT='''N'''

Related Technical Notes
10999 Verastream Integration Broker Technical Notes

Did this technical note answer your question?

Yes    No    Somewhat     Not sure yet

Additional comments about this tech note:

Need further help? For technical support, please contact Support.