[USflag] The American Programmer [USflag]
Home Programming Books for Computer Professionals Privacy Terms
           Home   > Programming   > REXX Built-in Functions: OUTTRAP

REXX Built-in Functions: 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."      

	Returns:

	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.                          

	Example:

	CALL OUTTRAP "LINE.", "*"
	"LISTDS NO.SUCH.DATASET"    
	SAY LINE.1	/* DATASET NO.SUCH.DATASET NOT IN CATALOG */
	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. 




[Books Computer]

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

[link page]