/* REXX */
/* CLS2REXXed by FSOX001 on 22 Jan 2018 at 13:42:05  */
/*trace r?*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"               /* CACM000C VIEW DATA(PRODUCTS) */
/*********************************************************************/
/* 07/12/2007 CL.Fenton Created for dialog - for product information */
/* 08/01/2007 CL.Fenton Fixed RC 990 on job set for changes made to  */
/*            products member.                                       */
/* 08/20/2007 CL.Fenton Fixed RC 576 error in script on MUSASS       */
/*            varible.                                               */
/* 09/30/2007 CL.Fenton Added analysis for IAVMs being applicable to */
/*            the system.  Process will generate N/A only for IAVMs  */
/*            that are not applicable on the system.                 */
/* 09/30/2007 CL.Fenton DBMS in PRODUCTS member analysis changed.    */
/*            The DBMS products identifying that do not use the ACP  */
/*            for Identification and Authentication.                 */
/* 11/30/2007 CL.Fenton DBMS in PRODUCTS chgd message written.       */
/* 04/04/2008 CL.Fenton Added evaluation for dataset and subsystems. */
/* 02/28/2009 CL.Fenton Added TYPERUN INSTALL option and evaluation  */
/*            vulnerability questions process.                       */
/* 04/03/2009 CL.Fenton Added setting max_rc 8 for PRODUCTS          */
/*            evaluation.                                            */
/* 06/02/2009 CL.Fenton Added information on VULQUES on ACP00110.    */
/* 11/02/2009 CL.Fenton Added analysis for ROSCOE.                   */
/* 03/02/2010 CL.Fenton Added analysis for NETVIEW.                  */
/* 06/29/2010 CL.Fenton Added additional analysis for NETVIEW.       */
/* 10/07/2010 CL.Fenton Chgd analysis for blank data set, member,    */
/*            and/or userid for Netview.                             */
/* 10/07/2010 CL.Fenton Chgd analysis of configuration information.  */
/*            Chged IF statement to SELECT statement.                */
/* 09/16/2011 CL.Fenton Chgd analysis for MAINVIEW resource class.   */
/* 02/17/2012 CL.Fenton Chgs CA1 evaluation to specify that TMOOPTxx */
/*            is an error, thus requiring TMOSYSxx, CSD-AR003275531. */
/* 06/06/2013 CL.Fenton Added loadlib data set location to RECTYPES  */
/*            to correct issue with CATSOL resources, STS-002427.    */
/* 03/14/2014 CL.Fenton Added keyword/value evaluaton for            */
/*            RECORD_TYPE 7 for Netview, STS-005268 and STS-005281.  */
/* 05/29/2014 CL.Fenton Chgs made to add DIALOG information for      */
/*            CSFTP, CSTCP, and CSTNT, STS-000653.                   */
/* 05/04/2015 CL.Fenton Remove DBMS and IDMS from automation         */
/*            STS-007219 and STS-007637.                             */
/* 05/11/2015 CL.Fenton Added collection of classification to give   */
/*            ZJES0032 a status of Not Applicapable when asset is    */
/*            unlcass, STS-008747.                                   */
/* 10/26/2015 CL.Fenton Removed IAVM process from script, STS-012220 */
/* 07/16/2016 CL.Fenton Added colletion of information for ACP00270, */
/*            STS-014148.                                            */
/* 09/20/2016 CL.Fenton Removed references to AAMV0016.              */
/* 02/05/2018 CL.Fenton Converted script from CLIST to REXX.         */
/* 04/09/2019 CL.Fenton Added ACP00270 where dynamic LPA is not in   */
/*            use on a system.                                       */
/* 07/09/2021 CL Fenton Removed AAMV0014, AAMV0018, and AAMV0430,    */
/*            STS-026844.                                            */
/* 06/02/2023 CL Fenton Added automation for ACF2-OS-000040,         */
/*            RACF-OS-000090, TSS0-OS-000200, ACF2-OS-000050,        */
/*            RACF-OS-000070, TSS0-OS-000180, ACF2-OS-000060,        */
/*            RACF-OS-000080, TSS0-OS-000190, ACF2-OS-000070,        */
/*            RACF-OS-000060, TSS0-OS-000170, ACF2-OS-002330,        */
/*            RACF-OS-000460, TSS0-OS-000420, ACF2-OS-002370,        */
/*            RACF-OS-000440, TSS0-OS-000390, ACF2-OS-002380,        */
/*            RACF-OS-000050, RACF-OS-000450, TSS0-OS-000400,        */
/*            ACF2-OS-002410, RACF-OS-000480, TSS0-OS-000440,        */
/*            ACF2-OS-002420, RACF-OS-000490, TSS0-OS-000450,        */
/*            ACF2-OS-002430, RACF-OS-000500, and TSS0-OS-000460 for */
/*            AAMV0510, AAMV0520, AAMV0530, AAMV0540, AAMV0550,      */
/*            AAMV0560, AAMV0570, AAMV0580, AAMV0590, and AAMV0600,  */
/*            TMS-003585, TMS-003586, TMS-003587, TMS-003588,        */
/*            TMS-003589, TMS-003590, TMS-003591, TMS-003592,        */
/*            TMS-003593, and TMS-003594.                            */
/* 07/21/2023 CL Fenton Added automation for ACF2-OS-002390,         */
/*            RACF-OS-000100, TSS0-OS-000410, ACF2-OS-003430,        */
/*            RACF-OS-000510, and TSS0-OS-000470 for AAMV0610, and   */
/*            AAMV0620, SCTASK0044570 and SCTASK0044661.             */
/* 07/08/2024 CL Fenton Removed AAMV0580, SCTASKU0167777.            */
/* 10/03/2024 CL Fenton Added automation for ACF2-OS-000110,         */
/*            RACF-OS-000140, and TSS0-OS-000240 for AAMV0640,       */
/*            SCTASKU0227642.                                        */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CACM000C 10/03/24"
sysprompt = "OFF"                /* CONTROL NOPROMPT          */
sysflush = "OFF"                /* CONTROL NOFLUSH           */
sysasis = "ON"                 /* CONTROL ASIS - caps off   */
return_code = 0
maxcc = 0
max_rc = 0
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMMSGS                                */
/* TYPERUN                                 */
/* CNTLID                                  */
/* TBLID                                   */
/* CACT0008                                */
/* CACTPROD                                */
/* ACP                                     */
/* NAME                                    */
/*******************************************/
return_code = 0
zerrsm = ""
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS TYPERUN",
  "CNTLID TBLID CACT0008 CACTPROD ACPNAME) ASIS"
vget_rc = 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 "TYPERUN/"typerun "CNTLID/"cntlid "TBLID/"tblid,
    "CACT0008/"cact0008 "CACTPROD/"cactprod "ACPNAME/"acpname
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" ,
  then Trace r
 
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         */
/*******************************************/
/* VERFIY HLQ FOR CNTL AND CLIST LIBRARIES */
/*******************************************/
"(MEMBER) = MEMBER"
 
typerun = left(typerun,8)
 
If typerun <> "FULL" then do
  "CURSOR = 1 0"
  return_code = 0
  /* Select typerun */
  If typerun = "CSFTP" |,
     typerun = "CSTCP" |,
     typerun = "CSTNT" then do
    return_code = 0
    "FIND FIRST '"typerun "1' 1"
    mbr = "NONE"
    dsn = "NONE"
    If return_code = 0 then do
      "(DATA) = LINE .ZCSR"
      parse var data . 12 mbr dsn .
      mbr = strip(mbr,"T")
      dsn = strip(dsn,"T")
      Address ISPEXEC "EDIT DATAID("tblid") MEMBER("cact0008")",
        "MACRO(CACM000B)"
      end
    Address ISPEXEC "VPUT (MBR DSN) ASIS"
    end
  If typerun <> "INSTALL" then do
    return_code = 0
    "FIND FIRST '"typerun "0' 1"
    If return_code = 0 then do
      "(DATA) = LINE .ZCSR"
      inst = substr(data,12,1)
      If inst = "N" then do
        Call process_pdi_data
        max_rc = 4
        end
      end
    Else,
      max_rc = 6
    signal ERR_EXIT
    end
  Else do
    instprod = ""
    Do until return_code <> 0
      "FIND '0 Y' 10"
      If return_code = 0 then do
        "(DATA) = LINE .ZCSR"
        instprod = instprod"#"substr(data,1,8)
        end
      end
    Address ISPEXEC "VPUT (INSTPROD) ASIS"
    return_code = 0
    max_rc = 0
    signal ERR_EXIT
    end
  end
 
If member = "VULQUES" then do
  Call process_vulques_data
  signal ERR_EXIT
  end
 
If member = "ASSET" then do
  Call process_asset_data
  signal ERR_EXIT
  end
 
return_code = 0
Address ISPEXEC "LMMFIND DATAID("cntlid") MEMBER("cactprod")"
lmmfind_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMMFIND_CNTL_RC =" return_code "MEMBER =" cactprod,
    zerrsm
  signal ERR_EXIT
  end
 
return_code = 0
Address ISPEXEC "TBCREATE GRPTABLE REPLACE NOWRITE KEYS(PRODNAME)",
  "NAMES(DESC INST RECTYPES MBRS)"
tbcreate_grptable_rc = return_code
If return_code > 4 then do
  Say pgmname "TBCREATE_TBL_RC =" return_code  zerrsm
  signal ERR_EXIT
  end
 
Address ISPEXEC "TBCREATE ADDTABLE REPLACE NOWRITE KEYS(MBR",
  "USERID) NAMES(MBRDSN PROGRAM PGMDSN RESOURCE MUSASS MLID",
  "GRPRES)"
tbcreate_addtable_rc = return_code
If return_code > 4 then do
  Say pgmname "TBCREATE  RC =" return_code  zerrsm
  signal ERR_EXIT
  end
 
 
/*******************************************/
/* MAIN PROCESS                            */
/*******************************************/
 
GET_NEXT_TBL:
do until return_code > 0
  return_code = 0
  Address ISPEXEC "LMGET DATAID("cntlid") MODE(INVAR)",
    "DATALOC(TRECORD) MAXLEN(80) DATALEN(LRECL)"
  If return_code = 8 then do
    lmget_cntl_rc = 0               /* SET RETURN CODE TO 0 */
    leave
    end
  lmget_cntl_rc = return_code
 
  If return_code <> 0 then do
    Say pgmname "LMGET_CNTL_RC =" return_code zerrsm
    signal ERR_EXIT
    end
 
  If left(trecord,1) = "*" then,
    iterate
  prodname = left(trecord,8)
  recnum = substr(trecord,9,1)
  inst = substr(trecord,10,1)
  If recnum = 1 then,
    desc = substr(trecord,12,59)
  Else,
    rectypes = strip(substr(trecord,12,61),"T")
  Address ISPEXEC "TBMOD GRPTABLE ORDER"
  return_code = 0
  end
 
 
END_NEXT_TBL:
Address ISPEXEC "TBSORT GRPTABLE FIELDS(PRODNAME)"
return_code = 0
Say
Say pgmname "Reviewing" member "member in the Dialog data set."
 
 
TBDISPL:
do until return_code > 0
  return_code = 0
  Address ISPEXEC "TBSKIP GRPTABLE"
  If return_code > 0 then,
    leave
  Say pgmname"   "prodname" - "desc
  Call product_status
  If rectypes <> " " & inst = "Y" & return_code = 0 then,
    Call process_product
  end
 
 
/*******************************************/
/* END PROCESSES                           */
/*******************************************/
 
END_EDIT:
Address ISPEXEC "TBEND GRPTABLE"
Address ISPEXEC "TBEND ADDTABLE"
return_code = 0
 
If max_rc > 0 then do
  Say
  Say pgmname"   To correct the above enter the Dialog process",
    "and select the following options:"
  Say pgmname"     Option D - Products"
  Say pgmname
  Say pgmname"     For each Product reported above, specify one",
    "of the following line commands:"
  Say pgmname"         S - Product is available, addition",
    "information screens may appear"
  Say pgmname"             reguesting additional information."
  Say pgmname"         Y - Product is available.  If Missing",
    "Status appears specify S as detailed"
  Say pgmname"             above."
  Say pgmname"         N - Product is not available."
  max_rc = 8
  end
 
If termmsgs = "ON" then do
  Say
  Say "==============================================================="
  Say pgmname "VGET_RC                        "vget_rc
  Say pgmname "LMMFIND_CNTL_RC                "lmmfind_cntl_rc
  Say pgmname "TBCREATE_GRPTABLE_RC           "tbcreate_grptable_rc
  Say pgmname "TBCREATE_ADDTABLE_RC           "tbcreate_addtable_rc
  Say pgmname "LMGET_CNTL_RC                  "lmget_cntl_rc
  Say "==============================================================="
  end /* do - end */
 
 
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
Address ISPEXEC "VGET (ZISPFRC) SHARED"
 
If return_code > max_rc then,
    max_rc = return_code
If max_rc > zispfrc then,
  zispfrc = max_rc
Address ISPEXEC "VPUT (ZISPFRC) SHARED"
/*"CANCEL"*/
"END"
Exit
 
 
PRODUCT_STATUS:
return_code = 0
"SEEK FIRST '"prodname 0"' 1"
If return_code = 0 then do
  "(DATA) = LINE .ZCSR"
  inst = substr(data,12,1)
  end
 
If inst = " " then do
  max_rc = 4
  Say pgmname"     Product has not been identified as being used."
  end
 
If inst = "S" then do
  max_rc = 4
  Say pgmname"     Product is missing information."
  end
Return (return_code)
 
 
PROCESS_PRODUCT:
Do X = 1 to length(rectypes)
  record_type = substr(rectypes,x,1)
  Call get_record
  If get_rc > 0 then do
    If record_type = "D" then,
      Say pgmname"     Missing information on data sets and/or",
        "data set masks/prefixs of the product installation data",
        "sets."
    If record_type = "E" then,
      Say pgmname"     Missing information on data sets and/or",
        "data set masks/prefixs of the product STC data sets."
    If record_type = "F" then,
      Say pgmname"     Missing information on data sets and/or",
        "data set masks/prefixs of the product user data sets."
    If record_type = "G" then,
      Say pgmname"     Missing information on data sets and/or",
        "data set masks/prefixs of the all product data sets."
    If record_type = "S" then,
      Say pgmname"     Missing information on Subsystem",
        "Identifiers for the product."
    If record_type = "1" then,
      Say pgmname"     Missing information for the JCL member(s)",
        "and data set(s) location."
    If record_type = "2" then do
      Select  (prodname)
        When prodname = "CA1" then,
          Say pgmname"     Missing information for the TMSTMVT",
            "and TMSSECAB program(s) and data set(s) location."
        When prodname = "CICS" then,
          Say pgmname"     Missing information for the DFHSITxx",
            "program(s) and data set(s) location."
        Otherwise
          Say pgmname"     Missing information for the program(s)",
            "and data set(s) location."
        end
      end
    If record_type = "3" then,
      If acpname = "ACF2" then,
        Say pgmname"     Missing information for product Resource",
          "Type(s)."
      Else,
        Say pgmname"     Missing information for product Resource",
          "Class(es)."
    If record_type = "4" then,
      Say pgmname"     Missing information for product",
        "configuration settings."
    If record_type = "5" then do
      Select
        When prodname = "BMCCTD" |,
             prodname = "BMCCTM" |,
             prodname = "BMCCTR" |,
             prodname = "BMCIOA" then,
          Say pgmname"     Missing information for the SECPARM",
            "configuration member(s) and data set(s) location."
        When prodname = "BMCCTO" then,
          Say pgmname"     Missing information for the SECPARM",
            "and CTOPARM configuration member(s) and data set(s)",
            "location."
        Otherwise
          Say pgmname"     Missing information for the",
            "configuration member(s) and data set(s) location."
        end
      end
    If record_type = "6" then,
      Say pgmname"     Missing loadlib data set name."
    If record_type = "7" then,
      Say pgmname"     Missing Value for Keyword."
    max_rc = 4
    end
  Else,
    Call process_addtable
  end
return_code = 0
Return
 
 
GET_RECORD:
get_rc = 4
"CURSOR = 1 0"
 
 
GET_DATA:
do until return_code > 0
  return_code = 0
  "SEEK '"prodname record_type"' 1"
  If return_code > 0 then,
    leave
  get_rc = 0
  "(DATA) = LINE .ZCSR"
  If record_type = "D" |,
     record_type = "E" |,
     record_type = "F" |,
     record_type = "G" then do
    mbr = substr(data,12,60)
    mbrdsn = ""
    end
  If record_type = "S" then do
    mbr = substr(data,12,4)
    mbrdsn = ""
    end
  If record_type = "1" then do
    If prodname = "NETVIEW" then do
      mbr = substr(data,12,8)
      program = substr(data,21,8)
      mbrdsn = substr(data,30,41)
      userid = substr(data,72,8)
      end
    Else do
      mbr = substr(data,12,8)
      mbrdsn = substr(data,21,50)
      userid = substr(data,72,8)
      end
    end
  If record_type = "2" |,
     record_type = "5" |,
     record_type = "7" then do
    mbr = substr(data,12,8)
    program = substr(data,21,8)
    pgmdsn = substr(data,30,41)
    If mbr = "TMOOPTxx" then do
      Say pgmname"     TMOOPTxx specified for configuration",
        "member(s) and data set(s) location."
      get_rc = 4
      iterate
      end
    end
  If record_type = "3" then do
    mbr = substr(data,12,8)
    resource = substr(data,21,8)
    grpres = substr(data,30,8)
    musass = substr(data,39,8)
    mlid = substr(data,48,8)
    end
  If record_type = "4" then do
    aa = substr(data,12,1)
    cm = substr(data,14,1)
    as = substr(data,16,1)
    rv = substr(data,18,1)
    ti = substr(data,20,5)
    gp = substr(data,26,8)
    ma = substr(data,35,1)
    at = substr(data,37,1)
    mo = substr(data,39,1)
    st = substr(data,41,1)
    ps = substr(data,43,1)
    end
  If record_type = "6" then do
    mbr = substr(data,12,8)
    mbrdsn = substr(data,21,50)
    program = ""
    end
  return_code = 0
  Address ISPEXEC "TBADD ADDTABLE ORDER"
  end
 
 
GET_DONE:
return_code = 0
Return get_rc
 
 
PROCESS_ADDTABLE:
Address ISPEXEC "TBSTATS ADDTABLE ROWCURR(ROWCURR)"
procerr = rowcurr
Address ISPEXEC "TBTOP ADDTABLE"
 
 
DISPLAY_TABLE:
do until return_code > 0
  return_code = 0
  Address ISPEXEC "TBSKIP ADDTABLE"
  If return_code > 0 then,
    leave
 
  mbr = strip(mbr,"B")
  If mbrdsn <> " " then,
    mbrdsn = strip(mbrdsn,"B")
  If program <> " " then,
    program = strip(program,"B")
  If pgmdsn <> " " then,
    pgmdsn = strip(pgmdsn,"B")
  If resource <> " " then,
    resource = strip(resource,"B")
  If musass <> " " then,
    musass = strip(musass,"B")
  If mlid <> " " then,
    mlid = strip(mlid,"B")
  If grpres <> " " then,
    grpres = strip(grpres,"B")
 
  If record_type = "1" |,
     record_type = "2" |,
     record_type = "5" |,
     record_type = "6" |,
     record_type = "7" then
    Call process_dsnmbr
  If record_type = "3" then do
    Call process_resource
    end
  If record_type = "4" then do
    datatxt = substr(data,12,32)
    datatxt = strip(datatxt,"B")
    If datatxt = "N/A" then do
      max_rc = 4
      Say pgmname"     Missing information for product",
        "configuration settings."
      end
    end
  Address ISPEXEC "TBDELETE ADDTABLE"
  end
 
 
DISPLAY_END:
return_code = 0
If procerr = 0 then do
  max_rc = 4
  If prodname = "CICS" then,
    Say pgmname"     Missing information for the DFHSITxx",
      "program(s) and data set(s) location."
  end
Return
 
 
PROCESS_DSNMBR:
dsnmbr = ""
If record_type = "1" then do
  If prodname = "NETVIEW" then do
    If mbrdsn = " " then,
      If program <> " " then do
        max_rc = 4
        Say pgmname"     Data set for JCL member" program "not",
          "specified."
        end
      Else do
        max_rc = 4
        Say pgmname"     Data set and member for" mbr "not",
          "specified."
        end
    Else,
      If program = " " then do
        max_rc = 4
        Say pgmname"     Member for" mbr "not specified."
        end
      Else do
        ddsn = mbrdsn
        dmbr = program
        end
    If userid = " " then,
      If program <> " " then do
        max_rc = 4
        Say pgmname"     User Id for JCL member" program "not",
          "specified."
        end
      Else do
        max_rc = 4
        Say pgmname"     User Id for" mbr "not specified."
        end
    end
  Else do
    If mbrdsn = " " then do
      max_rc = 4
      Say pgmname"     Data set for JCL member" mbr "not",
        "specified."
      end
    Else do
      ddsn = mbrdsn
      dmbr = mbr
      end
    If userid = " " then do
      max_rc = 4
      Say pgmname"     User Id for JCL member" mbr "not",
        "specified."
      end
    end
  end
If record_type = "2" then do
  If program <> " " then,
    If pgmdsn = " " then do
      max_rc = 4
      Say pgmname"     Data set for program" program "for" mbr,
        "is not specified."
      end
    Else do
      ddsn = pgmdsn
      dmbr = program
      end
  Else,
    procerr = procerr - 1
  end
If record_type = "5" then do
  If pgmdsn = " " then do
    max_rc = 4
    Say pgmname"     Data set for configuration for" mbr "is not",
      "specified."
    end
  Else do
    ddsn = pgmdsn
    dmbr = program
    end
  end
If record_type = "6" then do
  If mbrdsn = " " then do
    max_rc = 4
    Say pgmname"     Loadlib data set name is not specified."
    end
  Else do
    ddsn = mbrdsn
    dmbr = program
    end
  end
If record_type = "7" then do
  If pgmdsn = " " then do
    max_rc = 4
    Say pgmname"     Value for" mbr "is not specified."
    end
  Else do
    ddsn = pgmdsn
    dmbr = program
    end
  return
  end
If ddsn <> " " then do
  If dmbr <> " " then,
    dsnmbr = ddsn"("dmbr")"
  Else,
    dsnmbr = ddsn
  stat = sysdsn("'"dsnmbr"'")
  If stat <> "OK" then do
    max_rc = 4
    If dmbr <> " " then,
      Say pgmname"   "dmbr "in" ddsn "using" dsnmbr "found error",
        "of" stat"."
    Else
      Say pgmname"   "ddsn "found error of" stat"."
    end
  end
Return
 
 
PROCESS_RESOURCE:
/*Select  (acpname)*/
If acpname = "ACF2" then do
  If resource = " " then do
    max_rc = 4
    Say pgmname"     Missing Resource Type for" mbr"."
    end
  If prodname = "CICS" then do
    If musass = " " & mlid = " " then do
      max_rc = 4
      Say pgmname"     Missing MUSASS and MLID for" mbr"."
      end
    Else do
      If musass = " " then do
        max_rc = 4
        Say pgmname"     Missing MUSASS for" mbr"."
        end
      If mlid = " " then do
        max_rc = 4
        Say pgmname"     Missing MLID for" mbr"."
        end
      end
    end
  end
If acpname = "RACF" then do
  If resource = " " then do
    max_rc = 4
    Say pgmname"     Missing Resource Class for" mbr"."
    end
  If prodname <> "BMCMVZ" &,
     prodname <> "ROSCOE" &,
     grpres = " " then do
    max_rc = 4
    Say pgmname"     Missing Group Resource Class for" mbr"."
    end
  end
If acpname = "TSS" then do
  If resource = " " then do
    max_rc = 4
    Say pgmname"     Missing Resource Class for" mbr"."
    end
  end
Return
 
 
PROCESS_PDI_DATA:
Address ISPEXEC "VGET (TYPERUN CNTLID PDIDD CACT0004) ASIS"
vget_rc = return_code
If return_code <> 0 then do
  Say pgmname "VGET_RC =" return_code  zerrsm
  Say pgmname "TYPERUN/"typerun "CNTLID/"cntlid "PDIDD/"pdidd
    "CACT0004/"cact0004
  end
typerun = left(typerun,8)
cd = 0
If acpname = "ACF2" then cd = 1
If acpname = "RACF" then cd = 2
If acpname = "TSS" then cd = 3
lminit_pdidd_rc = "N/A"
lmopen_pdidd_rc = "N/A"
lmclose_pdidd_rc = "N/A"
lmfree_pdidd_rc = "N/A"
status = "Not Applicable"
return_code = 0
Address ISPEXEC "LMMFIND DATAID("cntlid") MEMBER("cact0004")"
lmmfind_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMMFIND_CNTL_RC =" return_code "MEMBER =" cact0004,
    zerrsm
  signal PDI_ERR
  end
return_code = 0
Address ISPEXEC "LMINIT DATAID(PDIDD) DDNAME("pdidd") ENQ(EXCLU)"
lminit_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT PDIDD    RC =" return_code  zerrsm
  signal PDI_ERR
  end
return_code = 0
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  zerrsm
  signal PDI_ERR
  end
 
 
GET_PDI_TBL:
do until return_code > 0
  return_code = 0
  Address ISPEXEC "LMGET DATAID("cntlid") MODE(INVAR)",
    "DATALOC(TRECORD) MAXLEN(80) DATALEN(LRECL)"
  If return_code = 8 then do
    lmget_cntl_rc = 0               /* SET RETURN CODE TO 0 */
    leave
    end
  If return_code <> 0 then do
    Say pgmname "LMGET_CNTL_RC =" return_code  zerrsm
    signal PDI_ERR
    end
  If left(trecord,8) <> typerun then,
    iterate
  ind = substr(trecord,10,1)
  mbr = substr(trecord,12,8)
  If ind = 0 | ind = cd then do
    Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR)",
      "DATALOC(STATUS) DATALEN("length(status)") MEMBER("mbr")"
    return_code = 0
    Address ISPEXEC "LMMADD DATAID("pdidd") MEMBER("mbr")"
    If return_code = 4 then do
      return_code = 0
      Address ISPEXEC "LMMREP DATAID("pdidd") MEMBER("mbr")"
      end
    end
  end
 
 
END_PDI_TBL:
return_code = 0
Address ISPEXEC "LMCLOSE DATAID("pdidd")"
lmclose_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCLOSE_PDIDD_RC =" return_code  zerrsm
  end
return_code = 0
Address ISPEXEC "LMFREE DATAID("pdidd")"
lmfree_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMFREE_PDIDD_RC =" return_code  zerrsm
  end
 
 
PDI_ERR:
If termmsgs = "ON" then do
  Say
  Say "==============================================================="
  Say pgmname "VGET_RC                        "vget_rc
  Say pgmname "LMMFIND_CNTL_RC                "lmmfind_cntl_rc
  Say pgmname "LMINIT_PDIDD_RC                "lminit_pdidd_rc
  Say pgmname "LMOPEN_PDIDD_RC                "lmopen_pdidd_rc
  Say pgmname "LMGET_CNTL_RC                  "lmget_cntl_rc
  Say pgmname "LMCLOSE_PDIDD_RC               "lmclose_pdidd_rc
  Say pgmname "LMFREE_PDIDD_RC                "lmfree_pdidd_rc
  Say "==============================================================="
  End /* do - end */
Return
 
 
PROCESS_ASSET_DATA:
Address ISPEXEC "VGET (TYPERUN PDIDD) ASIS"
Say
Say pgmname "Process contents of" member "member in the Dialog",
  "data set."
vget_rc = return_code
If return_code <> 0 then do
  Say pgmname "VGET_RC =" return_code  zerrsm
  Say pgmname "TYPERUN/"typerun "PDIDD/"pdidd
  end
lminit_pdidd_rc = "N/A"
lmopen_pdidd_rc = "N/A"
lmclose_pdidd_rc = "N/A"
lmfree_pdidd_rc = "N/A"
status = "Not Applicable"
return_code = 0
Address ISPEXEC "LMINIT DATAID(PDIDD) DDNAME("pdidd") ENQ(EXCLU)"
lminit_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_PDIDD_RC =" return_code  zerrsm
  signal ASSET_ERR
  end
return_code = 0
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  zerrsm
  signal ASSET_ERR
  end
"CURSOR = 1 0"
 
 
FIND_ASSET_CLASS:
return_code = 0
"FIND 'CLASS     ' 1 10"
If return_code = 0 then do
  "(DATA) = LINE .ZCSR"
  class = substr(data,11,1)
  If class = 2 then do
    Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR)",
      "DATALOC(STATUS) DATALEN("length(status)") MEMBER(ZJES0032)"
    return_code = 0
    Address ISPEXEC "LMMADD DATAID("pdidd") MEMBER(ZJES0032)"
    If return_code = 4 then do
      return_code = 0
      Address ISPEXEC "LMMREP DATAID("pdidd") MEMBER(ZJES0032)"
      end
    end
  end
 
 
END_ASSET:
return_code = 0
Address ISPEXEC "LMCLOSE DATAID("pdidd")"
lmclose_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCLOSE_PDIDD_RC =" return_code  zerrsm
  end
return_code = 0
Address ISPEXEC "LMFREE DATAID("pdidd")"
lmfree_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMFREE_PDIDD_RC =" return_code  zerrsm
  end
 
 
ASSET_ERR:
If termmsgs = "ON" then do
  Say
  Say "==============================================================="
  Say pgmname "VGET_RC                        "vget_rc
  Say pgmname "LMINIT_PDIDD_RC                "lminit_pdidd_rc
  Say pgmname "LMOPEN_PDIDD_RC                "lmopen_pdidd_rc
  Say pgmname "LMCLOSE_PDIDD_RC               "lmclose_pdidd_rc
  Say pgmname "LMFREE_PDIDD_RC                "lmfree_pdidd_rc
  Say "==============================================================="
  end /* do - end */
Return
 
 
PROCESS_VULQUES_DATA:
cacm000d = "CACM000D"
dsnlist  = "DSNLIST"
 
Address ISPEXEC "VGET (TYPERUN TBLID PDIDD) ASIS"
Say
Say pgmname "Process contents of" member "member in the Dialog",
  "data set."
vget_rc = return_code
If return_code <> 0 then do
  Say pgmname "VGET_RC =" return_code  zerrsm
  Say pgmname "TYPERUN/"typerun "PDIDD/"pdidd
  end
lminit_pdidd_rc = "N/A"
lmopen_pdidd_rc = "N/A"
lmclose_pdidd_rc = "N/A"
lmfree_pdidd_rc = "N/A"
status = "Not a Finding"
"(DSNAME) = DATASET"
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  zerrsm
  Else,
    Say pgmname "LINENUM Error RCode =" return_code "DSN="dsname,
      "MEMBER="member  zerrsm
  signal VULQUES_ERR
  end
Address ISPEXEC "LMINIT DATAID(PDIDD) DDNAME("pdidd") ENQ(EXCLU)"
lminit_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_PDIDD_RC =" return_code  zerrsm
  signal VULQUES_ERR
  end
return_code = 0
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  zerrsm
  signal VULQUES_ERR
  end
"CURSOR = 1 0"
 
 
/* Start Here */
VULQUES_LOOP:
do until return_code > 0
  return_code = 0
  "FIND '0 ' 10"
  If return_code > 0 then do
    leave
    end
  "(DATA) = LINE .ZCSR"
  mbr = left(data,8)
  type = substr(data,10,1)
  resp = substr(data,12,1)
 
  If resp = "N" then do
    If mbr = "AAMV0012" then do
      Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR)",
        "DATALOC(STATUS) DATALEN("length(status)") MEMBER("mbr")"
      Call VULQUES_ADD
      iterate
      end
    If mbr = "ACP00110" |,
       mbr = "ACP00190" |,
       mbr = "ACP00210" |,
       mbr = "ACP00270" then do
      iterate
      end
    end
 
  If resp = "Y" then do
    Select
      When mbr = "AAMV0012" then,
        dsns = ""
      When mbr = "ACP00110" |,
           mbr = "ACP00190" |,
           mbr = "ACP00210" then do
        If mbr = "ACP00110" then,
          dsns = mbr
        If mbr = "ACP00190" then,
          dsns = "SMFBKRPT"
        If mbr = "ACP00210" then,
          dsns = "BKUPRPT"
        "(A,B) = CURSOR"
        "CURSOR = 1 0"
        return_code = 0
        dcnt = 0
        Do until return_code <> 0
          "FIND '"mbr "D' 1"
          If return_code = 0 then do
            "(DATA) = LINE .ZCSR"
            dsn = substr(data,12,59)
            dsn = strip(dsn,"T")
            dsns = dsns dsn
            dcnt = dcnt + 1
            end
          If dcnt = 250 then do
            dcnt = 0
            Address ISPEXEC "VPUT (DSNS) ASIS"
            Address ISPEXEC "EDIT DATAID("tblid") MEMBER("dsnlist")",
              "MACRO("cacm000d")"
            dsns = word(dsns,1)
            end
          end
        Address ISPEXEC "VPUT (DSNS) ASIS"
        Address ISPEXEC "EDIT DATAID("tblid") MEMBER("dsnlist")",
          "MACRO("cacm000d")"
        "CURSOR =" a b
        return_code = 0
        iterate
        end
      When mbr = "ACP00270" then do
        "(A,B) = CURSOR"
        "CURSOR = 1 0"
        return_code = 0
        dcnt = 0
        usrres = ""
        Do until return_code <> 0
          "FIND '"mbr 1"' 1"
          If return_code = 0 then do
            "(DATA) = LINE .ZCSR"
            dsn = substr(data,72)
            usrres = usrres""dsn"#"
            end
          end
        Address ISPEXEC "VPUT (USRRES) ASIS"
        "CURSOR =" a b
        return_code = 0
        iterate
        end
      When mbr = "AAMV0400" then do
        Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR)",
          "DATALOC(STATUS) DATALEN("length(status)") MEMBER("mbr")"
        Call VULQUES_ADD
        iterate
        end
      Otherwise nop  /* do
        Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR)",
          "DATALOC(STATUS) DATALEN("length(status)") MEMBER("mbr")"
        Call VULQUES_ADD
        iterate
        end*/
      end
    end
 
  If mbr = "AAMV0012" then,
    ac = "The following unsupported version(s) of software is",
      "(are) found on the system:"
  If mbr = "AAMV0400" then,
    ac = "No automated process is in place to collect and retain",
      "SMF data for this system."
  If mbr = "AAMV0012" |,
     mbr = "AAMV0400" then,
    Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)") MEMBER("mbr")"
  If mbr = "AAMV0012" then do
    "CURSOR =" counter 0
    ac = " "
    Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
      "DATALEN("length(ac)") MEMBER("mbr")"
    return_code = 0
    Do until return_code <> 0
      "FIND '"mbr 1"' 1"
      If return_code = 0 then do
        "(DATA) = LINE .ZCSR"
        member = substr(data,12,22)
        mbrdsn = substr(data,35,36)
        ac = "     "member mbrdsn
        Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
          "DATALEN("length(ac)") MEMBER("mbr")"
        end
      end
    "(COUNTER) = CURSOR"
    end
  If mbr = "AAMV0012" |,
     mbr = "AAMV0400" then,
    Call VULQUES_ADD
  end
 
doc_vuls = "AAMV0510 when accounts are removed.@ AAMV0520 when",
  "accounts are modified.@ AAMV0530 when accounts are deleted.@",
  "AAMV0540 when accounts are created.@ AAMV0550 if baseline",
  "configurations are changed.@ AAMV0560 remove or disable temporary",
  "user accounts after 72 hours.@ AAMV0570 remove or disable",
  "emergency accounts after 72 hours.@ AAMV0590 removal of",
  "software components after updated versions installed.@",
  "AAMV0600 when anomalies of operation of any security functions",
  "are discovered.@ AAMV0610 notify system administrators and",
  "ISSOs of account enabling actions.@ AAMV0620 offloading SMF",
  "files to a different system or media than the system being",
  "audited.@ AAMV0640 The z/OS SMF collection file does not have",
  "the storage capacity of at least one weeks worth of audit",
  "data.@"
 
lead_text = "Documented procedures are not available for"
"CURSOR = 1 0"
 
do until doc_vuls = ""
  parse var doc_vuls mbr finding "@" doc_vuls
  return_code = 0
  "FIND '"left(mbr,8)" 0 Y' 1"
  If return_code > 0 then do
    ac = lead_text finding
    If mbr = "AAMV0640" then do
      ac = finding
      end
    end
  else do
    ac = status
    end
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR)",
    "DATALOC(AC) DATALEN("length(ac)") MEMBER("mbr")"
  Call VULQUES_ADD
  end
 
 
END_VULQUES:
return_code = 0
Address ISPEXEC "LMCLOSE DATAID("pdidd")"
lmclose_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCLOSE_PDIDD_RC =" return_code  zerrsm
  end
return_code = 0
Address ISPEXEC "LMFREE DATAID("pdidd")"
lmfree_pdidd_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMFREE PDIDD   RC =" return_code  zerrsm
  end
 
 
VULQUES_ERR:
If termmsgs = "ON" then do
  Say
  Say "==============================================================="
  Say pgmname "VGET_RC                        "vget_rc
  Say pgmname "LMINIT_PDIDD_RC                "lminit_pdidd_rc
  Say pgmname "LMOPEN_PDIDD_RC                "lmopen_pdidd_rc
  Say pgmname "LMCLOSE_PDIDD_RC               "lmclose_pdidd_rc
  Say pgmname "LMFREE_PDIDD_RC                "lmfree_pdidd_rc
  Say "==============================================================="
  end /* do - end */
Return
 
 
VULQUES_ADD:
return_code = 0
Address ISPEXEC "LMMADD DATAID("pdidd") MEMBER("mbr")"
If return_code = 4 then do
  return_code = 0
  Address ISPEXEC "LMMREP DATAID("pdidd") MEMBER("mbr")"
  end
Return
/*signal VULQUES_LOOP*/
 
 
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
 
 
