Mainframe Utility: TRAPDBUG

Return to Mainframe Utilities Page

Module


PROC 0 HELP REPEAT
CONTROL NOMSG NOLIST NOCONLIST NOSYMLIST NOFLUSH NOPROMPT
ERROR DO
          SET MODE = CLIST
          RETURN
      END
ISREDIT MACRO (HELP)
ERROR OFF
ISPEXEC CONTROL ERRORS RETURN
IF &HELP = HELP THEN GOTO HELPSEC
/**********************************************************************
/* CLIST/MACRO : TRAPDBUG                                             *
/*      AUTHOR : DAVE LEIGH                                           *
/*    FUNCTION : THIS UTILITY ALLOWS YOU TO TRAP THE MESSAGES SENT BY *
/*               BY A CLIST/EDIT MACRO WHEN IT'S IN "DEBUG" MODE.  THE*
/*               TRAPPED MESSAGES ARE THEN STORED IN A DATASET WHICH  *
/*               IS EDITED UPON COMPLETION OF THE UTILITY.            *
/**********************************************************************

SET MAXTRAP = 10000
SET CYLINDER = 1
SET UTILNAME =
SET PARMDATA =
IF &MODE = CLIST THEN SET TYPE = CLIST
ELSE SET TYPE = MACRO

ISPEXEC VPUT (TYPE UTILNAME PARMDATA MAXTRAP CYLINDER) SHARED

REDISPLAY: ISPEXEC DISPLAY PANEL(TRAPDBUG)

IF &LASTCC > 7 THEN +
    DO
        IF &REPEAT ¬= REPEAT THEN +
            DO
                SET ZEDLMSG = &STR(*** EXITED "TRAPDBUG" WITHOUT +

                                   PROCESSING ***)
                ISPEXEC SETMSG MSG(UTLZ001)
            END
        EXIT
    END

ISPEXEC VGET (UTILNAME PARMDATA MAXTRAP CYLINDER) SHARED

ISPEXEC VGET DBGSWTCH
IF &DBGSWTCH = ON THEN
ELSE %SETDEBUG

SET TRAPDSN = &STR(&SYSUID..TEMP.TRAP.DEBUG)
DELETE '&TRAPDSN'
FREE DDNAME(TRAP)
ALLOC DDNAME(TRAP) DSN('&TRAPDSN') +
      NEW CATALOG +
      UNIT(SYSDA) VOLUME(WRK$$$) +
      SPACE(&CYLINDER,2) CYLINDERS RELEASE +
      RECFM(F B) LRECL(255) BLKSIZE(23460) DSORG(PS)

OPENFILE TRAP OUTPUT

SET SYSOUTTRAP = &MAXTRAP
IF &MODE = CLIST THEN &UTILNAME &STR(&SYSNSUB(1,&PARMDATA))
ELSE ISREDIT &UTILNAME &STR(&SYSNSUB(1,&PARMDATA))
SET TRAPPED = &SYSOUTLINE
SET SYSOUTTRAP = 0
%SETDEBUG

WRITE *** LOADING THE TRAPPED DEBUGGING MESSAGES NOW ***

CONTROL NOMSG NOLIST NOCONLIST NOSYMLIST NOFLUSH NOPROMPT

DO &A = 1 TO &TRAPPED
    SET TRAP = &STR(&SYSNSUB(2,&&SYSOUTLINE&A))
    PUTFILE TRAP
END

CLOSFILE TRAP

FREE DDNAME(TRAP)

ISPEXEC EDIT DATASET('&TRAPDSN')

IF &REPEAT = REPEAT THEN GOTO REDISPLAY

EXIT

HELPSEC: +
ISPEXEC SELECT PGM(ISPTUTOR) PARM(HELPSHEL)
SET ZEDLMSG = &STR(*** HELP DISPLAYED FOR TRAPDBUG UTILITY +
                   *** NO PROCESSING PERFORMED ***)
ISPEXEC SETMSG MSG(UTLZ000)
EXIT
            


Documentation


 TRAPDBUG is a CLIST which will call any CLIST you select and capture all the
 messages returned by that CLIST into a file.  You are then taken into an edit
 of the file.  You may pass parameters to the CLIST as well when requesting
 execution of a given CLIST.  Simply type TSO TRAPDBUG on an ISPF command line
 and press ENTER.  An ISPF panel will be presented which will allow you to enter
 the CLIST name and any parameters to pass.  Note : If the CLIST uses the
 DGBSWTCH ISPF variable for debug processing, it will be automatically set to
 "ON".  Otherwise, you may pass any necessary parameters to turn on CLIST
 messages.  Nested CLISTs will not be trapped if invoked via ISPEXEC SELECT.
 You must use TSO invocation.
            


Leave a Reply

Your email address will not be published. Required fields are marked *