z/OS TSO/E Programming Guide
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Performing Terminal I/O

z/OS TSO/E Programming Guide
SA32-0981-00

Your command processor may need to write lines of data to the terminal or obtain data from the terminal. This topic discusses how to perform terminal I/O for data other than messages, message responses, and subcommand requests.

There are several methods that you can use to perform terminal I/O.
  • The BSAM or QSAM macro instructions provide terminal I/O support for programs that run under TSO/E. For example, you can use the PUT or WRITE macro instructions to display data at the terminal, and you can use the GET or READ macro instructions to obtain input from the terminal.

    The major benefit of using BSAM or QSAM to process terminal I/O is that these access methods are not device dependent or TSO/E dependent. Therefore, you can incorporate code from existing routines that use BSAM or QSAM into your command processor without having to modify the macro instructions.

  • The GETLINE and PUTLINE service routines provide the ability to obtain data from the terminal and write data to the terminal, respectively. Use the GETLINE and PUTLINE macro instructions to invoke these I/O service routines.

    When GETLINE returns a line of input, this data is placed in a buffer that resides in subpool 1 and is owned by your command processor. Although the buffers returned by GETLINE are automatically freed when your code relinquishes control, you can use the FREEMAIN macro instruction to free these buffers.

    Use the PUTLINE macro instruction with the DATA operand to write one or more lines of data to the terminal.

  • The TGET, TPUT, and TPG macro instructions to perform terminal I/O. Your command processor can use the TPUT macro instruction to write a line of output to the terminal, and can use the TGET macro instruction to read a line of input. However, the TGET, TPUT and TPG macro instructions are intended only for terminal I/O. To allow your command processor to be executed in a background TSO/E session, use the I/O service routines (STACK, GETLINE, PUTLINE and PUTGET).

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014