Chapter Contents

Previous

Next
execmsi

execmsi



Return System Message Preference

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
EXAMPLE


SYNOPSIS

#include <exec.h>

int execmsi(void);


DESCRIPTION

The execmsi function tests the user's preferences for printing system messages, specifically, whether message IDs should be printed or suppressed. Under TSO, execmsi indicates whether PROFILE MSGID or PROFILE NOMSGID is in effect. Under CMS, execmsi tests whether the CP EMSG setting is EMSG ON, EMSG TEXT, EMSG CODE, or EMSG OFF.

Under USS, execmsi always returns MSI_MSGON , indicating that message IDs should be printed.


RETURN VALUE

The execmsi function returns an integer value indicating the user's message processing preference. Symbolic names for these return values are defined in the header file <exec.h> , as follows: MSI_MSGON specifies to print message and message id (TSO PROFILE MSGID or CMS SET EMSG ON or USS). MSI_MSGTEXT specifies to print message text only (TSO PROFILE NOMSGID or CMS SET EMSG TEXT). MSI_MSGCODE specifies to print message ID only (CMS SET EMSG OFF). MSI_MSGOFF specifies not to print messages (CMS SET EMSG OFF). MSI_NOINFO specifies that the information is unavailable (OS/390 batch).


EXAMPLE

This example formats a message to stderr based on the return code from execmsi :

#include <stdio.h>
#include <string.h>
#include <exec.h>

void msgfmt(int msgid, char *msgtext)
{
   int rc;
   rc = execmsi();
   switch (rc)
   {
      case MSI_MSGON:       /* id + text  */
      default:
         fprintf(stderr, "%d -- %s\n", msgid, msgtext);
         break;
      case MSI_MSGTEXT:     /* text only  */
         fprintf(stderr, "%s\n", msgtext);
         break;
      case MSI_MSGCODE:     /* id only    */
         fprintf(stderr, "%d\n", msgid);
         break;
      case MSI_MSGOFF;      /* no message */
         break;
   }
   return;
}


Chapter Contents

Previous

Next

Top of Page

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