[USflag] The American Programmer [USflag]

Books on Mainframe Programming
Mainframe Manuals and Tutorials
System Abend codes, Sqlcodes, VSAM/QSAM codes
Everything about the IBM AS/400 Midrange Computer - iSeries
Everything about CICS
Everything about COBOL
Everything about DB2 and SQL
Everything about IMS
Everything about Java and JavaScript
Everything about JCL and JES
Everything about REXX
  Sorting in REXX: The Bubble Sort
  REXX Password Generator
  Using REXX to capture displayed output of TSO command
  Count records in REXX
  REXX program to calculate present value of money
  REXX function to format a number in currency format
  REXX function to produce a fixed-length number
  REXX program to produce lottery numbers
  REXX: what does your phone number spell?
  REXX Practice Problems.
  Just Enough REXX Tutorial
  Setting up to Execute REXX Programs on TSO/ISPF
  How to execute a REXX program
  REXX Boolean operators
  Comparison of CLIST language and REXX
  REXX Comparison operators
  REXX Debugging: the TRACE verb
  Reserved REXX Variables
  Executing REXX through JCL.
  Writing ISPF Edit Macros in REXX
  REXX program to unload a PDS
  REXX book: The REXX Language on TSO
  REXX Functions Book
  QMF Procedures Written in REXX
  Using REXX Subroutines with the QMF Calc panel
  REXX error codes (RC)
  REXX programming language manuals
  Books on REXX programming
  The REXX Files
Everything about zOS, VSAM, Tivoli, Assembler
Everything about TSO, ISPF, Spufi
Site Map and Site Search

           Home   > REXX   > REXX Function OUTTRAP

REXX Built-in Function OUTTRAP

How do you capture the output of a TSO command in a REXX program?
REXX Built-in Functions: OUTTRAP

OUTTRAP Function (TSO Only)  
TSO commands normally display something on the screen. This function traps the displayed output, and lets you access it
line by line in your REXX program. It is not displayed on the screen, unless you choose to do so.

CALL  OUTTRAP "stem.", "how-many-lines" Turns on capturing of the display output of TSO commands, 
such as "LISTCAT," "LISTDS," 
error messages as from "DELETE file-that-doesn’t-exist", SAY in another EXEC, or a WRITE in a CLIST.  
Each line of output is captured in a different element of the array created from stem.  
A maximum of how-many-lines will be captured, with "*" meaning "capture all lines."      


	stem.0	contains the line number of the last line                   
	stem.1	contains the first line                                 
	stem.2	contains the second line, etc.                          
	stem.n	contains the last line, etc.                          


	SAY LINE.0	/* 1 */

CALL OUTTRAP "OFF"	Turns off the trapping of command output so the commands 
will resume displaying their output at the terminal.

CALL OUTTRAP "LINE.", "0"		Discards the displayed output of commands such as "LISTCAT," "LISTDS," 
error messages as from "DELETE DOESNT.EXIST", SAY in another EXEC, or a WRITE in a CLIST.  
The output is not displayed at the terminal and is not captured. 

REXX Programming Book with all functions (published 2013)

[Books Computer]

Home Books for Computer Professionals Privacy Terms |
Site Map and Site Search Programming Manuals and Tutorials The REXX Files Top of Page |