Chapter Contents

Previous

Next
execmsg

execmsg



Send a Message to the Terminal

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTIONS
IMPLEMENTATION
EXAMPLE


SYNOPSIS

#include <exec.h>

int execmsg(const char *id, char *msg);


DESCRIPTION

The execmsg function sends a message to the terminal, editing it in a system-dependent way. The character string pointed to by id is a message identifier that either can be sent or suppressed. id can be 0 to indicate the absence of the message identifier. The character string pointed to by msg is the actual message text.


RETURN VALUE

The execmsg function returns 0 if the call is successful or nonzero if the call fails. Reasons for failure are system-dependent. For example, under TSO a message cannot be sent if it is longer than 256 characters, including the identifier. execmsg cannot fail under CMS, although depending on the current EMSG setting, the message may not be sent.


CAUTIONS

Under CMS, the message ID must be ten characters long. If it is longer than ten characters, it is truncated on the right. If it is less than ten characters, it is padded on the left with asterisks (*). This means that a message ID of length 0 has different effects than if id is NULL , although the TSO effects are the same.

Under CMS, the maximum message length, for the ID and text, is 130 characters. If it is longer, the message text is truncated.

The execmsg function edits the message according to the user's EMSG setting. No message is sent in the following situations:

Under TSO, messages sent using execmsg can be trapped by the CLIST command output trapping facility (the symbolic variables & SYSOUTTRAP and & SYSOUTLINEnnnn). Terminal output sent in other ways (such as using the standard SAS/C I/O facilities) is not trapped.

Under USS, messages sent using execmsg are sent to file descriptor 1 of the REXX interface process, which is normally the terminal. USS does not support suppression of message IDs.


IMPLEMENTATION

The message is sent under TSO using PUTLINE INFOR (or PUTLINE DATA if id is 0 ). Under CMS, the message is edited via DIAG X'5C' and sent to the terminal by TYPLIN or LINEWRT. Under USS, the message is sent to the REXX process' file descriptor 1 using the IRXSAY service routine.

The execmsg function can be used by programs that have not defined an environment name with execinit under CMS or TSO; however, prior use of execinit is required under USS.


EXAMPLE

#include <exec.h>

static char *id="EXEC-MSG";
execmsg(id,"File not found");

Note:    See also the comprehensive SUBCOM example.  [cautionend]


Chapter Contents

Previous

Next

Top of Page

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