/* REXX */
/* CLS2REXXed by FSOX001 on 15 Sep 2016 at 10:10:20  */
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"           /* CACM0160 EDIT MACRO */
/*********************************************************************/
/* THIS ROUTINE IS DEPENDANT ON THE CA/EXAMINE FORMAT OF THE         */
/* PPTXRPT.                                                          */
/* Change Log                                                        */
/* 05/29/2007 C. STERN Created for AAMV0160.                         */
/* 07/31/2007 C. FENTON Modified finding record output.              */
/* 01/09/2008 C. STERN Corrected error when page break occurs during */
/*            SCHED_CHECK.                                           */
/* 02/05/2008 C. STERN Modified error exit and return code           */
/*            processing.                                            */
/* 08/25/2008 CL FENTON Corrected error of dummy entry having 1      */
/*            SCHED entry.                                           */
/* 02/04/2009 CL FENTON Changed ISREDIT END to ISREDIT CANCEL.       */
/*            And removed ISREDIT MEND.                              */
/* 06/28/2012 CL FENTON Minor changes made.                          */
/* 09/05/2014 CL Fenton Correct error on program IEFSDPPT entry      */
/*            being at the end of a page and setting SCHED_ROW,      */
/*            STS-007764.                                            */
/* 10/20/2016 CL.FENTON Converted script from CLIST to REXX.         */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CACM0160 10/20/16"
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                                */
/* PDIDD                                   */
/*******************************************/
return_code = 0
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS PDIDD) ASIS"
cm160vge = 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
  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         */
sysasis     = "ON"             /* CONTROL ASIS - caps off   */
/*******************************************/
/* MAIN PROCESS                            */
/*******************************************/
"(MEMBER) = MEMBER"
"(DSNAME) = DATASET"
pdimbr = "AAMV0160"
finding_switch = "N"
header_switch  = "Y"
finding_rc     = "N"
i_b_switch     = "N"
p_k_switch     = "N"
s_b_switch     = "N"
/* HOUSEKEEPING */
Say pgmname "Processing" member "to create results for" pdimbr"."
"(LASTLINE) = LINENUM .ZLAST"
 
"FIND 'PPT LIBRARY SEARCH'"
If return_code <> 0 then do
  Say "Possible Change in Report Format."
  SIGNAL END_IT_ALL
  end
 
do forever
  return_code = 0
  "FIND 'DD MMM YY' 13 NX"
  if return_code <> 0 then leave
 
  "(DATA) = LINE .ZCSR"
 
  if substr(data,23,58) <> " " then iterate
 
  program = substr(data,4,8)
 
  "EXCLUDE ALL '"program"' 4"
 
  Call find_program
  end
 
If finding_rc = "N" then do
  ac = "Not a Finding."
  Call put_it
  Call blank_line
  ac = "No PPT entries were found with executable modules that do",
    "not exist and have unrevoked excessive privileges."
  Call put_it
  end
 
END_IT_ALL:
Call add_member
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
Address ISPEXEC "VPUT (CM160VGE) ASIS"
 
"CANCEL"
Exit 0
 
 
/*******************************************/
/*  SYSCALL SUBROUTINES                    */
/*******************************************/
ADD_MEMBER:
return_code = 0
Address ISPEXEC "LMMADD DATAID("pdidd") MEMBER("pdimbr")"
If return_code = 4 then do
  return_code = 0
  Address ISPEXEC "LMMREP DATAID("pdidd") MEMBER("pdimbr")"
  If return_code <> 0 then
    Say pgmname "LMMREP_PDI_RCODE =" return_code pdimbr zerrsm
  End
Else
  If return_code <> 0 then
    Say pgmname "LMMADD_PDI_RCODE =" return_code pdimbr zerrsm
Return
 
 
BLANK_LINE:
ac = " "
Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
  "DATALEN("length(ac)") MEMBER("pdimbr")"
Return
 
 
PUT_IT:
Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
  "DATALEN("length(ac)") MEMBER("pdimbr")"
Return
 
 
FIND_PROGRAM:
"FIND '"program"' 6 ALL"
"(A,CNT) = FIND_COUNTS"
"CURSOR = 1 0"
return_code = 0
do until return_code > 0
  "FIND '"program"' 6"
  if return_code > 0 then iterate
 
  "(DATA) = LINE .ZCSR"
  loc = strip(substr(data,22,8),'t')
  if substr(data,22,5) = "IEFSD" & ,
     cnt > 1 then iterate
 
  If substr(data,32,3) = "YES" then do
    i_b_switch     = "Y"
    finding_switch = "Y"
    finding_rc     = "Y"
    end
 
  If substr(data,39,1) <> 8 then do
    key            = substr(data,39,1)
    p_k_switch     = "Y"
    finding_switch = "Y"
    finding_rc     = "Y"
    end
 
  If substr(data,46,3) = "YES" then do
    s_b_switch     = "Y"
    finding_switch = "Y"
    finding_rc     = "Y"
    end
 
  If finding_switch = "N" then iterate
 
  If header_switch = "Y" then do
    header_switch = "N"
    ac = "The following PPT entry(ies) was (were) found for which",
      "executable modules do not exist and excessive privilege(s) has",
      "(have) not been revoked:"
    Call put_it
    Call blank_line
    end
 
  x1 = program
  If i_b_switch = "Y" & ,
     p_k_switch = "Y" & ,
     s_b_switch = "Y" then do
    x2 = key
    ac = "     "x1" in "loc" has bypass data set integrity, a",
      "protection key of "x2", and bypass security."
    end
  If i_b_switch = "Y" & ,
     p_k_switch = "N" & ,
     s_b_switch = "N" then do
    ac = "     "x1" in "loc" has bypass data set integrity."
    end
  If i_b_switch = "Y" & ,
     p_k_switch = "N" & ,
     s_b_switch = "Y" then do
    ac = "     "x1" in "loc" has bypass data set integrity and",
      "bypass security."
    end
  If i_b_switch = "Y" & ,
     p_k_switch = "Y" & ,
     s_b_switch = "N" then do
    x2 = key
    ac = "     "x1" in "loc" has bypass data set integrity and a",
      "protection key of" x2"."
    end
  If i_b_switch = "N" & ,
     p_k_switch = "Y" & ,
     s_b_switch = "Y" then do
    x2 = key
    ac = "     "x1" in "loc" has a protection key of" x2" and",
      "bypass security."
    end
  If i_b_switch = "N" & ,
     p_k_switch = "N" & ,
     s_b_switch = "Y" then do
    ac = "     "x1" in "loc" has bypass security."
    end
  If i_b_switch = "N" & ,
     p_k_switch = "Y" & ,
     s_b_switch = "N" then do
    x2 = key
    ac = "     "x1" in "loc" has a protection key of" x2"."
    end
 
  Call put_it
  i_b_switch     = "N"
  p_k_switch     = "N"
  s_b_switch     = "N"
  finding_switch = "N"
  end
Return
 
 
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
 
 
