/* REXX */
/* CLS2REXXed by UMLA01S on 15 Nov 2023 at 13:54:45  */
/*trace ?r*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"               /* CARM0103 EDIT RACFCMDS.RPT(*)  */
/*********************************************************************/
/* 09/10/2007 CL Fenton Copied from CARM0003 to evaluate resources.  */
/* 10/17/2007 CL Fenton Corrected 'NOT FOUND'/ICH13003I issue.       */
/* 11/30/2007 CL Fenton Corrected error by specifing fix start pos.  */
/* 04/17/2009 CL Fenton Mod for evaluation of RL with mask.          */
/* 07/16/2009 CL Fenton Changes CACT0001 to CACT0000, CACM042T to    */
/*            CACM000T.  Changes for reflect new table information.  */
/* 12/13/2009 CL Fenton Added IKJ56702I msg for no resource rule     */
/*            test.                                                  */
/* 04/13/2017 CL Fenton Corrected issue with FIRSTPO and LASTPO      */
/*            being equal.                                           */
/* 11/15/2023 CL Fenton Converted script from CLIST to REXX.         */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CARM0103 11/15/23"
sysprompt = 'OFF'
syssymlist = 'OFF'
sysconlist = 'OFF'
syslist = 'OFF'
sysmsg = 'ON'
return_code = 0   /* SET RETURN CODE TO 0 */
maxcc = 0
 
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMMSGS                                */
/*******************************************/
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS TEMP4",
  "RPTMBR TITLE) ASIS"
rm03vget = return_code
If return_code <> 0 then do
  Say pgmname "VGET RC =" return_code zerrsm
  Say pgmname "CONSLIST/"conslist "COMLIST/"comlist,
    "SYMLIST/"symlist "TERMMSGS/"termmsgs
  Say pgmname "TEMP4/"temp4 "RPTMBR/"rptmbr "TITLE/"title
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON",
  then Trace ?r
 
/*******************************************/
/* TURN ON MESSAGES                        */
/*******************************************/
syssymlist = symlist           /* CONTROL SYMLIST/NOSYMLIST */
sysconlist = conslist          /* CONTROL CONLIST/NOCONLIST */
syslist = comlist              /* CONTROL LIST/NOLIST       */
sysmsg = termmsgs              /* CONTROL MSG/NOMSG         */
 
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
"(MEMBER) = MEMBER"
 
title = substr(title,1,8)
rescl = " "
 
"(ENDER) = LINENUM .ZLAST"
 
/*******************************************/
/* MAIN LOOP                               */
/*******************************************/
 
 
LOOP:
do curline = 1 to ender
/*******************************************/
/* LOOK FOR DATASET                        */
/*******************************************/
  return_code = 0
  "(DATA) = LINE" curline
  data = data
  If pos("CARC1001",data) > 0 then do
    dsname = substr(data,20)
    rescl = substr(data,11,8)
    end
 
  If substr(data,1,8) = rescl then do
    /*******************************************/
    /* STRIP PROFILE                           */
    /*******************************************/
    racfpro = substr(data,12)
    ac = substr(racfpro,1,44)
    ac = ac"4"title dsname
    Address ISPEXEC "LMPUT DATAID("temp4") MODE(INVAR)",
      "DATALOC(AC) DATALEN("length(ac)") MEMBER("member")"
    end
 
  If pos("RESOURCE NOT FO",data) > 0 then do
    racfpro = " "
    ac = substr(racfpro,1,44)
    ac = ac"4"title dsname
    Address ISPEXEC "LMPUT DATAID("temp4") MODE(INVAR)",
      "DATALOC(AC) DATALEN("length(ac)") MEMBER("member")"
    end
 
  /*******************************************/
  /* STRIP UACC                              */
  /*******************************************/
  If pos("UNIVERSAL ACCESS",data) > 0 then do
    warn1 = ""
    curline = curline + 2
    "(DATA) = LINE" curline
    uacc1 = strip(substr(data,19,16),"B")
    warn1 = substr(data,51,1)
    warn1 = "WARN("warn1")"
    uacc = "UACC("uacc1")"
    end
 
  /*******************************************/
  /* LOOK FOR AUDIT PARMS                    */
  /*******************************************/
  If pos("AUDITING",data) = 1 then do
    audit1 = ""
    curline = curline + 2
    "(DATA) = LINE" curline
    audit1 = strip(data,"T")
    ac = substr(racfpro,1,44)
    ac = ac"1"uacc
    ac = substr(ac,1,59)warn1
    ac = substr(ac,1,67)"AUDIT("audit1")"
    Address ISPEXEC "LMPUT DATAID("temp4") MODE(INVAR)",
      "DATALOC(AC) DATALEN("length(ac)") MEMBER("member")"
    end
 
  /*******************************************/
  /* LOOK FOR WHO IS USING DATASET           */
  /*******************************************/
  If pos("USER      ACCESS",data) = 1 then do
    curline = curline + 2
    blank = " "
 
 
ID_CHECK:
    do curline = curline to ender
      "(DATA) = LINE" curline
      If substr(data,1,1) = " " |,
         data = "NO USERS IN ACCESS LIST" then,
        leave
  /*    SIGNAL LOOP*/
      usrid = substr(data,1,8)
      usracc = substr(data,11,8)
      If usrid = "*" then,
        groupid = "6GENERIC("usrid")     "
      Else,
        groupid = "8GROUPID("usrid")     "
 
      grpacc = "ACCESS("usracc")     "
      outline = substr(groupid,1,19) substr(grpacc,1,18)
      ac = substr(racfpro,1,44)
      ac = ac""outline
 
      Address ISPEXEC "LMPUT DATAID("temp4") MODE(INVAR) DATALOC(AC)",
        "DATALEN("length(ac)") MEMBER("member")"
 
/*    curline = curline + 1
      If curline = ender then,
          SIGNAL  END_EDIT
       SIGNAL  ID_CHECK*/
      end
    end
  end
 
 
END_EDIT:
return_code = 0
Address ISPEXEC "LMMADD DATAID("temp4") MEMBER("member")"
If return_code = 4 then do
  return_code = 0
  Address ISPEXEC "LMMREP DATAID("temp4") MEMBER("member")"
  If return_code <> 0 then,
    Say pgmname "LMMREP_TEMP4_RCODE =" return_code member zerrsm
  end
Else do
  If return_code <> 0 then,
    Say pgmname "LMMADD_TEMP4_RCODE =" return_code member   zerrsm
  end
 
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
  Address ISPEXEC "VPUT (ZISPFRC) SHARED"
  Say pgmname "ZISPFRC =" zispfrc
  end
 
rm003rc = return_code
Address ISPEXEC "VPUT (RM03VGET RM003RC) ASIS"
"END"
Exit 0
 
 
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 >= 16 then do
  say pgmname "LASTCC =" RC strip(zerrlm)
  say pgmname "REXX error" rc "in line" sigl":" ERRORTEXT(rc)
  say SOURCELINE(sigl)
  end
if return_code > maxcc then,
  maxcc = return_code
return
 
 
