/* REXX */
/* CLS2REXXed by FSOX001 on 26 Apr 2017 at 09:54:25  */
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
 
/*********************************************************************/
/* 10/19/2005 JL.NELSON Moved ALLOC parms to JCL                     */
/* 11/03/2005 CL.FENTON removed information checks for SYSPRINT      */
/* 04/25/2006 CL.FENTON added information on checking on use of      */
/*            backup or primary security database.                   */
/* 06/06/2006 C. STERN  Updated ERROR ROUTINE.                       */
/* 01/31/2008 CL.Fenton Chgs made to use RESTYPE of DSN              */
/* 07/16/2009 CL.FENTON Changes CACT0001 to CACT0000, CAAM0001 to    */
/*            CACM000T.  Changes for reflect new table information.  */
/* 05/19/2017 CL.FENTON Converted script from CLIST to REXX.         */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
CONSLIST = "OFF"                  /* DEFAULT IS OFF                  */
COMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
SYMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
TERMPRO  = "OFF"                  /* DEFAULT IS OFF                  */
TERMMSGS = "OFF"                  /* DEFAULT IS OFF                  */
CACT0000 = "CACT0000"             /* DEFAULT ID TABLE                */
CACC1000 = "CACC1000"             /* Security check program          */
CAAC1000 = "CAAC1000"             /* Setup security envoronment      */
CACM000T = "CACM000T"             /* Edit macro for CT0401/stc*      */
CAAM0002 = "CAAM0002"             /* Edit macro for APF/LINK/LPA     */
CAAM0003 = "CAAM0003"             /* Edit macro for IEA*             */
CAAM0013 = "CAAM0013"             /* Edit macro for JES2 parms       */
TYPERUN  = "FSO"                  /* Run for SRRAUDIT | FSO          */
TRACE    = "OFF"                  /* TRACE ACTIONS AND ERRORS        */
pgmname = "CAAC0001 05/19/17"
 
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_output_rc  = "0"
lminit_temp3_rc   = "0"
lminit_temp4_rc   = "0"
edit_temp4_rc     = "0"
lmopen_output_rc  = "0"
vput_cntl_rc      = "0"
view_cntl_rc      = "0"
tbl_vget_cntl_rc  = "0"
view_temp3_rc     = "0"
lmclose_output_rc = "0"
lmfree_cntl_rc    = "0"
lmfree_output_rc  = "0"
lmfree_temp3_rc   = "0"
lmfree_temp4_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"
/*******************************************/
/* NO VARIABLES ARE PASSED TO THIS CLIST   */
/* BUT KEYWORDS OF                         */
/* CAN BE PASSED TO LET                    */
/* THIS CLIST BE AWARE OF WHAT  ACCESS     */
/* CONTROL PRODUCT AND EXAMINE VERSION     */
/* YOU ARE                                 */
/* WORKING WITH                            */
/*******************************************/
/* CONSLIST = CONLIST                      */
/* COMLIST = LIST                          */
/* SYMLIST = SYMLIST                       */
/* TERMMSGS = MESSAGES                     */
/* TRACE TURNS ON MESSAGING                */
/*******************************************/
return_code = 0                         /* SET RETURN CODE TO 0 */
lidline = 0
restype = "DSN"
"VPUT (LIDLINE RESTYPE TYPERUN CONSLIST CACT0000 COMLIST SYMLIST",
   "TERMPRO TERMMSGS) ASIS"
 
ac01vput = return_code
If return_code <> 0 then
  Say pgmname "VPUT RC =" return_code strip(zerrsm)
/* Determine which security system is running */
return_code = 0
"SELECT CMD("cacc1000 "ACP)"
"VGET (ACPNAME ACPVERS) ASIS"
If acpname <> "ACF2" then do
  Say pgmname "ACF2 Job running on the wrong system"
  Say pgmname acpname acpvers
  return_code = 12
  SIGNAL ERR_EXIT
  end
/*******************************************/
/* INITIALIZE LIBRARY MANAGEMENT           */
/*******************************************/
return_code = 0                         /* SET RETURN CODE TO 0 */
Address TSO "ALLOC FI(SYSUT1) NEW DELETE UNIT(SYSDA) SPACE(3 1) CYL"
Address TSO "ALLOC FI(SYSUT2) NEW DELETE UNIT(SYSDA) SPACE(3 1) CYL"
return_code = 0                         /* SET RETURN CODE TO 0 */
"LMINIT DATAID(CNTL) DDNAME(CNTL)"
lminit_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_CNTL_RC" return_code strip(zerrsm)
  SIGNAL  ERR_EXIT
  end
"LMINIT DATAID(TEMP3) DDNAME(TEMP3)"
lminit_temp3_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_TEMP3_RC" return_code strip(zerrsm)
  SIGNAL  ERR_EXIT
  end
"LMINIT DATAID(OUTPUT) DDNAME(REPORT)"
lminit_output_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_OUTPUT_RC" return_code strip(zerrsm)
  SIGNAL  ERR_EXIT
  end
"LMINIT DATAID(TEMP4) DDNAME(TEMP4)"
lminit_temp4_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMINIT_TEMP4_RC" return_code strip(zerrsm)
  SIGNAL  ERR_EXIT
  end
"EDIT DATAID("temp4") MEMBER(LIDS) MACRO("caam0013")"
edit_temp4_rc = return_code
return_code = 0                         /* SET RETURN CODE TO 0 */
/*******************************************/
/* ALLOCATE ALTERNATE ACF2 DATABASE FILES  */
/*******************************************/
"SELECT CMD("caac1000")"
return_code = 0
/*******************************************/
/* OPEN DATASETS                           */
/*******************************************/
"LMOPEN DATAID("output") OPTION(OUTPUT)"
lmopen_output_rc = return_code
If return_code <> 0 then do
  Say pgmname "LMOPEN_OUTPUT_RC" return_code  zerrsm
  SIGNAL  ERR_EXIT
  end
/* *************************************** */
/* GET TABLE VALUES                        */
/* *************************************** */
"VIEW DATAID("cntl") MACRO("cacm000t") MEMBER("cact0000")"
view_cntl_rc = return_code
If return_code > 4 then
  SIGNAL  ERR_EXIT    /* EXIT */
return_code = 0
"VGET (TBLMBR) ASIS"
tblmbr = tblmbr
tbl_vget_cntl_rc = return_code
If return_code > 0 then
  SIGNAL  ERR_EXIT    /* EXIT */
/*******************************************/
/* PUT VARS IN POOL                        */
/*******************************************/
"VPUT (CNTL OUTPUT TEMP3 TEMP4 CAAM0003 CAAM0013) ASIS"
vput_cntl_rc = return_code
If return_code <> 0 then do
  Say pgmname "VPUT_CNTL_RC" return_code  zerrsm
  SIGNAL  ERR_EXIT
  end
/*******************************************/
/* VIEW TEMP3 DATA SETS                    */
/*******************************************/
"VIEW DATAID("temp3") MACRO("caam0002")"
view_temp3_rc = return_code
return_code = 0
/*******************************************/
/* CLOSE OUTPUT                            */
/*******************************************/
"LMCLOSE DATAID("output")"
lmclose_output_rc = return_code
return_code = 0
/*******************************************/
/* FREE FILES                              */
/*******************************************/
"LMFREE DATAID("cntl")"
lmfree_cntl_rc = return_code
return_code = 0
"LMFREE DATAID("temp3")"
lmfree_temp3_rc = return_code
return_code = 0
"LMFREE DATAID("output")"
lmfree_output_rc = return_code
return_code = 0
"LMFREE DATAID("temp4")"
lmfree_temp4_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 (CM0TVGET CM0TVPUT AM2VGE AM2INT AM2EDT AM2FRE AM2LMP",
  "AM2LMMA AM3VGE AM13VGE) ASIS"
 
If termmsgs = "ON" then do
  Say "==============================================================="
  Say pgmname "LMINIT_CNTL_RC               " lminit_cntl_rc
  Say pgmname "LMINIT_OUTPUT_RC             " lminit_output_rc
  Say pgmname "LMINIT_TEMP3_RC              " lminit_temp3_rc
  Say pgmname "LMINIT_TEMP4_RC              " lminit_temp4_rc
  Say "==============================================================="
  Say pgmname "EDIT_TEMP4_RC                " edit_temp4_rc
  Say "==============================================================="
  Say pgmname "LMOPEN_OUTPUT_RC             " lmopen_output_rc
  Say "==============================================================="
  Say pgmname "VPUT_CNTL_RC                 " vput_cntl_rc
  Say "==============================================================="
  Say pgmname "VIEW_CNTL_RC                 " view_cntl_rc
  Say pgmname cacm000t "CM0TVGET            " cm0tvget
  Say pgmname cacm000t "CM0TVPUT            " cm0tvput
  Say "==============================================================="
  Say pgmname "TBL_VGET_CNTL_RC             " tbl_vget_cntl_rc
  Say "==============================================================="
  Say pgmname "VIEW_TEMP3_RC                " view_temp3_rc
  Say pgmname caam0002 "AM2VGE              " am2vge
  Say pgmname caam0002 "AM2INT              " am2int
  Say pgmname caam0002 "AM2EDT              " am2edt
  Say pgmname caam0002 "AM2FRE              " am2fre
  Say pgmname caam0002 "AM2LMP              " am2lmp
  Say pgmname caam0002 "AM2LMMA             " am2lmma
  Say pgmname caam0003 "AM3VGE              " am3vge
  Say pgmname caam0013 "AM13VGE             " am13vge
  Say "==============================================================="
  Say pgmname "LMCLOSE_OUTPUT_RC            " lmclose_output_rc
  Say "==============================================================="
  Say pgmname "LMFREE_CNTL_RC               " lmfree_cntl_rc
  Say pgmname "LMFREE_OUTPUT_RC             " lmfree_output_rc
  Say pgmname "LMFREE_TEMP3_RC              " lmfree_temp3_rc
  Say pgmname "LMFREE_TEMP4_RC              " lmfree_temp4_rc
  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':' strip(ERRORTEXT(rc))
  say SOURCELINE(sigl)
  end
if return_code > maxcc then
  maxcc = return_code
return
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
