/* REXX */
/* CLS2REXXed by UMLA01S on 26 Aug 2020 at 09:26:06  */
/*trace r?*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
 
/*********************************************************************/
/* 08/26/2020 CL Fenton Converted script from CLIST to REXX.         */
/* 01/29/2026 CL Fenton Changes made in output messages.             */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CARC0004 01/29/26"
CONSLIST = "OFF"                  /* DEFAULT IS OFF                  */
COMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
SYMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
TERMMSGS = "OFF"                  /* DEFAULT IS OFF                  */
CACC1000 = "CACC1000"
CARM0008 = "CARM0008"
CART0002 = "CART0002"
TRACE    = "OFF"
lminit_temp5_error     = "N/A"
lminit_sensitve_error  = "N/A"
lminit_cntl_error      = "N/A"
lmopen_temp5_error     = "N/A"
lmopen_sensitve_error  = "N/A"
view_cntl_error        = "N/A"
rm8vge                 = "N/A"
lmclose_temp5_error    = "N/A"
lmclose_sensitve_error = "N/A"
lmfree_sensitve_error  = "N/A"
 
/***********************************************/
/* CONSLIST = CONLIST                          */
/* COMLIST = LIST                              */
/* SYMLIST = SYSSYMLIST                        */
/* TERMMSGS = MESSAGES                         */
/* TRACE TURNS ON MESSAGING                    */
/***********************************************/
 
 
INITIALIZE:
return_code = 0                   /* SET RETURN CODE TO 0            */
sysprompt = "OFF"                 /* CONTROL NOPROMPT                */
sysflush = "OFF"                  /* CONTROL NOFLUSH                 */
sysasis = "ON"                    /* CONTROL ASIS - caps off         */
Numeric digits 10                 /* default of 9 not enough         */
maxcc = 0
 
Arg OPTION
If option <> "" then do until OPTION = ""
  parse var OPTION key"("val")" OPTION
  val = strip(val,"b","'")
  val = strip(val,"b",'"')
  optcmd = key '= "'val'"'
  interpret optcmd
  end
 
return_code = 0
If trace = "ON" then do            /* TURN messages on          */
  termmsgs = "ON"                  /* CONTROL MSG               */
  comlist = "ON"                   /* CONTROL LIST              */
  conslist = "ON"                  /* CONTROL CONLIST           */
  symlist = "ON"                   /* CONTROL SYMLIST           */
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" | TRACE = "ON",
  then Trace ?r
 
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"
"CONTROL ERRORS RETURN"
zispfrc = 0
"VPUT (ZISPFRC) SHARED"
 
"VPUT (CONSLIST COMLIST SYMLIST TERMMSGS) ASIS"
return_code = 0
 
"SELECT CMD("cacc1000 "ACP)"
"VGET (ACPNAME ACPVERS) ASIS"
If acpname <> "RACF" then do
  Say pgmname "RACF Job running on the wrong system"
  Say pgmname acpname acpvers
  return_code = 20
  SIGNAL ERR_EXIT
  end
 
/*******************************************/
/* INITIALIZE LIBRARY MANAGEMENT           */
/*******************************************/
 
 
LIBRARY_INITIALIZE:
return_code = 0
"LMINIT DATAID(TEMP5) DDNAME(TEMP5)"
If return_code <> 0 then do
  lminit_temp5_error = return_code
  SIGNAL ERR_EXIT    /* EXIT */
  end
 
"LMINIT DATAID(SENSITVE) DDNAME(SENSITVE)"
If return_code <> 0 then do
  lminit_sensitve_error = return_code
  SIGNAL ERR_EXIT    /* EXIT */
  end
 
"LMINIT DATAID(CNTL) DDNAME(CNTL)"
If return_code <> 0 then do
  lminit_cntl_error = return_code
  SIGNAL ERR_EXIT    /* EXIT */
  end
 
/*******************************************/
/* OPEN DATASETS                           */
/*******************************************/
"LMOPEN DATAID("temp5") OPTION(INPUT)"                  /* OPEN TEMP */
If return_code <> 0 then do
  lmopen_temp5_error = return_code
  SIGNAL ERR_EXIT    /* EXIT */
  end
 
"LMOPEN DATAID("sensitve") OPTION(OUTPUT)"
If return_code <> 0 then do
  lmopen_sensitve_error = return_code
  SIGNAL ERR_EXIT    /* EXIT */
  end
 
/*******************************************/
/* PUT VARS IN POOL                        */
/*******************************************/
"VPUT (TEMP5 SENSITVE) ASIS"
 
/*******************************************/
/* GET TABLE VALUES                        */
/*******************************************/
"VIEW DATAID("cntl") MACRO("carm0008") MEMBER("cart0002")"
If return_code > 4 then do
  view_cntl_error = return_code
  SIGNAL ERR_EXIT    /* EXIT */
  end
 
"VGET (RM8VGE ICNT TROWS) ASIS"
 
Do CNT = 1 to icnt
  "VGET (ALPHA"cnt "BETA"cnt") ASIS"
  end
 
/*******************************************/
/* EDIT RACF REPORTS                       */
/*******************************************/
Do CNT = 1 to icnt
  alpha = strip(value("ALPHA"cnt))
  beta = value("BETA"cnt)
  return_code = 0
 
  "LMMFIND DATAID("temp5") MEMBER("alpha")"
  If return_code <> 0 then do
    /*******************************************/
    /* PUT HEADINGS OUT                        */
    /*******************************************/
    headline = "             "alpha"                     "
    ac = headline
    "LMPUT DATAID("sensitve") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)") MEMBER("alpha")"
    headline = left(" ",133,"=")
    ac = headline
    "LMPUT DATAID("sensitve") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)") MEMBER("alpha")"
    ac = "  "
    "LMPUT DATAID("sensitve") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)") MEMBER("alpha")"
    headline = " The Resources in this catagory do not exist or",
      "have not been defined."
    ac = headline
    "LMPUT DATAID("sensitve") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)") MEMBER("alpha")"
    "LMMREP DATAID("sensitve") MEMBER("alpha")"
    iterate
    end
  Else do
    /*******************************************/
    /* PUT VARS IN POOL                        */
    /*******************************************/
    aprefix = alpha
    "VPUT (APREFIX ALPHA BETA XTITLE ICNT TROWS) ASIS"
    If beta = 1 then do
      "EDIT DATAID("temp5") MACRO(CARM0062) MEMBER("alpha")"
      If return_code > 4 then do
        Say pgmname "EDIT ERROR" alpha "      " return_code
        end
      end
    Else do
      "EDIT DATAID("temp5") MACRO(CARM0061) MEMBER("alpha")"
      If return_code > 4 then do
        Say pgmname "EDIT ERROR" alpha "      " return_code
        end
      end
    end
CONTINUE2:
  end
 
 
/*******************************************/
/* CLOSE OUTPUT                            */
/*******************************************/
CLOSEUP:
return_code = 0
"LMCLOSE DATAID("temp5")"
If return_code <> 0 then do
  lmclose_temp5_error = return_code
  end
 
return_code = 0
"LMCLOSE DATAID("sensitve")"
If return_code <> 0 then do
  lmclose_sensitve_error = return_code
  end
/*******************************************/
/* FREE FILES                              */
/*******************************************/
return_code = 0
"LMFREE DATAID("sensitve")"
If return_code <> 0 then do
  lmfree_sensitve_error = return_code
  end
return_code = 0
"LMFREE DATAID("temp5")"
If return_code <> 0 then do
  lmfree_temp5_error = return_code
  end
 
 
/*******************************************/
/* ERROR EXIT                              */
/*******************************************/
ERR_EXIT:
If maxcc >= 16 | return_code > 0 then do
    "VGET (ZISPFRC) SHARED"
  If maxcc > zispfrc then,
    zispfrc = maxcc
  Else,
    zispfrc = return_code
  "VPUT (ZISPFRC) SHARED"
  Say pgmname "ZISPFRC =" zispfrc
  end
return_code = 0
If termmsgs = "ON" then do
  Say "==============================================================="
  Say pgmname "LMINIT_TEMP5_ERROR                "lminit_temp5_error
  Say pgmname "LMINIT_SENSITVE_ERROR             "lminit_sensitve_error
  Say pgmname "LMINIT_CNTL_ERROR                 "lminit_cntl_error
  Say pgmname "LMOPEN_TEMP5_ERROR                "lmopen_temp5_error
  Say pgmname "LMOPEN_SENSITVE_ERROR             "lmopen_sensitve_error
  Say pgmname "VIEW_CNTL_ERROR                   "view_cntl_error
  Say pgmname "    RM8VGE                        "rm8vge
  Say pgmname "LMCLOSE_TEMP5_ERROR               "lmclose_temp5_error
  Say pgmname "LMCLOSE_SENSITVE_ERROR            "lmclose_sensitve_error
  Say pgmname "LMFREE_SENSITVE_ERROR             "lmfree_sensitve_error
  Say "==============================================================="
  end
Exit
 
 
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)
  end
if return_code > maxcc then
  maxcc = return_code
return
 
 
