/* REXX */
/* CLS2REXXed by FSOX001 on 12 Jul 2016 at 16:18:59  */
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"               /* CACM0401 EDIT TEMP1(*) */
/*********************************************************************/
/* 05/04/2004 JL Nelson Changed to collect new RACF findings.        */
/* 06/15/2004 JL Nelson Added EXIT code.                             */
/* 02/14/2005 JL Nelson Changed constants to variables before        */
/*            rename.                                                */
/* 03/14/2005 JL Nelson Added program name to output TEMP3           */
/* 03/16/2005 JL Nelson Correct length error code 864                */
/* 06/09/2005 JL Nelson Pass MAXCC in ZISPFRC variable               */
/* 06/15/2005 JL Nelson Reset return code to end job step            */
/* 03/03/2006 JL Nelson Made changes to avoid SUBSTR abend 920/932.  */
/* 03/20/2006 JL Nelson Use NRSTR avoid abend 900 if ampersand in    */
/*            data.                                                  */
/* 03/29/2006 JL Nelson Test for empty member LINENUM Rcode = 4.     */
/* 04/17/2006 JL Nelson Check datatype of index SCK.                 */
/* 02/27/2013 CL Fenton Added collection of APF AC=1 data sets and   */
/*            member for analysis in AAMV0060, CSD-AR001543814.      */
/* 07/14/2016 CL Fenton Converted script from CLIST to REXX.         */
/* 08/11/2016 CL Fenton Changed how process handles FIND command for */
/*            first time, STS-014866.                                */
/* 05/17/2018 CL Fenton Added "Not Reviewed" to AAMV0060 for vuls    */
/*            that require additional analysis, STS-019713.          */
/* 06/11/2021 CL Fenton Removed AAMV0060 STS-026844.                 */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CACM0001 06/11/21"
sysprompt = "OFF"                /* CONTROL NOPROMPT          */
sysflush = "OFF"                /* CONTROL NOFLUSH           */
sysasis = "ON"                 /* CONTROL ASIS - caps off   */
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMMSGS                                */
/* SORTPOS                                 */
/* FCMD                                    */
/* SCK                                     */
/*******************************************/
ac1_sw = "N"
return_code = 0
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS TEMP1",
  "TEMP2 TEMP3 FCMD ITER SCK SORTPOS) ASIS"
cm01vget = return_code
If return_code <> 0 then do
  Say pgmname "VGET RC =" return_code strip(zerrsm)
  Say pgmname "CONSLIST/"conslist "COMLIST/"comlist "SYMLIST/"symlist,
    "TERMMSGS/"termmsgs
  Say pgmname "TEMP1/"temp1 "TEMP2/"temp2 "TEMP3/"temp3 "FCMD/"fcmd,
    "ITER/"iter "SCK/"sck "SORTPOS/"sortpos
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" ,
  then Trace r
 
maxcc = 0
return_code = 0
/*******************************************/
/* TURN ON MESSAGES                        */
/*******************************************/
syssymlist = symlist          /* CONTROL SYMLIST/NOSYMLIST */
sysconlist = conslist         /* CONTROL CONLIST/NOCONLIST */
syslist = comlist          /* CONTROL LIST/NOLIST       */
sysmsg = termmsgs         /* CONTROL MSG/NOMSG         */
/*******************************************/
/* Main line                               */
/*******************************************/
"(MEMBER) = MEMBER"
"(DSNAME) = DATASET"
/* start of removal
If member = "APFXRPT" then do
  Address ISPEXEC "LMINIT DATAID(PDIDD) DDNAME(PDIDD)"
  lminit_pdidd_rc = return_code
  If return_code <> 0 then do
    Say pgmname "LMINIT_PDIDD_RC" return_code strip(zerrsm)
    SIGNAL ERR_EXIT
    end
  Address ISPEXEC "LMOPEN DATAID("pdidd") OPTION(OUTPUT)"
  lmopen_pdidd_rc = return_code
  If return_code <> 0 then do
    Say pgmname "LMOPEN_PDIDD_RC" return_code strip(zerrsm)
    SIGNAL ERR_EXIT
    end
  end
end of removal */
return_code = 0
"(LASTLINE) = LINENUM .ZLAST"
If return_code > 0 then do
  If lastline = 0 then
    Say pgmname "Empty file RCode =" return_code "DSN="dsname,
      "MEMBER="member strip(zerrsm)
  Else
    Say pgmname "LINENUM Error RCode =" return_code "DSN="dsname,
      "MEMBER="member strip(zerrsm)
  SIGNAL ERR_EXIT
  end
return_code = 0
"SORT" sortpos
cm01ster = return_code
If return_code > 4 then do
  Say pgmname "SORT" sortpos member "RC =" return_code strip(zerrsm)
  SIGNAL ERR_EXIT
  end
blank = " "
blk44 = "                                            "
old = " "
ocnt = 0
row = 1
col = 0
iter = left(iter,3)
If datatype(sck) <> "NUM" then do
  Say pgmname "SCK invalid" sck datatype(sck)
  sck = 1
  end
return_code = 0
 
/*******************************************/
/* MAIN LOOP                               */
/*******************************************/
do forever
  "CURSOR =" row col
  return_code = 0
  "FIND" fcmd
  cm01fer = return_code
  If return_code <> 0 then do
    If ocnt = 0 then do
      Say pgmname "FIND" fcmd member "RC =" return_code
      end
    leave
    end
  "(ROW,COL) = CURSOR"
  "(DATA) = LINE" row
  If sck+44 > length(data) |,
     substr(data,sck,1) = " " |,
     datatype(substr(data,sck,1)) <> "CHAR" then
    iterate
  If pos(".",substr(data,sck,45)) = 0 |,
     pos(". ",substr(data,sck,45)) > 0 |,
     old = substr(data,sck,45) then
    iterate
  return_code = 0
  old = substr(data,sck,45)
/*If member = "APFXRPT" then
    Call process_ac1 "DSN("old")"  end of removal */
  ac = substr(iter||old||blk44,1,50)
  ac = ac||pgmname
/*******************************************/
/* WRITE DATA TO TEMP3                     */
/*******************************************/
  return_code = 0
  Address ISPEXEC "LMPUT DATAID("temp3") MODE(INVAR) DATALOC(AC)
            DATALEN("length(ac)") NOBSCAN"
  cm01lper = return_code
  If return_code > 4 then do
    Say pgmname "LMPUT TEMP3" return_code strip(zerrsm)
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  ocnt = ocnt + 1
  end
/*******************************************/
/* END PROCESSES                           */
/*******************************************/
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
cm001rc = return_code
If ocnt = 0 then
  Say pgmname "No data set names were found for" iter member
Address ISPEXEC "VPUT (CM01VGET CM01STER CM01FER CM01LPER",
  "CM001RC) ASIS"
 
"END"
Exit (0)
 
 
PROCESS_AC1:
dsn = "NULLDSN"
Arg OPTION
do until OPTION = ""
  parse var OPTION key"("val")" OPTION
  optcmd = key '= "'val'"'
  interpret optcmd
  end
odsn = " "
return_code = 0                 /* SET RETURN CODE TO 0 */
Address ISPEXEC "CONTROL ERRORS RETURN"
loaddsn = strip(dsn)
/*loaddsn = loaddsn*/
Address ISPEXEC "LMINIT DATAID(LOAD) DATASET('"loaddsn"')"
If return_code > 0 then
  Return (0)
Address ISPEXEC "LMOPEN DATAID("load") OPTION(INPUT)"
return_code = 0
mem = ""
Address ISPEXEC "LMMLIST DATAID("load") OPTION(LIST) MEMBER(MEM)",
  "STATS(YES)"
Do while return_code = 0
  If zlac > 0 then do
    If ac1_sw = "N" then do
      ac1_sw = "Y"
      ac = "Not Reviewed"
      Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
        "DATALEN("length(ac)")"
      ac = "The annual review of APF-authorized libraries is not being",
        "performed for the following:"
      Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
        "DATALEN("length(ac)")"
      end
    If odsn <> dsn then do
      odsn = dsn
      ac = " "
      Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
        "DATALEN("length(ac)")"
      ac = "     "dsn
      Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
        "DATALEN("length(ac)")"
      end
    ac = "          "mem" AC=1"
    Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)")"
    end
  Address ISPEXEC "LMMLIST DATAID("load") OPTION(LIST) MEMBER(MEM)",
    "STATS(YES)"
  end
Address ISPEXEC "LMMLIST DATAID("load") OPTION(FREE)"
Address ISPEXEC "LMCLOSE DATAID("load")"
Address ISPEXEC "LMFREE  DATAID("load")"
Return (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 > 4 & RC <> 8 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
 
 
