/********************************* REXX ***********************************/ /* Bruce A. Woodworth TRAPCMD November 20, 2002 */ /* */ /* This is somethin' like CMS command "CP SP CON START TO * NOTERM" */ /* */ /* This EXEC traps the screen output and places it into a file. */ /* Execute this command followed by any operands. The operand must be */ /* a valid TSO command or EXEC. Any output that the desired command */ /* places onto the screen will instead be placed into a file by this */ /* EXEC. The option /MOD can be included anywhere within your operands */ /* to indicate that you want this trapped output to be placed into a file */ /* with other trapped output. The /MOD option will be stripped from your */ /* command stream. */ /* */ /* Ex: */ /* TRAPCMD LISTALC STATUS */ /* */ /* Where: TRAPCMD - is this EXEC */ /* LISTALC STATUS - is the valid TSO command */ /* */ /**************************************************************************/ parse upper arg tsocmd clrscrn init = setinit() logon_id = userid() if tsocmd = "?" ³ tsocmd = "" then call helper else call spool_con_start exit spool_con_start: option_loc = index(tsocmd,"/MOD") if option_loc = 0 then output_access = "NEW" else output_access = "MOD" tsocmd = stripop(tsocmd,"/MOD") cmdresp.0= 10 say "Executing" tsocmd say "Please Wait...." x = outtrap('cmdresp.') /* TRAP COMMAND OUTPUT */ tsocmd /* ISSUE THE DESIRED COMMAND */ y = outtrap('off') /* RESET SO WE DON'T TRAP MORE */ /* x= CMDRESP. */ /* y= OFF */ traped_cnt = cmdresp.0 dsn = "'" ³³ logon_id ³³ "." ³³ init ³³ ".sysout'" goodlib = listdsi(dsn) if goodlib = 0 & output_access = "NEW" then do "delete" dsn say " AND RECREATED WITH" traped_cnt "RECORDS." end else say "Screen output will be placed into" dsn dsno = "dataset(" ³³ dsn ³³ ")" if output_access = "MOD" & goodlib = 0 then "allocate ddname(ocmdfle)" dsno "mod" else "allocate ddname(ocmdfle)" dsno "new space(8,2) cylinders catalog lrecl(80) blksize(800) dsorg(ps)" cnt = 1 do while cnt <= cmdresp.0 push cmdresp.cnt "execio 1 diskw ocmdfle" cnt = cnt + 1 end "execio 0 diskw ocmdfle (finis" "free ddname(ocmdfle)" return helper: 'disphelp' setrexx(init) ³³ '(trapcmd) T' init return