/* REXX CRYPTED Edit without changing the stats Proper operation of this routine is dependent on the existence of the following line (or equivalent) in an active command table: SELECT CMD(%CRYPTED |&ZDSN |&ZMEM &ZMEMB |&ZPARM) You must start from BROWSE or VIEW on the data, or there will be an 'already-in-EDIT' conflict. Use '(routine name) ?' for HELP-text. Written by Frank Clarke 20010906 rexxhead@yahoo.com Impact Analysis . SYSEXEC FCCMDUPD . SYSEXEC TRAPOUT Modification History 20160906 fxc cloned from FIXSTATS 20230726 fxc adjust HELP; 20240415 fxc DUMP_QUEUE quiet; 20240604 fxc fixed switching; */ arg argline address ISPEXEC /* REXXSKEL ver.20010802 */ 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 */ "CONTROL ERRORS RETURN" /* I'll handle my own */ if info = "" then call HELP /* ...and don't come back -*/ call A_INIT /* -*/ if sw.0error_found then return call L_LM_FUNCS /* -*/ if \sw.nested then call DUMP_QUEUE 'quiet' /* -*/ exit /*@ CRYPTED */ /* "info" may arrive as a string of delimited tokens, the delimiter being the first character found in the info-string. The tokens are DSNAME, MEMBER, and other parms. The remaining parms are not individually delimited. As a result of this calling sequence, this routine ONLY operates on the member currently being edited, viewed, or browsed, and is only callable via a command-table entry. . ----------------------------------------------------------------- */ A_INIT: /*@ */ if branch then call BRANCH address TSO parse value Left(info,1) '4f'x with dlm . parse var info (dlm) zdsn . (dlm) zmem . (dlm) parms if zdsn = "" then call HELP /* -*/ if Word(parms,1) = "?" then call HELP /* ...and don't come back */ zdsnmbr = "'"zdsn"("zmem")'" zdsn = "'"zdsn"'" info = parms return /*@ A_INIT */ /* LMINIT - acquire a DATAID for DSN LMOPEN - make DSN ready for use LMMFIND - get original stats EDIT - update the data LMMSTATS - restore original stats LMCLOSE - release the DSN LMFREE - drop the DATAID . ----------------------------------------------------------------- */ L_LM_FUNCS: /*@ */ if branch then call BRANCH address ISPEXEC call LA_LMINIT /* perform the LMINIT -*/ if sw.0error_found then return call LD_USE_DATAID /* -*/ call LZ_LMFREE /* perform the LMFREE -*/ return /*@ L_LM_FUNCS */ /* . ----------------------------------------------------------------- */ LA_LMINIT: /*@ */ if branch then call BRANCH address ISPEXEC "LMINIT DATAID(ZOTZ) DATASET("zdsn") " if rc > 0 then do zerrsm = "LMINIT failed" zerrlm = lminit.rc "SETMSG MSG(ISRZ002)" sw.0error_found = 1 end return /*@ LA_LMINIT */ /* LMOPEN - Gather stats - LMCLOSE . ----------------------------------------------------------------- */ LD_USE_DATAID: /*@ */ if branch then call BRANCH address ISPEXEC call LDA_LMOPEN /* perform the LMOPEN -*/ if sw.0error_found then return call LDP_PROCESS_MBR /* -*/ call LDZ_LMCLOSE /* perform the LMCLOSE -*/ return /*@ LD_USE_DATAID */ /* . ----------------------------------------------------------------- */ LDA_LMOPEN: /*@ */ if branch then call BRANCH address ISPEXEC "LMOPEN DATAID("zotz") OPTION(INPUT)" if rc > 0 then do zerrsm = "LMOPEN failed" zerrlm = lmopen.rc "SETMSG MSG(ISRZ002)" sw.0error_found = 1 end return /*@ LDA_LMOPEN */ /* . ----------------------------------------------------------------- */ LDP_PROCESS_MBR: /*@ */ if branch then call BRANCH address ISPEXEC call LDPA_LMMFIND /* get original stats -*/ if sw.0error_found then return "EDIT DATAID("zotz") MEMBER("zmem") PROFILE(DEFAULT)" if sw.0error_found then return if noupdt then return call LDPF_LMMSTATS /* reload adjusted stats -*/ return /*@ LDP_PROCESS_MBR */ /* Get original stats . ----------------------------------------------------------------- */ LDPA_LMMFIND: /*@ */ if branch then call BRANCH address ISPEXEC "LMMFIND DATAID("zotz") MEMBER("zmem") STATS(YES)" if rc > 0 then do zerrsm = "LMMFIND failed" zerrlm = lmmfind.rc "SETMSG MSG(ISRZ002)" sw.0error_found = 1 end return /*@ LDPA_LMMFIND */ /* Load adjusted stats to the member. . ----------------------------------------------------------------- */ LDPF_LMMSTATS: /*@ */ if branch then call BRANCH address TSO "NEWSTACK" "ALLOC FI( @TMP ) DA(" zdsnmbr ") SHR REU" "EXECIO * DISKR @TMP (FINIS " zlcnorc = queued() /* current # of lines */ "FREE FI( @TMP ) " "DELSTACK" address ISPEXEC "LMMSTATS DATAID("zotz") MEMBER("zmem") VERSION("zlvers")", "MODLEVEL("zlmod") CREATED("zlcdate") MODDATE("zlmdate")", "MODTIME("zlmtime") CURSIZE("zlcnorc") INITSIZE("zlinorc")", "MODRECS("zlmnorc") USER("zluser") CREATED4("zlc4date")", "MODDATE4("zlm4date") " return /*@ LDPF_LMMSTATS */ /* . ----------------------------------------------------------------- */ LDZ_LMCLOSE: /*@ */ if branch then call BRANCH address ISPEXEC "LMCLOSE DATAID("zotz")" if rc > 0 then do zerrsm = "LMCLOSE failed" zerrlm = lmclose.rc "SETMSG MSG(ISRZ002)" sw.0error_found = 1 end return /*@ LDZ_LMCLOSE */ /* . ----------------------------------------------------------------- */ LZ_LMFREE: /*@ */ if branch then call BRANCH address ISPEXEC "LMFREE DATAID("zotz")" if rc > 0 then do zerrsm = "LMFREE failed" zerrlm = lmfree.rc "SETMSG MSG(ISRZ002)" sw.0error_found = 1 end return /*@ LZ_LMFREE */ /* . ----------------------------------------------------------------- */ LOCAL_PREINIT: /*@ customize opts */ address TSO if SWITCH("INSTALL") then do /* set tmpcmds */ queue "CRYPTED" /* zctverb */ queue "5" /* zcttrunc */ queue "SELECT CMD(%CRYPTED |&ZDSN |&ZMEM &ZMEMB |&ZPARM) " queue "Crypto-edit" /* zctdesc */ "FCCMDUPD" /* load the table */ exit end /* INSTALL */ lminit. = "Unknown return code" lminit.8 = "Data set or file not allocated because DDname not", "found or Data set or file organization not supported." lminit.12 = "Invalid parameter value " lminit.16 = "Truncation or translation error in accessing dialog", "variables." lminit.20 = "Severe error " lmopen. = "Unknown return code" lmopen.8 = "Open failed because Data set record format not", "supported by ISPF " lmopen.10 = "No data set associated with the dataid " lmopen.12 = "Invalid parameter value: Data set is already open", "or Cannot open data set allocated 'SHR' for output" lmopen.16 = "Truncation or translation error in storing defined", "variables " lmopen.20 = "Severe error" lmmfind. = "Unknown return code" lmmfind.4 = "Member not available" lmmfind.8 = "Member not found " lmmfind.10 = "No data set or file associated with the given dataid" lmmfind.12 = "Data set or file not open or not open for input", "because Data set is not an ISPF library or MVS", "partitioned data set or Invalid parameter value" lmmfind.16 = "Truncation or translation error in accessing dialog", "variables " lmmfind.20 = "Severe error " lmmstats. = "Unknown return code" lmmstats.4 = "No members match pattern or No member in data set" lmmstats.8 = "Member not found " lmmstats.10 = "No data set associated with the given dataid " lmmstats.12 = "Invalid parameter value: Data set is not open or is", "not partitioned " lmmstats.20 = "Severe error " lmclose. = "Unknown return code" lmclose.8 = "Data set is not open " lmclose.10 = "No data set associated with the given data id " lmclose.20 = "Severe error " lmfree. = "Unknown return code" lmfree.8 = "Free data set or file failed " lmfree.10 = "No data set or file associated with dataid " lmfree.20 = "Severe error " return /*@ LOCAL_PREINIT */ /* subroutines below LOCAL_PREINIT are not selected by SHOWFLOW */ /* . ----------------------------------------------------------------- */ HELP: /*@ */ address TSO;"CLEAR" if helpmsg <> "" then say helpmsg; say "" ex_nam = Left(exec_name,8) /* predictable size */ say " CRYPTED allows editing a member without changing the statistics. " say " The process is designed to be called via the command " say " table (only). " say " " say " Syntax: "ex_nam" no parms " say " (( INSTALL " say " " say " INSTALL requests that the commands necessary to use this be " say " loaded to the user's command table. This should be " say " the first request a user makes via CRYPTED. When " say " INSTALL is requested, it is the only function " say " performed. " say " " "NEWSTACK"; pull; "CLEAR"; "DELSTACK" say " Debugging tools provided include: " say " " say " BRANCH show all paragraph entries. " say " " say " TRACE tv will use value following TRACE to place the " say " execution in 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" (( INSTALL 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 */ /* . ----------------------------------------------------------------- */ 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+1) /* 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 zerrlm . 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 */ 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 . sw.nested = sysvar("SYSNEST") = "YES" sw.batch = sysvar("SYSENV") = "BACK" sw.inispf = sysvar("SYSISPF") = "ACTIVE" 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 */