/* REXX */
/* CLS2REXXed by FSOX001 on 23 Aug 2018 at 13:32:43  */
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
 
/*********************************************************************/
/* 07/07/2006 CL.FENTON Create script for Not Applicable PDIs.       */
/* 06/06/2007 CL.FENTON Modified script to evaluate Dialog data set  */
/*            as well as generating Not Applicables for Products.    */
/* 08/07/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.                 */
/* 08/07/2007 CL.FENTON Added CACT0008 table process.                */
/* 02/28/2009 CL.FENTON Added Vulnerability question process.        */
/* 05/08/2009 CL.FENTON Added test of ZISPFRC for execution of       */
/*            CACM000B.                                              */
/* 06/02/2009 CL.FENTON Changes CACT0002 to CACT0000.  Changes for   */
/*            reflect new table information.                         */
/* 02/16/2010 CL.FENTON Chgs to edit CACT0000 when TYPERUN equal     */
/*            FULL.                                                  */
/* 05/11/2015 CL.Fenton Added collection of classification to give   */
/*            ZJES0032 a status of Not Applicapable when asset is    */
/*            unlcass, STS-008747.                                   */
/* 10/22/2015 CL.Fenton Changed VMS asset to Asset Definition.       */
/* 10/26/2015 CL.Fenton Removed IAVM process for script, STS-012220. */
/* 08/23/2018 CL.FENTON Converted script from CLIST to REXX.         */
/* 02/27/2019 CL.FENTON Correct "Bad arithmetic conversion" error    */
/*            caused by misplaced double quotation mark.             */
/* 04/09/2019 CL.FENTON Chgs in evaluation of CICS resoures that     */
/*            have systems that are running both production and      */
/*            test/developement CICS regions, STS-021044.            */
/* 03/02/2021 CL Fenton Chgs to add LMCOMP to TABLE data set,        */
/*            STS-026152.                                            */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
conslist= "OFF"            /* default is off                         */
comlist=  "OFF"            /* default is off                         */
symlist=  "OFF"            /* default is off                         */
termmsgs= "OFF"            /* default is off                         */
typerun=  "FULL"           /* run review of dialog data set          */
cacc1000= "CACC1000"       /* security check program                 */
cactprod= "CACTPROD"       /* dialog product table                   */
cact0000= "CACT0000"       /* dialog access table                    */
cact0004= "CACT0004"       /* pdi n/a table                          */
cacm000b= "CACM000B"       /* resource generator                     */
cacm000t= "CACM000T"       /* edit macro for ct0401/stc*             */
cact0008= "CACT0008"       /* resource table                         */
dataddn=  "DIALOG"         /* dialog dd name for review              */
pdidd=    "PDIDD"          /* pdi dd name                            */
cntlddn=  "CNTL"           /* cntl ddname                            */
tblddn=   "TABLE"          /* table ddname                           */
products= "PRODUCTS"       /* dialog product member name             */
asset=    "ASSET"          /* dialog asset definition member         */
vulques=  "VULQUES"        /* dialog vulques member name             */
cacm000c= "CACM000C"       /* script to review products              */
trace=    "OFF"            /* trace actions and errors               */
pgmname = "CACC0006 03/02/21"
 
sysprompt = "OFF"                 /* CONTROL NOPROMPT                */
sysflush = "OFF"                  /* CONTROL NOFLUSH                 */
sysasis = "ON"                    /* CONTROL ASIS - caps off         */
Numeric digits 10                 /* default of 9 not enough         */
maxcc = 0
lminit_cntl_rc    = "0"
lminit_dialog_rc  = "0"
lminit_table_rc   = "0"
lmcomp_table_rc   = "0"
lmopen_cntl_rc    = "0"
lmopen_table_rc   = "0"
lmopen_dialog_rc  = "0"
edit_cact0000_rc  = "0"
view_products_rc  = "0"
edit_cact0008_rc  = "0"
lmclose_cntl_rc   = "0"
lmclose_table_rc  = "0"
lmclose_dialog_rc = "0"
lmfree_cntl_rc    = "0"
lmfree_dialog_rc  = "0"
lmfree_table_rc   = "0"
product_rc        = "0"
 
Arg OPTION
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"
return_code = 0
view_products_rc = "N/A"
edit_cact0008_rc = "N/A"
 
/*******************************************/
/* INITIALIZE LIBRARY MANAGEMENT           */
/*******************************************/
return_code = listdsi(dataddn "FILE")
listdsi_data_rcode = return_code
listdsi_data_reason = sysreason
If sysreason = 0 then do
  datadsn = sysdsname
  listdsi_data_msglvl2 = sysmsglvl2
  end
Else do
  Say pgmname "UNABLE TO DETERMINE" dataddn "DSNAME SYSREASON" sysreason
  Say pgmname sysmsglvl1
  Say pgmname sysmsglvl2
  return_code = 18
  SIGNAL ERR_EXIT
  end
 
"LMINIT DATAID(DATAID) DDNAME("dataddn")"
lminit_dialog_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_DIALOG_RC =" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"LMINIT DATAID(CNTLID) DDNAME("cntlddn")"
lminit_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_CNTL_RC" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"LMOPEN DATAID("dataid")"
lmopen_dialog_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMOPEN_DIALOG_RC =" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"LMINIT DATAID(TBLID) DDNAME("tblddn") ENQ(EXCLU)"
lminit_table_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_TABLE_RC" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"LMCOMP DATAID("tblid")"
lmcomp_table_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCOMP_TABLE_RC" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"LMOPEN DATAID("cntlid")"
lmopen_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMOPEN_CNTL_RC" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"LMOPEN DATAID("tblid")"
lmopen_table_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMOPEN_TABLE_RC" return_code zerrsm
  Say pgmname zerrlm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
 
"VPUT (CONSLIST COMLIST SYMLIST TERMMSGS TYPERUN CNTLID TBLID PDIDD",
  "CACTPROD CACT0000 CACT0004 CACT0008) ASIS"
"SELECT CMD("cacc1000 "ACP)"
return_code = 0
edit_cact0000_rc = "N/A"
If typerun = "FULL" then do
  "EDIT DATAID("tblid") MACRO("cacm000t") MEMBER("cact0000")"
  edit_cact0000_rc = return_code
  return_code = 0
  Say
  Say pgmname "Reviewing the Dialog data set" datadsn"."
  Call full_check
  end
product_rc = return_code
If typerun = "CICS" then cacm000b = "CACM000E"
If product_rc = 0 then do
  "EDIT DATAID("dataid") MACRO("cacm000c") MEMBER("products")"
  view_products_rc = return_code
  "VGET (ZISPFRC) SHARED"
  If zispfrc = 0 then do
    "EDIT DATAID("tblid") MACRO("cacm000b") MEMBER("cact0008")"
    edit_cact0008_rc = return_code
    end
  end
 
 
END_EXIT:
return_code = 0
"LMCLOSE DATAID("dataid")"
lmclose_dialog_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCLOSE_DIALOG_RC =" return_code zerrsm
  Say pgmname zerrlm
  end
 
return_code = 0
"LMCLOSE DATAID("cntlid")"
lmclose_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCLOSE_CNTL_RC =" return_code zerrsm
  Say pgmname zerrlm
  end
 
return_code = 0
"LMCLOSE DATAID("tblid")"
lmclose_table_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMCLOSE_TABLE_RC =" return_code zerrsm
  Say pgmname zerrlm
  end
 
return_code = 0
"LMFREE DATAID("dataid")"
lmfree_dialog_rc = return_code
 
return_code = 0
"LMFREE DATAID("cntlid")"
lmfree_cntl_rc = return_code
 
return_code = 0
"LMFREE DATAID("tblid")"
lmfree_table_rc = return_code
 
return_code = 0
 
/*******************************************/
/* 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
 
"VGET (ZISPFRC) SHARED"
If product_rc > zispfrc then do
  zispfrc = product_rc
  "VPUT (ZISPFRC) SHARED"
  end
 
If termmsgs = "ON" then do
  Say
  Say "==============================================================="
  Say pgmname "LMINIT_CNTL_RC                " lminit_cntl_rc
  Say pgmname "LMINIT_DIALOG_RC              " lminit_dialog_rc
  Say pgmname "LMINIT_TABLE_RC               " lminit_table_rc
  Say pgmname "LMOPEN_CNTL_RC                " lmopen_cntl_rc
  Say pgmname "LMOPEN_TABLE_RC               " lmopen_table_rc
  Say pgmname "LMCOMP_TABLE_RC               " lmcomp_table_rc
  Say pgmname "LMOPEN_DIALOG_RC              " lmopen_dialog_rc
  Say pgmname "EDIT_CACT0000_RC              " edit_cact0000_rc
  Say pgmname "VIEW_PRODUCTS_RC              " view_products_rc
  Say pgmname "EDIT_CACT0008_RC              " edit_cact0008_rc
  Say pgmname "LMCLOSE_CNTL_RC               " lmclose_cntl_rc
  Say pgmname "LMCLOSE_TABLE_RC              " lmclose_table_rc
  Say pgmname "LMCLOSE_DIALOG_RC             " lmclose_dialog_rc
  Say pgmname "LMFREE_CNTL_RC                " lmfree_cntl_rc
  Say pgmname "LMFREE_DIALOG_RC              " lmfree_dialog_rc
  Say pgmname "LMFREE_TABLE_RC               " lmfree_table_rc
  Say "==============================================================="
  end /* do - end */
Exit (0)
 
 
FULL_CHECK:
data_find_rc = 0
"LMMFIND DATAID("tblid") MEMBER("cact0000")"
return_code = 0
 
 
GET_NEXT_TBL:
do until return_code = 8
  "LMGET DATAID("tblid") MODE(INVAR) DATALOC(TRECORD) MAXLEN(80)",
    "DATALEN(LRECL)"
  If return_code = 8 then leave
  If left(trecord,8) <> "* DIALOG" then iterate
  parse var trecord . 10 pref 18 . 20 desc 73 .
  return_code = 0
  "LMMFIND DATAID("dataid") MEMBER("strip(pref)")"
  If return_code > 0 then do
    If data_find_rc = 0 then do
      data_find_rc = return_code
      Say
      Say pgmname "The following members are missing from the Dialog",
        "data set" datadsn"."
      end
    Say pgmname"   "pref "-" desc
    end
  return_code = 0
  end
 
 
END_NEXT_TBL:
If data_find_rc > 0 then do
  Say
  Say pgmname "    To correct the above enter the Dialog process",
    "and select the following options:"
  Say pgmname "      Option C - Review reports for Findings, User",
    "access & Dataset rules"
  Say pgmname "      Option E - Verify and update Authorized user",
    "groups"
  Say pgmname "        For each member that has a Status of Empty. ",
    "Edit the member, add Users IDs"
  Say pgmname "        (if needed), and Save the member."
  end
 
return_code = 0
"LMMFIND DATAID("dataid") MEMBER("asset")"
If return_code > 0 then do
  Say
  If data_find_rc = 0 then do
    data_find_rc = return_code
    Say pgmname "The following members are missing from the Dialog",
      "data set" datadsn"."
    end
  Say pgmname "  ASSET    - Member containing Asset Definition",
    "information."
  Say
  Say pgmname "    To correct the above enter the Dialog process and",
    "select the following options:"
  Say pgmname "      Option C - Review reports for Findings, User",
    "access & Dataset rules."
  Say pgmname "      Option F - Create Asset Definition"
  Say pgmname "        Enter the information requested on the",
    "screen.  Enter CREATE to create the"
  Say pgmname "        Asset File and save the information.  Or",
    "enter SAVE to save the information."
  end
Else,
  "EDIT DATAID("dataid") MACRO("cacm000c") MEMBER("asset")"
 
return_code = 0
"LMMFIND DATAID("dataid") MEMBER("vulques")"
If return_code > 0 then do
  Say
  If data_find_rc = 0 then do
    data_find_rc = return_code
    Say pgmname "The following members are missing from the Dialog",
      "data set" datadsn"."
    end
  Say pgmname"   "vulques "- Member containing response to",
    "Vulnerability Questions."
  Say
  Say pgmname "    To correct the above enter the Dialog process and",
    "select the following options:"
  Say pgmname "      Option F - Vulnerability Questions"
  Say pgmname "      For each STIG ID specify 'Y' or 'N' to the",
    "Vulnerability question."
  Say pgmname "        Y - Yes"
  Say pgmname "        N - No"
  end
Else,
  "VIEW DATAID("dataid") MACRO("cacm000c") MEMBER("vulques")"
 
return_code = 0
"LMMFIND DATAID("dataid") MEMBER("products")"
If return_code > 0 then do
  Say
  If data_find_rc = 0 then do
    data_find_rc = return_code
    Say pgmname "The following members are missing from the Dialog",
      "data set" datadsn"."
    end
  Say pgmname"   "products "- Member containing product information"
  Say
  Say pgmname "    To correct the above enter the Dialog process",
    "and select the following options:"
  Say pgmname "      Option D - Products"
  Say pgmname "      For each Product that has a Status of 'Used?'",
    "or 'Missing', specify one of the"
  Say pgmname "      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."
  return_code = 4
  end
Return return_code
 
 
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
 
 
