DEBUGCMD: Allow TSO TEST to intercept abends in SELECT CMD() calls

Using TSO TEST to debug programs that run under ISPF can be difficult because ISPF intercepts ABENDs that occur when a program is called via ISPEXEC SELECT CMD(). This little REXX exec zaps some ISPF code to allow TSO TEST to intercept ABENDs in commands.

Warning: This code is very release dependent. It may fail at any time and is definitely not supported by IBM. I can't recall the reason that this isn't in the product. It may be a compatibility issue with some products, but it has been too long since I discussed it with Dialog Manager developers for me to remember.

DEBUGCMD is available as source code.

To save the source code using Netscape or Internet Explorer, select the link above with the right mouse button and select 'Save Link As...' or Save Target as...'

Function

Enable TSO TEST to intercept ABENDs in programs called by ISPF's SELECT CMD() service.

Calling Syntax from ISPF:

 TSO DEBUGCMD

DEBUGCMD toggles the interception on or off. If interception is already enabled, DEBUGCMD will disable it again.

Output

A message will be shown indicating success or failure.

Installation

  1. Place debugcmd.txt in a library allocated to SYSEXEC or SYSPROC. This command will only work when module ISPSUBX is in writable storage (not pulled from LPA).

Samples

Not applicable

Source

/* REXX Enable TSO TEST trapping of SELECT CMD(xxx) programs.        */
/* Very release dependent and subject to breakage at any time.       */
/* DO NOT USE AS PART OF A SUPPORTED INTERFACE.  Side effects unknown*/
/* This code is not supported . Doug Nadel                           */
catp = ptr(16+ptr(120+ptr(56+ptr(ptr(24+ptr(112+ptr(132+ptr(540))))))))
found = 0
do offset = 40 to 50 by 2 until found = 1
if  storage(d2x(offset+catp),2)='9210'x then /* MVI INSTR */
  do; /* alter the setrp to be rc=0 */
    if '' \= storage(d2x(offset+catp),2,'9200'x) then
      do
        say 'TSO TEST will now catch abends in SELECT CMD() commands'
        found = 1
      end
  end;
else
  if  storage(d2x(46+catp),2)='9200'x then
   do; /* alter the setrp to be rc=16 */
    if ''\ = storage(d2x(46+catp),2,'9210'x) then
     do
      say 'TSO TEST will no longer trap abends in SELECT CMD() commands'
      found = 1
     end;
   end;
end
if found=0 then
  do
    say 'SELECT CMD() abend handling was not changed.'
    say 'Module ISPSUBX must not be in read-only storage.'
    say 'You can preload ISPSUBX with TSO TEST before starting ISPF.'
    say 'For example:'
    Say
    say '    TEST ''SYS1.ISP.SISPLPA(ISRPCP)'' CP'
    say '    ISPF TEST'
    SAY '    LOAD ''SYS1.ISP.SISPLPA(ISPSUBX)'''
    say '    GO'
    Say
  end
exit
ptr: Return c2d(bitand(storage(d2x(Arg(1)),4),'7FFFFFFF'x))
DEBUGCMD: Allow TSO TEST to intercept abends in SELECT CMD() calls