/* REXX */
/* CLS2REXXed by UMLA01S on 26 May 2022 at 17:45:56  */
/*trace r?*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
sysprompt = 'OFF'
syssymlist = 'OFF'
sysconlist = 'OFF'
syslist = 'OFF'
sysmsg = 'ON'
 
"MACRO"
/*********************************************************************/
/* This edit macro (CATM0007) puts the finishing touches to the      */
/* WHOHxxxx member.                                                  */
/*********************************************************************/
/* 05/02/2019 CL FENTON Added additional accesses for CICS SPI       */
/*            permissions, STS-021044.                               */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CATM0007 05/26/22"
sysprompt = "OFF"                /* CONTROL NOPROMPT          */
sysflush = "OFF"                 /* CONTROL NOFLUSH           */
sysasis = "ON"                   /* CONTROL ASIS - caps off   */
Numeric digits 10                /* default of 9 not enough   */
maxcc = 0
tm07rep = 0
tm07vge = 0
zerrsm           = ""
zerrlm           = ""
zerrmsg          = ""
return_code = 0                   /* SET RETURN CODE TO 0  */
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
/*******************************************/
/* Variables are passed to this macro      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* RESOURCE                                */
/* NOUSR                                   */
/* OUTPUT                                  */
/* TERMMSGS                                */
/*******************************************/
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST RESOURCE NOUSR",
  "OUTPUT TERMMSGS) ASIS"
If return_code <> 0 then,
  TM07VGE = return_code
prof_test = "OFF"
 
 
MESSAGE_HOUSEKEEPING:
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" ,
  then Trace ?r
 
syssymlist = symlist          /* CONTROL SYMLIST/NOSYMLIST */
sysconlist = conslist         /* CONTROL CONLIST/NOCONLIST */
syslist = comlist             /* CONTROL LIST/NOLIST       */
sysmsg = termmsgs             /* CONTROL MSG/NOMSG         */
return_code = 0               /* SET RETURN CODE TO 0      */
 
If substr(resource,15,1) = "N" then,
  nousr = "ON"
"(MEMBER) = MEMBER"
"STATS = OFF"
"NUMBER OFF"
"AUTOSAVE ON"
 
 
CLEAN_UP:
"SORT 1 45 62 71 46 61"
"(ROW) = LINENUM .ZL"
line = 1
odata = ""
 
 
CLEAN_UP_LOOP:
Do line = 1 to row
  return_code = 0              /* SET RETURN CODE TO 0  */
  If line > row then leave
  "(DATA) = LINE" line
  If data = odata then do
    "CURSOR =" line 1
    "EXCLUDE ' '"
    end
  odata = data
  end
 
 
DELETE_EXCLUDE:
"DELETE ALL X"
"(ROW) = LINENUM .ZL"
row = row
line = 00001
Address ISPEXEC "LMOPEN  DATAID("output") OPTION(OUTPUT)"
ores = " "
 
 
LOOP:
Do line = 1 to row
  return_code = 0                         /* SET RETURN CODE TO 0  */
  If line > row then leave
  "(DATA) = LINE" line
  l = length(data)
  parse var data res 46 acid 54 type 62 acc8 70 audit 71 deny 72,
    facility "@ " otherinfo
  sp1 = ""
 
  If acid = "*ALL*" | acid = " " then nop
  Else do
    x = outtrap("var.")
    If type = " " then do
      var. = ""
      Address TSO "TSS LIST("acid")"
      If left(var.1,8) = "TSS LIST" then do
        name = substr(var.2,37)
        type = substr(var.3,14,8)
        end
      Else do
        name = substr(var.1,37)
        type = substr(var.2,14,8)
        end
      "CHANGE '"left(acid,16)"' '"acid""type"' ALL 46 61"
      end
    end
 
  If res > ores then do
    If ores <> " " then do
      cmd = "    "
      Address ISPEXEC "LMPUT DATAID("output") MODE(INVAR)",
        "DATALOC(CMD) DATALEN("length(cmd)")"
      end
    If audit = "X" then do
      cmd = "     "res"     AUDIT = YES"
      audit = ""
      end
    Else do
      cmd = "     "res
      end
    ores = res
    Address ISPEXEC "LMPUT DATAID("output") MODE(INVAR)",
      "DATALOC(CMD) DATALEN("length(cmd)")"
    end
  call Process_Data_Info
 
  If type = "PROFILE" | type = "GROUP" then do
    prof_test = "ON"
    If pos("NONE",access) > 0 then,
      prof_test = "OFF"
    If deny = "Y" then,
      prof_test = "OFF"
    If nousr <> "OFF" then,
      prof_test = "OFF"
    end
  Else iterate
 
  If prof_test = "OFF" then iterate
 
  x = outtrap("var.")
  var. = ""
  Address TSO "TSS LIST("acid") DATA(ACID)"
 
  sw = ""
  Do x = 1 to var.0
    a = var.x
    if pos("ACIDS",var.x) = 1 then sw = "ON"
    if sw = "ON" then do
      cmd = "               "sp1""substr(a,14)
      If cmd <> " " then do
        Address ISPEXEC "LMPUT DATAID("output") MODE(INVAR)",
          "DATALOC(CMD) DATALEN("length(cmd)")"
        end
      Else,
        sw = ""
      end
    return_code = 0
    end
 
  prof_test = "OFF"
  end
 
 
END_EDIT:
return_code = 0
Address ISPEXEC "LMMREP DATAID("output") MEMBER("member")"
If return_code <> 0 then,
  tm07rep = return_code
return_code = 0
 
 
ERR_EXIT:
If maxcc >= 16 | return_code > 0 then do
  Address ISPEXEC "VGET (ZISPFRC) SHARED"
  If maxcc > zispfrc then,
    zispfrc = maxcc
  Else,
    zispfrc = return_code
  Say pgmname "ZISPFRC =" zispfrc
  Address ISPEXEC "VPUT (ZISPFRC) SHARED"
  end
Address ISPEXEC "LMCLOSE DATAID("output")"
Address ISPEXEC "VPUT (TM07REP TM07VGE) SHARED"
"END"
Exit 0
 
 
/*******************************************/
/*  SYSCALL SUBROUTINES                    */
/*******************************************/
 
 
Process_Data_Info:
If acid = " " then Return
access = ""
Do y = 1 to 8
  If substr(acc8,y,1) = " " then leave
  acc = substr(acc8,y,1)
  If acc = "A" then acc = "ALL"
  If acc = "B" then acc = "ALTER"
  If acc = "C" then acc = "INSTALL"
  If acc = "D" then acc = "BLP"
  If acc = "E" then acc = "SCRATCH"
  If acc = "F" then acc = "CREATE"
  If acc = "G" then acc = "CONTROL"
  If acc = "H" then acc = "UPDATE"
  If acc = "I" then acc = "SET"
  If acc = "J" then acc = "COLLECT"
  If acc = "K" then acc = "DISCARD"
  If acc = "L" then acc = "PERFORM"
  If acc = "M" then acc = "WRITE"
  If acc = "N" then acc = "READ"
  If acc = "O" then acc = "INQUIRE"
  If acc = "P" then acc = "NOCREATE"
  If acc = "Q" then acc = "FETCH"
  If acc = "R" then acc = "EXECUTE"
  If acc = "S" then acc = "EXEC"
  If acc = "T" then acc = "NONE"
  If access = " " then,
    access = acc
  Else,
    access = access","acc
  end
 
If audit = "Y" then,
  audit = "AUDIT = YES"
Else,
  If audit = "N" then,
    audit = "AUDIT = NO "
  Else,
    audit = "           "
 
If deny = "Y" then,
  action = "ACTION = DENY"
Else,
  action = ""
 
If access = "" then,
  cmd = "          "acid type"     "audit"     "action
Else,
  cmd = "          "acid type"     ACCESS =" access"     "audit,
    "    "action
Address ISPEXEC "LMPUT DATAID("output") MODE(INVAR) DATALOC(CMD)",
  "DATALEN("length(cmd)")"
 
If facility <> "" then do
  cmd = "               FAC =" facility
  Address ISPEXEC "LMPUT DATAID("output") MODE(INVAR)",
    "DATALOC(CMD) DATALEN("length(cmd)")"
  sp1 = "     "
  end
 
If otherinfo = "" then Return
 
sp1 = "     "
otherinfo = strip(otherinfo,"T")
 
Do until otherinfo = ""
  parse var otherinfo other "³" otherinfo
  other = strip(other,"B")
  cmd = "               "other
  Address ISPEXEC "LMPUT DATAID("output") MODE(INVAR)",
    "DATALOC(CMD) DATALEN("length(cmd)")"
  end
 
Return
 
 
NoValue:
Failure:
Syntax:
say pgmname 'REXX error' rc 'in line' sigl':' strip(ERRORTEXT(rc))
say SOURCELINE(sigl)
SIGNAL ERR_EXIT
 
 
Error:
return_code = RC
if RC > 4 & RC <> 8 then do
  say pgmname "LASTCC =" RC strip(zerrlm)
  say pgmname 'REXX error' rc 'in line' sigl':' strip(ERRORTEXT(rc))
  say SOURCELINE(sigl)
  if return_code > maxcc then
    maxcc = return_code
  end
return
 
 
