/* REXX LISTCSUM Parse and isolate LISTCAT output to discrete, identifiable packets. This was inspired by Jim Connelley's VC (which I recast as VCX). VC's parsing is very complex and difficult to understand. LISTCSUM organizes and externalizes that function. Use '(routine name) ?' for HELP-text. Written by Frank Clarke rexxhead@yahoo.com 20020318 Impact Analysis . SYSEXEC TRAPOUT Modification History 20020423 fxc enable OUTPUT; if CLUSTERASSOCIATIONS is empty, get clustername from DATAASSOCIATIONS or INDEXASSOCIATIONS and restart the command; 20020507 fxc no hyphens in keys 20020722 fxc leave queue intact if STACK 20030331 fxc GDGBASE implies NONVSAM and SUMMARY 20041025 fxc enable AIX and PATH; 20050304 fxc correct processing of GDGs (involved VCX); 20050428 fxc enable DCB; forced upgrade from v.20010802 to v.20040227; 20161018 fxc added call to FIND_ORIG 20210412 fxc corrected infinite loop; upgrade REXXSKEL from v.20040227 to v.20210402; disable DCB 20230418 fxc adjust HELP; 20230510 fxc Save log for error or if requested 20230723 fxc modernize logging; 20230729 fxc clip long lines; 20230810 fxc set msglim based on screen width; drop DISPLAY as a parm; 20230815 fxc better logging; allow TSO-format dsname; 20230824 fxc CB_SUBROGATE was passing clustername unquoted; 20230908 fxc set log lrecl to 255; 20231216 fxc changed all 4096 lrecl to 255; 20240308 fxc chg dollar-sign to @ everywhere; 20240415 fxc DUMP_QUEUE quiet; 20240529 fxc remove exec name from most log messages; */ arg argline address TSO /* REXXSKEL ver.20210402 */ arg parms "((" opts signal on syntax signal on novalue call TOOLKIT_INIT /* conventional start-up -*/ rc = Trace("O") rc = Trace(tv) info = parms /* to enable parsing */ call A_INIT /* -*/ if sw.0error_found then return call B_LISTC /* -*/ call C_PARSE /* -*/ call D_REPORT /* -*/ if sw.0error_found + sw.0savelog > 0 then, call ZB_SAVELOG /* -*/ if sw.0STACK then return /* leave the queue intact */ if \sw.nested then call DUMP_QUEUE 'quiet' /* -*/ exit /*@ LISTCSUM */ /* . ----------------------------------------------------------------- */ A_INIT: /*@ */ if branch then call BRANCH address TSO call AA_SETUP_LOG /* -*/ call AB_KEYWDS /* -*/ major_keys = "ALIAS NONVSAM CLUSTER AIX DATA INDEX PATH SUMM" minor_keys. = "" minor_keys.alias = "INCAT HISTORY ASSOCIATIONS" minor_keys.nonvsam = "INCAT HISTORY SMSDATA VOLUMES", "ASSOCIATIONS ATTRIBUTES" minor_keys.gdgbase = "INCAT HISTORY ASSOCIATIONS ATTRIBUTES" minor_keys.cluster = "INCAT HISTORY SMSDATA RLSDATA ASSOCIATIONS" minor_keys.data = "INCAT HISTORY ASSOCIATIONS ATTRIBUTES", "STATISTICS ALLOCATION VOLUME" minor_keys.index = "INCAT HISTORY ASSOCIATIONS ATTRIBUTES", "STATISTICS ALLOCATION VOLUME" minor_keys.aix = "INCAT HISTORY ASSOCIATIONS ATTRIBUTES" minor_keys.path = "INCAT HISTORY ASSOCIATIONS ATTRIBUTES" minor_keys.SUMM = "ARY" parse value "" with , keylist key valuestr. . return /*@ A_INIT */ /* . ----------------------------------------------------------------- */ AA_SETUP_LOG: /*@ */ if branch then call BRANCH address TSO msglim = SYSVAR( "SYSWTERM" ) - 12 parse value "0 0 0 0 0" with, log# log. . parse value Date("S") Time("S") Time("N") with, yyyymmdd sssss hhmmss . hhmmss = Space( Translate( hhmmss,' ',':' ) ,0 ) parse var yyyymmdd 4 yrdigit 5 mm 7 dd /* 9 12 14 maybe */ if Pos(yrdigit,"13579") > 0 then mm = mm + 12 /* mm=24 */ logtag = Substr("ABCDEFGHIJKLMNOPQRSTUVWX",mm,1) /* logtag=X */ subid = logtag""dd""Left( hhmmss,4 ) /* X141743 ? */ vb255.0 = "NEW CATALOG UNIT(SYSDA) SPACE(1 5) TRACKS", "RECFM( V B ) LRECL( 255 ) BLKSIZE( 0 )" logdsn = "@LOG."exec_name"."subid".LIST" logpref = "("Branch( "ID" )")" call ZL_LOGMSG( logpref, exec_name "started by" Userid() yyyymmdd hhmmss ) call ZL_LOGMSG( logpref "Arg:" argline ) return /*@ AA_SETUP_LOG */ /* . ----------------------------------------------------------------- */ AB_KEYWDS: /*@ */ if branch then call BRANCH address TSO sw.0stack = SWITCH("STACK") /* return results to stack */ outdsn = KEYWD("OUTPUT") /* save output on DASD */ if outdsn <> "" then do sw.0stack = 1 /* force stack */ alloc.0 = "NEW CATALOG UNIT( SYSDA ) SPACE( 5 5 ) TRACKS", "RECFM( V B ) LRECL( 255 ) BLKSIZE( 0 )" alloc.1 = "SHR" /* if it already exists... */ tempstat = Pos(Sysdsn(outdsn),"OK MEMBER NOT FOUND") > 0 "ALLOC FI(@TMP) DA("outdsn") REU" alloc.tempstat if rc > 0 then do sw.0error_found = 1 return end end /* outdsn */ parse var info vsds info if vsds = "" then do say "DSName required" exit end if Left( vsds,1 ) <> "'" then , vsds = "'"Userid()"."vsds"'" /* fully qualified now */ return /*@ AB_KEYWDS */ /* . ----------------------------------------------------------------- */ B_LISTC: /*@ */ if branch then call BRANCH address TSO "ALLOC FI(SYSPRINT) UNIT(VIO) NEW REU SPACE(1) TRACKS", "RECFM(V B A) LRECL(121) BLKSIZE(0)" "ALLOC FI(SYSIN) UNIT(VIO) NEW REU SPACE(1) TRACKS", "RECFM(F B) LRECL(80) BLKSIZE(0)" "NEWSTACK" queue " LISTCAT ENTRIES("vsds") ALL" "EXECIO" queued() "DISKW SYSIN (FINIS" "DELSTACK" address LINKMVS "IDCAMS" logpref = "("Branch( "ID" )")" call ZL_LOGMSG( logpref "IDCAMS RC="rc ) return /*@ B_LISTC */ /* . ----------------------------------------------------------------- */ C_PARSE: /*@ */ if branch then call BRANCH address TSO "NEWSTACK" "EXECIO * DISKR SYSPRINT (FINIS" /* load the queue */ logpref = "("Branch( "ID" )")" call ZL_LOGMSG( logpref , queued() "lines read from SYSPRINT" ) call CA_PACKETIZE /* -*/ call CB_SUBROGATE /* locate base entry if nec. -*/ call CS_SUMMARY /* -*/ "DELSTACK" return /*@ C_PARSE */ /* Read the main sections of the listing and collect all the data into strings. . ----------------------------------------------------------------- */ CA_PACKETIZE: /*@ */ if branch then call BRANCH address TSO key = "UNSET" /* for cases where 'key' is not yet set, this traps any spurious data */ keylist = key logpref = "("Branch( "ID" )")" do queued() parse pull cc 2 w1 rest if w1 = "" then iterate /* whole line is blank */ call ZL_LOGMSG( logpref w1 rest ) if WordPos(w1,"IDCAMS LISTCAT") > 0 then iterate if Pos("DATA SET ENCRYPTION",w1 rest) > 0 then iterate if w1 = "IN-CAT" then w1 = "INCAT" select when WordPos(w1,"THE") > 0 then leave /* end of the list */ when WordPos(w1,"GDG") > 0 then do /* special case: major name is two words */ parse var rest w2 rest if w2 = "BASE" then, /* reset major_keys */ parse value "GDGBASE NONVSAM SUMM" with , major_keys 1 w1 . key = w1 major = w1 if WordPos(key,keylist) = 0 then keylist = keylist key rest = Translate(rest," ","-") valuestr.key = Space(rest,1) /* strip */ end /* GDG BASE */ when WordPos(w1,major_keys) > 0 then do major = w1 key = w1 if WordPos(key,keylist) = 0 then keylist = keylist key rest = Translate(rest," ","-") valuestr.major = Space(rest,1) /* strip */ end /* major */ when WordPos(w1,minor_keys.major) > 0 then do minor = w1 key = Space(major minor,0) if WordPos(key,keylist) = 0 then keylist = keylist key data = Translate(rest," ","-") valuestr.key = Space(data,1) /* strip */ end /* minor */ otherwise do data = Translate(w1 rest," ","-") valuestr.key = valuestr.key Space(data,1) /* strip */ end /* value line */ end /* select */ end /* queued */ if Words( keylist ) > 1 then, keylist = Subword( keylist, 2 )/* elim UNSET */ call ZL_LOGMSG( logpref "Keylist :" keylist ) if monitor then do w1 = "" say "Keylist display for MONITOR" do Words(keylist) parse value keylist w1 with w1 keylist if valuestr.w1 = "" then w1 = "" /* remove it */ else, call ZL_LOGMSG( logpref Left(w1,20) valuestr.w1 ) end /* keylist */ parse value keylist w1 with keylist /* restore */ end /* monitor */ rc = Trace("O") ; rc = Trace(tv) return /*@ CA_PACKETIZE */ /* We might have been fed something other than the base name. To get all the proper parts, we must re-do the LISTCAT with a base name specification. The first token in ~~ASSOCIATIONS will be the base tag. If the LISTCAT is redone, this subroutine will force an EXIT from the original invocation. . ----------------------------------------------------------------- */ CB_SUBROGATE: /*@ */ if branch then call BRANCH address TSO info = valuestr.CLUSTER valuestr.NONVSAM valuestr.GDGBASE if info <> "" then return /* we already have it */ /* Most of these are empty, but one at least will have data */ info = valuestr.DATAASSOCIATIONS valuestr.INDEXASSOCIATIONS , valuestr.ALIASASSOCIATIONS valuestr.NONVSAMASSOCIATIONS , valuestr.AIXASSOCIATIONS valuestr.GDGBASEASSOCIATIONS , valuestr.PATHASSOCIATIONS valuestr.CLUSTERASSOCIATIONS basetag = Word(info,1) /* CLUSTER AIX or NONVSAM */ if basetag = "NONVSAM" & , valuestr.NONVSAMASSOCIATIONS = "" then, if info <> "" then do /* re-do the command */ "DELSTACK" /* stack before CALL */ nonvsamname = KEYWD("NONVSAM") /* delivers unquoted */ (exec_name) "'"nonvsamname"'" argline exit end ; else nop else, if basetag = "CLUSTER" & , valuestr.CLUSTERASSOCIATIONS = "" then, if info <> "" then do /* re-do the command */ "DELSTACK" /* stack before CALL */ clustername = KEYWD("CLUSTER") /* delivers unquoted */ (exec_name) "'"clustername"'" argline exit end ; else nop else, if basetag = "AIX" & , valuestr.AIXASSOCIATIONS = "" then, if info <> "" then do /* re-do the command */ "DELSTACK" /* stack before CALL */ clustername = KEYWD("AIX") (exec_name) clustername argline exit end ; else nop /* else, if basetag = "GDG" & , valuestr.GDGBASEASSOCIATIONS = "" then, if info <> "" then do /* re-do the command */ "DELSTACK" /* stack before CALL */ gdgname = KEYWD("GDG") /* GDGBASE name */ (exec_name) gdgname argline exit end ; else nop */ return /*@ CB_SUBROGATE */ /* . ----------------------------------------------------------------- */ CS_SUMMARY: /*@ */ if branch then call BRANCH address TSO major = "SUMM" /* This is kinda hokey... */ key = "SUMMARY" do queued() /* gross stats */ parse pull 2 w1 rest if w1 = "" then iterate select when WordPos(w1,"THE") > 0 then leave otherwise do data = Translate(w1 rest," ","-") valuestr.key = valuestr.key Space(data,1) /* strip */ end /* value line */ end /* select */ end /* queued */ return /*@ CS_SUMMARY */ /* Load the queue with tag-value pairs . ----------------------------------------------------------------- */ D_REPORT: /*@ */ if branch then call BRANCH address TSO if \sw.0STACK then "CLEAR" if outdsn <> "" then "NEWSTACK" /* isolate the queue */ do Words(major_keys) /* each major key */ parse var major_keys major major_keys if valuestr.major = "" then nop ; else, if sw.0stack then, queue major":" valuestr.major else do say major say " "valuestr.major end do Words(minor_keys.major) /* each minor key */ parse var minor_keys.major minor minor_keys.major key = Space(major minor,0) if valuestr.key = "" then iterate if sw.0stack then, queue key":" valuestr.key else do say key text = " "valuestr.key do while( Length( text ) > msglim ) pt = LastPos( " ",text,msglim ) parse var text slug =(pt) text say slug text = " "text end /* long text */ say text end end /* minor */ end /* major */ if outdsn <> "" then do "EXECIO" queued() "DISKW @TMP (FINIS" "FREE FI(@TMP)" "DELSTACK" end return /*@ D_REPORT */ /* . ----------------------------------------------------------------- */ LOCAL_PREINIT: /*@ customize opts */ address TSO sw.0savelog = SWITCH( "LOG" ) return /*@ LOCAL_PREINIT */ /* subroutines below LOCAL_PREINIT are not selected by SHOWFLOW */ /* . ----------------------------------------------------------------- */ ZB_SAVELOG: /*@ */ if branch then call BRANCH address TSO if Symbol("LOG#") = "LIT" then return /* not yet set */ "ALLOC FI(@LOG) DA("logdsn") REU" vb255.0 "EXECIO" log# "DISKW @LOG (STEM LOG. FINIS" "FREE FI(@LOG)" return /*@ ZB_SAVELOG */ /* . ----------------------------------------------------------------- */ ZL_LOGMSG: Procedure expose, /*@ */ (tk_globalvars) log. log# msglim rc = Trace("O") address TSO parse arg msgtext /* for making the msgline always reasonably short: */ do while Length(msgtext) > msglim pt = LastPos(" ",msgtext,msglim) slug = Left(msgtext,pt) if monitor then say, slug parse value log#+1 slug with, zz log.zz 1 log# . msgtext = " "Substr(msgtext,pt) end /* while msglim */ parse value log#+1 msgtext with, zz log.zz 1 log# . if monitor then say, msgtext return /*@ ZL_LOGMSG */ /* Find where code was run from. It assumes cataloged data sets. Original by Doug Nadel With SWA code lifted from Gilbert Saint-flour's SWAREQ exec . ----------------------------------------------------------------- */ FIND_ORIGIN: Procedure /*@ */ answer="* UNKNOWN *" /* assume disaster */ Parse Source . . name dd ds . /* get known info */ Call listdsi(dd "FILE") /* get 1st ddname from file */ Numeric digits 10 /* allow up to 7FFFFFFF */ If name = "?" Then /* if sequential exec */ answer="'"ds"'" /* use info from parse source */ Else /* now test for members */ If sysdsn("'"sysdsname"("name")'")="OK" Then /* if in 1st ds */ answer="'"sysdsname"("name")'" /* go no further */ Else /* hooboy! Lets have some fun!*/ Do /* scan tiot for the ddname */ tiotptr=24+ptr(12+ptr(ptr(ptr(16)))) /* get ddname array */ tioelngh=c2d(stg(tiotptr,1)) /* nength of 1st entry */ Do Until tioelngh=0 | tioeddnm = dd /* scan until dd found */ tioeddnm=strip(stg(tiotptr+4,8)) /* get ddname from tiot */ If tioeddnm <> dd Then /* if not a match */ tiotptr=tiotptr+tioelngh /* advance to next entry */ tioelngh=c2d(stg(tiotptr,1)) /* length of next entry */ End If dd=tioeddnm Then, /* if we found it, loop through the data sets doing an swareq for each one to get the dsname */ Do Until tioelngh=0 | stg(4+tiotptr,1)<> " " tioejfcb=stg(tiotptr+12,3) jfcb=swareq(tioejfcb) /* convert SVA to 31-bit addr */ dsn=strip(stg(jfcb,44)) /* dsname JFCBDSNM */ vol=storage(d2x(jfcb+118),6) /* volser JFCBVOLS (not used) */ If sysdsn("'"dsn"("name")'")='OK' Then, /* found it? */ Leave /* we is some happy campers! */ tiotptr=tiotptr+tioelngh /* get next entry */ tioelngh=c2d(stg(tiotptr,1)) /* get entry length */ End answer="'"dsn"("name")'" /* assume we found it */ End Return answer /*@ FIND_ORIGIN */ /* . ----------------------------------------------------------------- */ ptr: Return c2d(storage(d2x(Arg(1)),4)) /*@ */ /* . ----------------------------------------------------------------- */ stg: Return storage(d2x(Arg(1)),Arg(2)) /*@ */ /* . ----------------------------------------------------------------- */ SWAREQ: Procedure /*@ */ If right(c2x(Arg(1)),1) \= 'F' Then /* SWA=BELOW ? */ Return c2d(Arg(1))+16 /* yes, return sva+16 */ sva = c2d(Arg(1)) /* convert to decimal */ tcb = c2d(storage(21c,4)) /* TCB PSATOLD */ tcb = ptr(540) /* TCB PSATOLD */ jscb = ptr(tcb+180) /* JSCB TCBJSCB */ qmpl = ptr(jscb+244) /* QMPL JSCBQMPI */ qmat = ptr(qmpl+24) /* QMAT QMADD */ Do While sva>65536 qmat = ptr(qmat+12) /* next QMAT QMAT+12 */ sva=sva-65536 /* 010006F -> 000006F */ End return ptr(qmat+sva+1)+16 /*@ SWAREQ */ /* . ----------------------------------------------------------------- */ HELP: /*@ */ address TSO;"CLEAR" if helpmsg <> "" then say helpmsg; say "" ex_nam = Left(exec_name,8) /* predictable size */ say " "ex_nam" parses and summarizes the output of an IDCAMS LISTCAT " say " operation. " say " " say " Syntax: "ex_nam" dsname (Required) " say " OUTPUT odsn " say " STACK " say " (( LOG " say " " say " dsname identifies the component for which a LISTCAT is " say " to be done. " say " " say " odsn identifies the output dataset where the stack is " say " to be written. " say " " say " STACK places the parsed, summarized output on the queue " say " for use by a caller-routine. " say " " say " LOG requests that the logfile be saved at the end. " say " " say " more.... " "NEWSTACK"; pull ; "CLEAR" ; "DELSTACK" say " " say " Material placed on the stack is prefixed by its key and a colon (:) " say " followed by the value string. The following keys are delivered to the " say " stack if populated " say " " say " NONVSAMINCAT CLUSTERINCAT GDGBASEINCAT " say " NONVSAMHISTORY CLUSTERHISTORY GDGBASEHISTORY " say " NONVSAMASSOCIATIONS CLUSTERASSOCIATIONS GDGBASEASSOCIATIONS " say " NONVSAMATTRIBUTES CLUSTERSMSDATA GDGBASEATTRIBUTES " say " NONVSAMSMSDATA CLUSTERRLSDATA " say " NONVSAMVOLUMES INDEXINCAT " say " DATAINCAT INDEXHISTORY " say " AIXINCAT DATAHISTORY INDEXASSOCIATIONS " say " AIXHISTORY DATAASSOCIATIONS INDEXATTRIBUTES " say " AIXASSOCIATIONS DATAATTRIBUTES INDEXSTATISTICS " say " AIXATTRIBUTES DATASTATISTICS INDEXALLOCATION " say " DATAALLOCATION INDEXVOLUME " say " PATHINCAT DATAVOLUME " say " PATHHISTORY ALIASINCAT " say " PATHASSOCIATIONS SUMMARY ALIASHISTORY " say " PATHATTRIBUTES ALIASASSOCIATIONS " "NEWSTACK"; pull ; "CLEAR" ; "DELSTACK" say " " say " Debugging tools provided include: " say " " say " MONITOR displays key information throughout processing. " say " " say " BRANCH show all paragraph entries. " say " " say " TRACE tv will use value following TRACE to place the execution in" say " REXX TRACE Mode. " say " " say " " say " Debugging tools can be accessed in the following manner: " say " " say " TSO "ex_nam" parameters (( debug-options " say " " say " For example " say " " say " TSO "ex_nam" (( MONITOR TRACE ?R " if sysvar("SYSISPF") = "ACTIVE" then, address ISPEXEC "CONTROL DISPLAY REFRESH" exit /*@ HELP */ /* . ----------------------------------------------------------------- */ BRANCH: Procedure expose, /*@ */ sigl exec_name rc = trace("O") /* we do not want to see this */ arg brparm . origin = sigl /* where was I called from ? */ do currln = origin to 1 by -1 /* inch backward to label */ if Right(Word(Sourceline(currln),1),1) = ":" then do parse value sourceline(currln) with pgfname ":" . /* Label */ leave ; end /* name */ end /* currln */ select when brparm = "NAME" then return(pgfname) /* Return full name */ when brparm = "ID" then do /* wants the prefix */ parse var pgfname pgfpref "_" . /* get the prefix */ return(pgfpref) end /* brparm = "ID" */ otherwise say left(sigl,6) left(pgfname,40) exec_name "Time:" time("L") end /* select */ return /*@ BRANCH */ /* . ----------------------------------------------------------------- */ DUMP_QUEUE: /*@ Take whatever is in stack */ rc = trace("O") /* and write to the screen */ address TSO arg mode . "QSTACK" /* how many stacks? */ stk2dump = rc - tk_init_stacks /* remaining stacks */ if stk2dump = 0 & queued() = 0 then return if mode <> "QUIET" then, say "Total Stacks" rc , /* rc = #of stacks */ " Begin Stacks" tk_init_stacks , /* Stacks present at start */ " Excess Stacks to dump" stk2dump do dd = rc to tk_init_stacks by -1 /* empty each one. */ if mode <> "QUIET" then, say "Processing Stack #" dd " Total Lines:" queued() do queued();parse pull line;say line;end /* pump to the screen */ "DELSTACK" /* remove stack */ end /* dd = 1 to rc */ return /*@ DUMP_QUEUE */ /* Handle CLIST-form keywords added 20020513 . ----------------------------------------------------------------- */ CLKWD: Procedure expose info /*@ hide all except info */ arg kw kw = kw"(" /* form is 'KEY(DATA)' */ kw_pos = Pos(kw,info) /* find where it is, maybe */ if kw_pos = 0 then return "" /* send back a null, not found*/ rtpt = Pos(") ",info" ",kw_pos) /* locate end-paren */ slug = Substr(info,kw_pos,rtpt-kw_pos+1) /* isolate */ info = Delstr(info,kw_pos,rtpt-kw_pos+1) /* excise */ parse var slug (kw) slug /* drop kw */ slug = Reverse(Substr(Reverse(Strip(slug)),2)) return slug /*@CLKWD */ /* Handle multi-word keys 20020513 . ----------------------------------------------------------------- */ KEYWD: Procedure expose info /*@ hide all vars, except info*/ arg kw kw_pos = wordpos(kw,info) /* find where it is, maybe */ if kw_pos = 0 then return "" /* send back a null, not found*/ kw_val = word(info,kw_pos+Words(kw))/* get the next word */ info = Delword(info,kw_pos,2) /* remove both */ return kw_val /*@ KEYWD */ /* . ----------------------------------------------------------------- */ KEYPHRS: Procedure expose, /*@ */ info helpmsg exec_name /* except these three */ arg kp wp = wordpos(kp,info) /* where is it? */ if wp = 0 then return "" /* not found */ front = subword(info,1,wp-1) /* everything before kp */ back = subword(info,wp+1) /* everything after kp */ parse var back dlm back /* 1st token must be 2 bytes */ if length(dlm) <> 2 then /* Must be two bytes */ helpmsg = helpmsg, "Invalid length for delimiter("dlm") with KEYPHRS("kp")" if wordpos(dlm,back) = 0 then /* search for ending delimiter*/ helpmsg = helpmsg, "No matching second delimiter("dlm") with KEYPHRS("kp")" if helpmsg <> "" then call HELP /* Something is wrong */ parse var back kpval (dlm) back /* get everything b/w delim */ info = front back /* restore remainder */ return Strip(kpval) /*@ KEYPHRS */ /* . ----------------------------------------------------------------- */ NOVALUE: /*@ */ say exec_name "raised NOVALUE at line" sigl say " " say "The referenced variable is" condition("D") say " " zsigl = sigl signal SHOW_SOURCE /*@ NOVALUE */ /* . ----------------------------------------------------------------- */ SHOW_SOURCE: /*@ */ call DUMP_QUEUE /* Spill contents of stacks -*/ if sourceline() <> "0" then /* to screen */ say sourceline(zsigl) rc = trace("?R") nop exit /*@ SHOW_SOURCE */ /* . ----------------------------------------------------------------- */ SS: Procedure /*@ Show Source */ arg ssbeg ssend . if ssend = "" then ssend = 10 if \datatype(ssbeg,"W") | \datatype(ssend,"W") then return ssend = ssbeg + ssend do ssii = ssbeg to ssend ; say Strip(sourceline(ssii),'T') ; end return /*@ SS */ /* . ----------------------------------------------------------------- */ SWITCH: Procedure expose info /*@ */ arg kw sw_val = Wordpos(kw,info) > 0 /* exists = 1; not found = 0 */ if sw_val then /* exists */ info = Delword(info,Wordpos(kw,info),1) /* remove it */ return sw_val /*@ SWITCH */ /* . ----------------------------------------------------------------- */ SYNTAX: /*@ */ errormsg = exec_name "encountered REXX error" rc "in line" sigl":", errortext(rc) say errormsg zsigl = sigl signal SHOW_SOURCE /*@ SYNTAX */ /* Can call TRAPOUT. . ----------------------------------------------------------------- */ TOOLKIT_INIT: /*@ */ address TSO info = Strip(opts,"T",")") /* clip trailing paren */ parse source sys_id how_invokt exec_name DD_nm DS_nm, as_invokt cmd_env addr_spc usr_tokn parse value "" with tv helpmsg . parse value 0 "ISR00000 YES" "Error-Press PF1" with, sw. zerrhm zerralrm zerrsm if SWITCH("TRAPOUT") then do "TRAPOUT" exec_name parms "(( TRACE R" info exit end /* trapout */ sw.nested = sysvar("SYSNEST") = "YES" sw.batch = sysvar("SYSENV") = "BACK" sw.inispf = sysvar("SYSISPF") = "ACTIVE" if Word(parms,1) = "?" then call HELP /* I won't be back */ "QSTACK" ; tk_init_stacks = rc /* How many stacks? */ parse value SWITCH("BRANCH") SWITCH("MONITOR") SWITCH("NOUPDT") with, branch monitor noupdt . parse value mvsvar("SYSNAME") sysvar("SYSNODE") with, #tk_cpu node . parse value KEYWD("TRACE") "N" with tv . tk_globalvars = "exec_name tv helpmsg sw. zerrhm zerralrm ", "zerrsm zerrlm tk_init_stacks branch monitor ", "noupdt" call LOCAL_PREINIT /* for more opts -*/ return /*@ TOOLKIT_INIT */