Chapter Contents

Previous

Next
WTO

WTO



Write to Operator

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
IMPLEMENTATION
EXAMPLES
RELATED FUNCTIONS


SYNOPSIS

#include <oswto.h>
int WTO(char *msg, ...);


DESCRIPTION

The WTO function implements the functionality of the OS/390 assembler WTO macro. The msg argument is the address of a null-terminated string, or in the case of a multi-line message, this argument should be set to 0 . The remainder of the argument list is a list of keywords followed, in most cases, by an argument specifying a value for the keyword. The list is terminated by the _Wend keyword. The supported keywords and their associated data are as follows:


RETURN VALUE

WTO returns 0 if the WTO macro was successful. If the WTO macro fails, it returns the return code from the macro, which will be a positive value. WTO may also return -1 to indicate an unknown or invalid keyword combination, or -2 if there was not enough memory to perform the WTO .


IMPLEMENTATION

The WTO function is implemented by the source module L$UWTO . As a convenience, the macro WTP can be used for single line messages used by programmers. It is defined as follows:

#define WTP(msg) WTO(msg, \
                     _Wroutcde, 11, \
                     _Wdesc, 7, \
                     _Wend);


EXAMPLES

EXAMPLE 1:

This example uses the WTP macro to send two single-line programmer's messages:

#include <oswto.h>

char msg[120];
int iLine;

iLine = 20;
sprintf(msg, "Error discovered at line: 
        %i", iLine);
WTP(msg);
WTP("Aborting...");

EXAMPLE 2:

This example sends a multi-line message to a specific console.

#include <oswto.h>
#include <code.h>
#include <genl370.h>

int regs[16];
char line1[50];
char line2[50];
char line3[50];
char line4[50];

_ldregs(R1, regs);

/* save current registers 
   in the regs array */
STM(0,15,0+b(1));

sprintf(line1,
   "GPR  0-3  %08X  %08X  %08X  %08X",
   regs[0], regs[1], regs[2], regs[3]);

sprintf(line2,
   "GPR  4-7  %08X  %08X  %08X  %08X",
   regs[4], regs[5], regs[6], regs[7]);

sprintf(line3,
   "GPR  8-11 %08X  %08X  %08X  %08X",
   regs[8], regs[9], regs[10], regs[11]);

sprintf(line4,
   "GPR 12-15 %08X  %08X  %08X  %08X",
   regs[12], regs[13], regs[14], regs[15]);

WTO(0, _Wctext, "XXX99999",
       _Wtext, "Register contents:",
       _Wtext, line1,
       _Wtext, line2,
       _Wtext, line3,
       _Wtext, line4,
       _Wconsname, "CONSOLE1",
       _Wroutcde, 11, 
       _Wdesc, 7, 
       _Wend);


RELATED FUNCTIONS

DOM , DOM_TOK , WTOR


Chapter Contents

Previous

Next

Top of Page

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