Chapter Contents

Previous

Next
TPUT/TGET

TPUT/TGET



Terminal I/O via SVC 93

Portability: SAS/C extension


SYNOPSIS
DESCRIPTION
RETURN VALUE
ERRORS AND DIAGNOSTICS
CAUTIONS
PORTABILITY
IMPLEMENTATION
SEE ALSO
EXAMPLE


SYNOPSIS

#include <tput.h>

int TPUT(void *buffer, unsigned short bufsiz,
         unsigned int options);
int TPUT_ASID(void *buffer, unsigned short bufsiz,
              unsigned short asid, unsigned int options);
int TPUT_USERID(void *buffer, unsigned short bufsiz,
                char *userid, unsigned int options);
int TGET(void *buffer, unsigned short bufsiz,
         unsigned int options);


DESCRIPTION

These functions simulate the OS/390 TPUT and TGET Assembler macros. TPUT sends a line of output to the terminal. TPUT_ASID and TPUT_USERID can be used for interuser communication. TGET reads a line of input from the terminal.

Each macro causes the compiler to generate code to load the appropriate values into registers 0, 1, and 15, and then to generate SVC 93. The use of each argument is explained below:

buffer
is a pointer to the output line ( TPUT , TPUT_ASID , and TPUT_USERID ) or to the input buffer ( TGET ).

bufsiz
specifies the length of the output line or the length of the input buffer.

options
is a set of option flags. Each macro corresponds to a value of one of the assembler macro parameters. All option flags are defined as macros in <tput.h> . Table 4.3 on page 4-29 lists the options that can be used in each macro. Use 0 as the option argument to specify that all of the defaults should be taken.

asid
is the address space identifier of the target userid.

userid
is a pointer to an 8-byte char array that contains the target userid. The userid must be uppercase, left-adjusted, and padded on the right with blanks if necessary.

If the macro name _AMODE31 has been defined prior to including the <tput.h> header file, the macros generate a call to the _TPUT function.


RETURN VALUE

The macros return the value in register 15 after the SVC 93 completes.


ERRORS AND DIAGNOSTICS

The possible errors are the same as when the TPUT or TGET Assembler macros are used in an assembler language program.


CAUTIONS

The macros do not perform any error checking on their arguments. Incorrect arguments such as invalid combinations of option flags are either ignored entirely or remain undetected until execution time, at which point they cause unpredictable and possibly undesirable results.


PORTABILITY

None of the macros are portable.


IMPLEMENTATION

By default, the macros generate R-form invocations of TPUT and TGET. This form is not supported by MVS/XA in 31-bit addressing mode.

This function copies output data to a below-the-line buffer before transmission (for TPUT) or reads input data into a below-the-line buffer and then copies it to the buffer pointed to by buffer (for TGET).

If _AMODE31 has been defined, the maximum transmission size is 1024 bytes. This limit can be changed by recompiling L$UTPIO.


SEE ALSO

See TSO/E Programming Services.


EXAMPLE

   /* Send greetings.  Use the default options. */
rc = TPUT("Hello, world!",13,0);

Macros Defined for TPUT and TGET Options shows the macro names defined as option flags for the TPUT and TGET macros. In the macro columns, a yes entry indicates that the flag can be used in the options argument for the macro. A no entry indicates that the flag cannot be used. An ignored entry indicates that the flag is ignored if used.

Macros Defined for TPUT and TGET Options
Option TPUT TPUT_ASID TPUT_USERID TGET
_EDIT yes yes yes yes
_ASIS yes yes yes yes
_CONTROL yes yes yes no
_FULLSCR yes yes yes no
_WAIT yes yes yes yes
_NOWAIT yes yes yes yes
_HOLD yes ignored ignored no
_NOHOLD yes ignored ignored no
_BREAKIN yes yes yes no
_NOBREAK yes yes yes no
_HIGHP ignored yes yes no
_LOW ignored yes yes no


Chapter Contents

Previous

Next

Top of Page

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