Chapter Contents

Previous

Next
ossysinfo

ossysinfo



Get Operating System Information

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
DIAGNOSTICS
EXAMPLE
PORTABILITY
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <os.h>

int ossysinfo(struct SYSINFO * sysinfo);


DESCRIPTION

ossysinfo gets the operating system sequence number, name, version number, release number, and modification level. It is intended as a replacement for the sysname and syslevel functions if you are running under OS/390.

The header file defines the structure SYSINFO. The structure is defined as follows:

struct SYSINFO {
   int  seqnumber;
   char name[16];
   char version[2];
   char release[2];
   char level[2];
   char _ _reserved[38];
};

seqnumber
is an integer containing the operating system's sequence number. This number will change for any new version, release, or modification level of the operating system. It will always increase from one version/release/level of the operating system to the next.

name
is a character array containing the name of the operating system, for example, OS/390.

version
is a two-byte character array containing the version number of the operating system. Note that the array is not null terminated.

release
is a two-byte character array containing the release number of the operating system. Note that the array is not null terminated.

level
is a two-byte character array containing the level number of the operating system. Note that the array is not null terminated.

Note:    If a field of the SYSINFO structure is not applicable to your system, all bytes of the field are set to 0.  [cautionend]


RETURN VALUE

ossysinfo returns 0 if successful, otherwise it returns -1 and sets errno to indicate the type of error.


DIAGNOSTICS


EXAMPLE

#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <lclib.h>
#include <os.h>

struct SYSINFO sysinfo;

void main()
{
   char *sysptr, sysstr[16];
   char SysInfo[9] = {'\0'};
   char OSName[17] = {'\0'};
   int  rc;

   quiet(1);                      /* Suppress library message      */
   rc = ossysinfo(&sysinfo);
   quiet(0);                      /* Allow messages again          */

   if (rc != -1)
   {
      /*-----------------------------------------------------------+
       | Get OS/390 Information                                    |
       +----------------------------------------------------------*/
       memcpy(OSName, sysinfo.name, 16);
       sprintf(SysInfo, "%.2s.%.2s.%.2s",
                   sysinfo.version, sysinfo.release, sysinfo.level);
       
       printf("System Sequence Number is %d(%#0.8x)\n",
                                    sysinfo.seqnumber, sysinfo.seqnumber);
       printf("System Name is %s\n", OSName);
       printf("System Information is %s\n", SysInfo);
   }
   else
   {
       /*-----------------------------------------------------------+
        | Get System Information                                    |
        +----------------------------------------------------------*/
        sysptr = syslevel();
        sprintf(sysstr, "%02x.%02x.%02x.%02x",
                *sysptr, *(sysptr + 1), *(sysptr + 2), *(sysptr + 3));
       
        printf("System Name is %-8s\n", sysname() );
        printf("System Information is %s\n", sysstr);
    }
  }


PORTABILITY

The ossysinfo function is only available for the OS/390 operating system.


IMPLEMENTATION

If running under OS/390, SAS/C on intialization retrieves the system information stored in the OS/390 ECVT control block and stores this information in an extended SAS/C EVDB (Environmental Descriptor Block). See Chapter 13, "Getting Environmental Information," in SAS/C Library Reference, Volume 2.


RELATED FUNCTIONS

sysname, syslevel


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.