/* 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.         */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CAAC0004 08/19/21"
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  = 0
lminit_pdidd_error  = 0
lmopen_temps_error  = 0
lmclose_temps_error = 0
vput_error          = 0
edit_temps_error    = 0
vget_error          = 0
am7vge              = 0
lmfree_temps_error  = 0
lmfree_pdidd_error  = 0
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 */
/**************************************************/
return_code = 0
LIBRARY_INITIALIZE:
"LMINIT DATAID(TEMPS) DDNAME(TEMPS)"
If return_code <> 0 then do
  lminit_temps_error = return_code          /* TRAP ERROR CODE */
  SIGNAL ERR_EXIT                            /* EXIT */
  end
 
return_code = 0
"LMINIT DATAID(PDIDD) DDNAME(PDIDD)"
If return_code <> 0 then do
  lminit_pdidd_error = return_code
  SIGNAL ERR_EXIT                            /* EXIT */
  end
 
If test = "MOD" then,
  SIGNAL BYPASS_SETROPTS
 
return_code = 0
"LMOPEN DATAID("temps") OPTION(OUTPUT)"
If return_code <> 0 then do
  lmopen_temps_error = return_code
  SIGNAL ERR_EXIT     /* EXIT */
  end
 
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")"
If return_code <> 0 then do
  lmclose_temps_error = return_code
  SIGNAL ERR_EXIT     /* EXIT */
  end
 
 
BYPASS_SETROPTS:
return_code = 0
"VPUT (TEMPS PDIDD) ASIS"
If return_code > 0 then do
  vput_error = return_code
  SIGNAL ERR_EXIT     /* EXIT */
  end
 
return_code = 0
"VIEW DATAID("temps") MACRO("caam0007")"
If return_code > 4 then do
  edit_temps_error = return_code
  SIGNAL ERR_EXIT     /* EXIT */
  end
 
return_code = 0
"VGET (AM07VGE) ASIS"
If return_code > 0 then,
  vget_error = return_code
 
 
END_EXIT:
return_code = 0
"LMFREE DATAID("temps")"
If return_code <> 0 then,
  lmfree_temps_error = return_code
 
return_code = 0
"LMFREE DATAID("pdidd")"
If return_code <> 0 then,
  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_TEMPS_ERROR                "lminit_temps_error
    Say "LMINIT_PDIDD_ERROR                "lminit_pdidd_error
    Say "LMOPEN_TEMPS_ERROR                "lmopen_temps_error
    Say "LMCLOSE_TEMPS_ERROR               "lmclose_temps_error
    Say "VPUT_ERROR                        "vput_error
    Say "EDIT_TEMPS_ERROR                  "edit_temps_error
    Say "VGET_ERROR                        "vget_error
    Say "AM07VGE                           "am07vge
    Say "LMFREE_TEMPS_ERROR                "lmfree_temps_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
 
 
