EDIT Execute TSOTRAP EDIT Execute TSOTRAP Author: David McRitchie formatted on 1995/04/01 06:54 for assistance contact: D. McRitchie DMcRitchie@hotmail.com -------------------------------------------------------------------------------- Execute NAME. TSOTRAP users. PDF EDIT users (output will be in EDIT)sers type. Rexx Execute resides in SYS1.TSOCLIST, and in IS03.PC.CMD for use with OS/2 -------------------------------------------------------------------------------- TSOTRAP TRAP a TSO command or TSO Execute or TSO Clist -------------------------------------------------------------------------------- related @STRAP -------------------------------------------------------------------------------- Traps the output in a unique dataset. Same limitations as @STRAP Provides for trapping of write statements and placing them into a unique dataset. Can be used for documentation, such as seen in example later. -------------------------------------------------------------------------------- TSOTRAP tso-command -------------------------------------------------------------------------------- The use of the assembler macro PUTLINE and the use of WRITE within a CLIST will allow lines to be intercepted with the use of a SYSOUTTRAP. The use of the as- sembler macro TPUT does not allow lines to be intercepted by a SYSOUTTRAPϜ. The MVS and OS/2 versions differ, actual code is included below: Content of SYS1.TSOCLIST(TSOTRAP) -- MVS version /* --------------------- rexx procedure ---------------------- */ /* Name: TSOTRAP */ /* */ /* Function: This Rexx procedure will accept any TSO command */ /* (including clists and other Rexx procedures) */ /* that output to the terminal and trap the output */ /* and then display the results using ISPF Browse. */ /* */ /* Syntax: %TSOTRAP tso-command options */ /* */ /* Author: Lionel B. Dyck */ /* Rockwell International */ /* P.O. Box 2515 */ /* Seal Beach, California 90740 */ /* (310) 797-1125 */ /* IBMLINK: ROK2027 */ /* contact: David McRitchie DMcRitchie@hotmail.com */ /* similar to edit macros @STRAP etc. by D.McR */ /* The TSOTRAP procedure should prove useful to CUT lines out */ /* and to paste elsewhere later. */ /* */ /* History: 1990/07/23 - Rexx procedure created. */ /* 1990/10/04 - update to larger lrecl for trap d/s */ /* 1992/01/19 - D.McR use EDIT, exit if TRAP.0=0 */ /* 1992/01/20 - D.McR .LIST in dsname for profile */ /* 1994/06/30 - D.McR Provide for NOPREFIX users */ /* */ /* ------------------------------------------------------------- */ arg command sysuid = SYSVAR('SYSUID') /* to provide for NOPREFIX users */ if length(command) = 0 then do say "Error: Use of TSOTRAP requires the specification of" say " a TSO command whose results will be captured" say " and displayed using ISPF Browse/Edit." say " (e.g. %TSOTRAP LISTC)" exit 12 end x = outtrap("trap.","*") command x= outtrap("off") if trap.0 = 0 then do; say ' ';x = '***** Unable to Trap command ******';say x||x exit 12 end dd = "TP"random() "ALLOC F("dd") DS('"sysuid".TSOTRAP."dd".LIST') NEW SPACE(10,30)", "TRACKS LRECL(130) RECFM(F B) BLKSIZE(0)" "EXECIO * DISKW" dd "(FINIS STEM trap." /*Address ISPEXEC "BROWSE DATASET(TSOTRAP."dd")" */ Address ISPEXEC "EDIT DATASET('"sysuid".TSOTRAP."dd".LIST')" "FREE F("dd") DELETE" Content of IS03.PC.CMD(TSOTRAP) -- PC version (OS/2 -- SAA REXX) /* --------------------- rexx procedure ---------------------- */ /* Name: TSOTRAP */ /* */ /* Function: This Rexx procedure will accept any DOS command */ /* (including clists and other Rexx procedures) */ /* that output to the terminal and trap the output */ /* and then display the results using SPF/PC Edit. */ /* */ /* Syntax: TSOTRAP command options */ /* */ /* Author: F. David McRitchie 1994/02/25 */ /*****************************************************************/ /* The concept of creating a dataset with a random name, then */ /* looking at it in edit, and then deleting it has been borrowed*/ /* from a TSO clist named TSOTRAP by Lionel B. Dyck. My coding */ /* differs and has been written in REXX. */ /*****************************************************************/ parse arg command if command = "" then command = "DIR C:\os2\system\swapper.dat" x = random(0,9999) file = 'C:\junk\TRAP'substr(x,1,4,'0')'.lst' /* the following will work for xxxx.CMD and although perhaps */ /* it should not, it does also work for DIR which is a DOS */ /* command */ "call" command ">" file /* the call is OS/2 must be in quotes*/ "spf2" file "/E" "del" file return /*******************************************************************/ /* types of commands */ /* 1). Internal commands exist in the file \OS2\CMD.EXE */ /* 2). External commands .EXE and .COM */ /* 3). Batch file (DOS) .BAT and .CMD */ /* 4). REXX execute .CMD */ /* Use "CALL" (in quotes) for Batch file and REXX execute */ /* otherwise chaining errors will occur if not the last command. */ /*******************************************************************/ Comparison to old CLIST coding To get an idea of what the old CLIST language looked like see the @STRAP edit macro which begins on page @SCRIPT-1. n TSOTRAP on