Edit macro @STRAP Edit macro @STRAP Author: David McRitchie formatted on 1995/04/01 06:54 for assistance contact: D. McRitchie DMcRitchie@hotmail.com -------------------------------------------------------------------------------- Macro name. @STRAP Macro name. @STRAPQ users. PDF EDIT users particularly SCRIPT users type. Edit Macro resides in SYS1.TSOCLIST, a somewhat different version is available in IS03.SPF2.MACROS for use with SPF/PC. -------------------------------------------------------------------------------- @STRAP Trap clist WRITE statements (trap REXX exec SAY statements) and append them at end of member @STRAPQ (same as @STRAP, except lists line number only and not data while runni ng). -------------------------------------------------------------------------------- related @STRAP, @STRAPQ, TSOTRAP -------------------------------------------------------------------------------- Provides for trapping of write statements and appending them onto the end of the member currently in PDF edit. Can be used for documentation, such as seen in example later. Can be used for debugging a clist later if the other clist has CONTROL LIST CONLIST SYMLIST -------------------------------------------------------------------------------- ISREDIT @STRAP tso-command ISREDIT @STRAP ISREDIT edit-command -------------------------------------------------------------------------------- tso-command any TSO command edit-command any ISPF-edit command Examples: before @STRAPQ is being invoked to include the lines obtained from the fol- lowing tso clist. The TSO clist PDSDD will browse each library in SYSPROC (clists are in SYSPROC) for the member @STRAP. What you see in Browse is not included in your generated lines. There is a summary at the end of the PDSDD clist that writes to your screen, these lines will be intercepted and included. To make the demonstration more meaning, the @EDITMSK clist was used to place an edit mask around the output so that you can see what it would actually look like. EDIT --- IS03.SHARE.TEXT(EDIT) - 01.00 ------------------- COLUMNS 001 124 COMMAND ===> @strapq pdsdd clist @strap SCRO ****** ************************* TOP OF DATA *************************** ****** ********************** BOTTOM OF DATA *************************** RESULT after issuing above command EDIT --- IS03.SHARE.TEXT(EDIT) - 01.00 ------------------- COLUMNS 001 124 COMMAND ===> SCRO ****** ************************* TOP OF DATA *************************** 000001 COMMAND INVOKING @STRAP CLIST MACRO ===> @STRAP PDSDD CLIST @STRAP 000002 000003 SUMMARY ----------------- PDSDD CLIST @STRAP DSN1() DSN2() 000004 ENTERED AS ----===> TSO PDSDD SYSPROC @STRAP 000005 1 'IS03.LIBR.CLIST(@STRAP)' .................. OK 000006 2 'TECHTSO.COMBINE.ISRCLIB(@STRAP)' .......... MEMBER NOT FOUND 000007 3 'TSOTEST.LIB01.CLIST(@STRAP)' .............. MEMBER NOT FOUND 000008 4 'TSOPROD.LIB01.CLIST(@STRAP)' .............. MEMBER NOT FOUND 000009 5 'SYS6.MICS.SAF.VB.CLIST(@STRAP)' ........... MEMBER NOT FOUND 000010 ------- NO BROWSE BELOW THIS LINE -- FOR DATASETS ADDED BY "PDSDD" 000011 6 'SYS1.TSOCLIST(@STRAP)' ..................... OK ****** ********************** BOTTOM OF DATA *************************** An example to delete all datasets ending with ".LIST ", be careful that you see only those datasets to be deleted before issuing "save" and executing. 1). edit a new member in your clist e.g. 'xxxx.libr.clist(z8)' 2). ===> @strap listcat 3). ===> x all 4). ===> find '.list ' all 5). ===> delete x all 6). ===> c all 1 'xxxx.' ' del ' check ***** check all of the resulting list very carefully, these check ***** should be only the datasets you wish to delete 8). ===> save 9). ===> tso z8 10). ===> kill z8 11). ((pfk-3)) Internal Aspects: 1) ISREDIT LINE_AFTER commands are issued 2) SYSOUTTRAP is set for up to 500 lines 3) More ISREDIT LINE_AFTER commands issued to retain the SYSOUTTRAPped lines. SYSOUT TRAP: 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 assembler 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(@STRAP) -- MVS version /*REXX: @STRAP creating isredit cards of TSO COMMAND*/ /* @STRAP: SYSOUT TRAP of TSO COMMAND creating data cards*/ /* TITLE: @STRAP -- trap clist write statements and imbed at */ /* end of file in edit */ /* Users: TSO ISPF EDIT USERS */ /* Entry: Used as an EDIT CLIST within ISPF EDIT */ /* ===> @STRAP ddname all */ /* Contributed: 1985/08/29 David McRitchie */ /* Rewritten in REXX, D.McRitchie -- 1991/02/28*/ /* EXAMPLE: ===> @STRAP LISTC */ /* EXAMPLE: ===> @STRAP DDNAME ALL */ /* EXAMPLE: ===> @STRAP LISTRP */ Address "ISREDIT";"MACRO (TOKEN)" token = translate(token) x = OUTTRAP('var.','*',"CONCAT") Address "TSO" TOKEN do i = 1 to var.0; Card = var.i 'LINE_AFTER .ZL = (card)' If i = 1 then "LABEL .ZLAST = .new 0" end if var.0 = 0 then do ZEDSMSG = "No lines found" ZEDLMSG = 'No lines trapped, please also try @STRAPQ' token "LINE_BEFORE .ZFIRST = NOTELINE (ZEDLMSG)" ADDRESS "ISPEXEC" "SETMSG MSG(ISRZ000)" RETURN 1 end /* This clist uses the TSO/E feature SYSOUTTRAP. Any TSO command */ /* that uses PUTLINE to display output to the screen can be */ /* trapped. Output using TPUT or WTO macros will go directly */ /* to the screen and cannot be trapped. WRITE output from CLIST */ /* commands, and SAY output from REXX commands can be trapped. */ Content of IS03.SPF2.MACROS(@STRAP) -- PC version (SPF/PC) /* SYSOUT TRAP -- OS/2 VERSION, NOT FOR MVS -- REXX */ /* Author: David McRitchie, 1994/03/10 */ Address "ISREDIT";"MACRO (CMD)" line = "/"||"*--" date() time() "-- @STRAP" cmd "--*"||"/" çççççççççççççççç  TSO Extension CLISTs -- &SYSOUTLINE does not save command output sent to the terminal by a TPUT macro, such as normal or error prompting messages. -------------------------------------------------------------------------------- Page @SCRIPT-1 SYSTECH NOTICE -- CLISTS "line_after .zl = dataline (line)" if cmd="" then do ZEDSMSG = "No Cmd" ZEDLMSG = "@STRAP -- command is missing. e.g. @STRAP dir a: " "ISPEXEC" "SETMSG" "MSG(ISRZ001)" /* 1 is alarm */ "line_before .zf = noteline (zedlmsg)" return 4 end Address "CMD" cmd "| rxqueue" do i = 1 by 1 until queued() = 0 parse pull line "line_after .zl = dataline (line)" end return 0 What the old CLIST language looked like This example has been stripped down as far as errors are concerned. CONTROL ASIS ISREDIT MACRO (COMMAND) ERROR DO ERROR EXIT(12) END SET SYSOUTTRAP = 8000 &COMMAND SET N = &SYSOUTLINE SET SYSOUTTRAP = 0 SET I = 1 DO WHILE &I <= &N SET X = &SYSNSUB(2,&&SYSOUTLINE&I..) ISREDIT LINE_AFTER .ZLAST = (X) IF &LASTCC ª= 0 THEN WRITE EEEEEEROR. SET I = &I. + 1 END EXIT CODE(1) /* place cursor on command line */ n @STRAP on