/* REXX */
/* CLS2REXXed by UMLA01S on 19 Jul 2021 at 12:36:15  */
/*Trace ?r*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
 
/*********************************************************************/
/* This common script calls CAAM0007 for:                            */
/*                                                                   */
/* AAMV0420: Check for scheduled back-up of ACF2.                    */
/*********************************************************************/
/* 08/24/2007 C Stern Created for AAMV0420.                          */
/* 08/19/2021 CL Fenton Converted script from CLIST to REXX.         */
/* 10/16/2025 CL Fenton Added pgmname to say statements.             */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CAAC0004 10/16/25"
CONSLIST = "OFF"                  /* DEFAULT IS OFF                  */
COMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
SYMLIST  = "OFF"                  /* DEFAULT IS OFF                  */
TERMMSGS = "OFF"                  /* DEFAULT IS OFF                  */
TEST     = "OFF"                  /* FINDING MSGS (OFF|MOD|FINDING)  */
TRACE    = "OFF"                  /* TRACE ACTIONS AND ERRORS        */
CAAM0007 = "CAAM0007"             /* PDI MACRO FOR SHOW ALL COMMAND  */
sysprompt = "OFF"                 /* CONTROL NOPROMPT                */
sysflush = "OFF"                  /* CONTROL NOFLUSH                 */
sysasis = "ON"                    /* CONTROL ASIS - caps off         */
lminit_temps_error  = "N/A"
lminit_pdidd_error  = "N/A"
lmopen_temps_error  = "N/A"
lmclose_temps_error = "N/A"
vput_error          = "N/A"
edit_temps_error    = "N/A"
vget_error          = "N/A"
am7vge              = "N/A"
lmfree_temps_error  = "N/A"
lmfree_pdidd_error  = "N/A"
Numeric digits 10                 /* default of 9 not enough         */
maxcc = 0
return_code = 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
 
/***********************************************/
/* CONSLIST = CONLIST                          */
/* COMLIST = LIST                              */
/* SYMLIST = SYMLIST                           */
/* TERMMSGS = MESSAGES                         */
/* TRACE TURNS ON MESSAGING                    */
/***********************************************/
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"
 
"VPUT (CONSLIST COMLIST SYMLIST TERMMSGS) ASIS"
return_code = 0
"SELECT CMD(%CACC1000 ACP)"
If return_code <= 4 then,
  "VGET (ACPNAME,ACPVERS) ASIS"
 
 
/**************************************************/
/* Initialize library management for SHOW SYSTEMS */
/**************************************************/
LIBRARY_INITIALIZE:
return_code = 0
"LMINIT DATAID(TEMPS) DDNAME(TEMPS)"
lminit_temps_error = return_code
If return_code <> 0 then,
  SIGNAL ERR_EXIT
 
return_code = 0
"LMINIT DATAID(PDIDD) DDNAME(PDIDD)"
lminit_pdidd_error = return_code
If return_code <> 0 then,
  SIGNAL ERR_EXIT
 
If test <> "MOD" then do
  return_code = 0
  "LMOPEN DATAID("temps") OPTION(OUTPUT)"
  lmopen_temps_error = return_code
  If return_code <> 0 then,
    SIGNAL ERR_EXIT
 
  x = outtrap("out.")
 
  queue "SHOW SYSTEMS"
  queue "QUIT"
  Address TSO "ACF"
 
  Do X = 1 to out.0
    ab = strip(out.x,"T")" "
    abl = length(ab)
    "LMPUT DATAID("temps") MODE(INVAR) DATALOC(AB) DATALEN("abl")",
      "NOBSCAN"
    end
 
  return_code = 0
  "LMCLOSE DATAID("temps")"
  lmclose_temps_error = return_code
  If return_code <> 0 then,
    SIGNAL ERR_EXIT
  end
 
 
BYPASS_SETROPTS:
return_code = 0
"VPUT (TEMPS PDIDD) ASIS"
vput_error = return_code
If return_code > 0 then,
  SIGNAL ERR_EXIT
 
return_code = 0
"VIEW DATAID("temps") MACRO("caam0007")"
edit_temps_error = return_code
If return_code > 4 then,
  SIGNAL ERR_EXIT
 
return_code = 0
"VGET (AM07VGE) ASIS"
vget_error = return_code
 
 
END_EXIT:
return_code = 0
"LMFREE DATAID("temps")"
lmfree_temps_error = return_code
 
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 pgmname "LMINIT_TEMPS_ERROR                "lminit_temps_error
  say pgmname "LMINIT_PDIDD_ERROR                "lminit_pdidd_error
  say pgmname "LMOPEN_TEMPS_ERROR                "lmopen_temps_error
  say pgmname "LMCLOSE_TEMPS_ERROR               "lmclose_temps_error
  say pgmname "VPUT_ERROR                        "vput_error
  say pgmname "EDIT_TEMPS_ERROR                  "edit_temps_error
  say pgmname "VGET_ERROR                        "vget_error
  say pgmname "AM07VGE                           "am07vge
  say pgmname "LMFREE_TEMPS_ERROR                "lmfree_temps_error
  say pgmname "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
 
 
