/* REXX */
/* CLS2REXXed by FSOX001 on 13 Sep 2016 at 14:51:32  */
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
 
/*********************************************************************/
/* CHANGE LOG                                                        */
/* 05/24/2007 C. STERN Created for AAMV0050.                         */
/* 08/24/2007 C. STERN Added PDI AAMV0440.                           */
/* 10/18/2007 C. STERN Added PDI ZUSS0011.                           */
/* 10/19/2007 C. STERN Removedd PDI ZUSS0011 per FSO Chambersburg.   */
/* 02/05/2008 C. STERN Corrected return code processing.             */
/* 09/08/2008 CL FENTON ISPEXEC EDIT to ISPEXEC VIEW to avoid E37    */
/*            abend.                                                 */
/* 09/14/2016 CL.FENTON Converted script from CLIST to REXX.         */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CACC0050 09/14/16"
CONSLIST = "OFF"                  /* DEFAULT IS OFF                  */
COMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
SYMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
TERMMSGS = "OFF"                  /* DEFAULT IS OFF                  */
TRACE    = "OFF"                  /* TRACE ACTIONS AND ERRORS        */
AAMV0050 = "CACM0050"             /* EDIT MACRO FOR AAMV0050         */
AAMV0160 = "CACM0160"             /* EDIT MACRO FOR AAMV0160         */
AAMV0440 = "CACM0440"             /* EDIT MACRO FOR AAMV0440         */
 
sysprompt = "OFF"                 /* CONTROL NOPROMPT                */
sysflush = "OFF"                  /* CONTROL NOFLUSH                 */
sysasis = "ON"                    /* CONTROL ASIS - caps off         */
Numeric digits 10                 /* default of 9 not enough         */
return_code = 0
maxcc = 0
/********************************************/
/* This common script calls the macros for: */
/*                                          */
/* AAMV0050: Duplicate APF data sets.       */
/* AAMV0160: PPT excessive privileges.      */
/* AAMV0440: Use of system password file or */
/*           OS password.                   */
/********************************************/
/*******************************************/
/* TURN ON MESSAGES                        */
/*******************************************/
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
 
/*******************************************/
/* MAIN PROCESS                            */
/*******************************************/
lp = "("
rp = ")"
pdimbr = "AAMV0050"
member = "APFDUPS"
macro = "CACM0050"
return_code = 0
"LMINIT DATAID(EXAMRPT) DDNAME(EXAMRPT)"
lminit_examrpt_error = return_code /* TRAP ERROR CODE */
If return_code > 4 then do
  Say pgmname "LMINIT EXAMRPT RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
return_code = 0
"LMINIT DATAID(PDIDD) DDNAME(PDIDD)"
lminit_pdidd_error = return_code
If return_code > 4 then do
  Say pgmname "LMINIT PDIDD RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
return_code = 0
"LMOPEN DATAID("pdidd") OPTION(OUTPUT)"
lmopen_pdidd_error = return_code
If return_code > 4 then do
  Say pgmname "LMOPEN PDIDD RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
"VPUT (CONSLIST COMLIST SYMLIST TERMMSGS PDIDD) ASIS"
cc50vput = return_code
If return_code <> 0 then do
  Say pgmname cc50vput "RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
return_code = 0
"VIEW DATAID("examrpt") MACRO("macro") MEMBER("member")"
view_apfdups_rc = return_code
If return_code > 4 then do
  Say pgmname "VIEW_APFDUPS_RC" return_code  zerrsm
  SIGNAL ERR_EXIT
  end
"VGET (CM050VGE) ASIS"
 
If macro = "CACM0050" then do
  macro = "CACM0160"
  member = "PPTXRPT"
  end
return_code = 0
"VIEW DATAID("examrpt") MACRO("macro") MEMBER("member")"
view_pptxrpt_rc = return_code
If return_code > 4 then do
  Say pgmname "VIEW_PPTXRPT_RC" return_code  zerrsm
  SIGNAL ERR_EXIT
  end
"VGET (CM160VGE) ASIS"
 
If macro = "CACM0160" then do
  macro = "CACM0440"
  member = "PASSWORD"
  end
return_code = 0
"VIEW DATAID("examrpt") MACRO("macro") MEMBER("member")"
view_password_rc = return_code
If return_code > 4 then do
  Say pgmname "VIEW_PASSWORD_RC" return_code  zerrsm
  SIGNAL ERR_EXIT
  end
"VGET (CM440VGE) ASIS"
ENDITALL:
return_code = 0
"LMFREE DATAID("examrpt")"
lmfree_examrpt_error = return_code
return_code = 0
"LMCLOSE DATAID("pdidd")"
lmclose_pdidd_error = return_code
If return_code > 4 then do
  Say pgmname "LMCLOSE PDIDD RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
return_code = 0
"LMCOMP DATAID("pdidd")"
lmcomp_pdidd_error = return_code
If return_code > 4 then do
  Say pgmname "LMCOMP PDIDD RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL  ERR_EXIT
  end
return_code = 0
"LMFREE DATAID("pdidd")"
lmfree_pdidd_error = 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
 
If termmsgs = "ON" then do
  Say "==============================================================="
  Say "LMINIT_EXAMRPT_ERROR              "lminit_examrpt_error
  Say "LMINIT_PDIDD_ERROR                "lminit_pdidd_error
  Say "LMOPEN_PDIDD_ERROR                "lmopen_pdidd_error
  Say "LMCLOSE_PDIDD_ERROR               "lmclose_pdidd_error
  Say "VIEW_APFDUPS_RC                   "view_apfdups_rc
  Say "VIEW_PPTXRPT_RC                   "view_pptxrpt_rc
  Say "VIEW_PASSWORD_RC                  "view_password_rc
  Say "CC50VPUT                          "cc50vput
  Say "CM050VGE                          "cm050vge
  Say "CM160VGE                          "cm160vge
  Say "CM440VGE                          "cm440vge
  Say "LMFREE_EXAMRPT_ERROR              "lmfree_examrpt_error
  Say "LMCOMP_PDIDD_ERROR                "lmcomp_pdidd_error
  Say "LMFREE_PDIDD_ERROR                "lmfree_pdidd_error
  Say "==============================================================="
  End
Exit 0
 
 
/*******************************************/
/*  SYSCALL SUBROUTINES                    */
/*******************************************/
 
 
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
 
 
