/* REXX */
/*                                       */
/* AUTHOR: Charles Fenton                */
/*                                       */
/*trace r?*/
/*Signal On NoValue*/
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"             /* CACM000F EDIT MACRO .PDI(?????) */
/*********************************************************************/
/* DISPLAY SYSTEM INFORMATION ON TERMINAL                            */
/*********************************************************************/
/*********************************************************************/
/* This script generates analysis of Started Task definitions.       */
/*********************************************************************/
/* Change summary:                                                   */
/* 06/07/2024 CL Fenton Initial creation of script to generate       */
/*            finding details for Started Task userid definitions.   */
/* 06/17/2024 CL Fenton Added automation for ZAID0030, ZCA10030,     */
/*            ZCCS0030, ZCLS0030, ZCTD0030, ZCTM0030, ZCTO0030,      */
/*            ZHCK0030, ZIOA0030, ZISF0030, ZMIM0030, ZMVZ0030,      */
/*            ZNCP0030, ZNET0030, ZROS0030, ZSMT0030, ZTAD0030,      */
/*            ZVTA0030, ACF2-IC-000040, RACF-IC-000040, and          */
/*            TSS0-IC-000040 for SCTASKU0157325, SCTASKU0157358,     */
/*            SCTASKU0157400, SCTASKU0157432, SCTASKU0157449,        */
/*            SCTASKU0157481, SCTASKU0157502, SCTASKU0157509,        */
/*            SCTASKU0157551, SCTASKU0157576, SCTASKU0157605,        */
/*            SCTASKU0157639, SCTASKU0157748, SCTASKU0157797,        */
/*            SCTASKU0158057, SCTASKU0158061, SCTASKU0158911,        */
/*            SCTASKU0158924, and SCTASKU0170585.                    */
/* 10/06/2025 CL Fenton Chgs to add new automation for IBM zSecure   */
/*            Suite, SCTASKU0461677.                                 */
/* 04/02/2026 CL Fenton Added automation for ZCIC0040 and            */
/*            ZWMQ0030 for SCTASKU0563911 and SCTASKU0566750.        */
/* 08/25/2026 CL Fenton Added automation for ZUSS0043 and            */
/*            ZUSS0044 for SCTASKU0633617 and SCTASKU0633711.        */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
PGMNAME = 'CACM000F 08/25/26'
sysprompt = "OFF"                /* CONTROL NOPROMPT          */
sysflush = "OFF"                 /* CONTROL NOFLUSH           */
sysasis = "ON"                   /* CONTROL ASIS - caps off   */
return_code = 0
maxcc = 0
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMMSGS                                */
/* MBRLIST                                 */
/* ACPNAME                                 */
/* TYPERUN                                 */
/*******************************************/
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
"NUMBER OFF"
"CAPS OFF"
"STATS OFF"
return_code = 0
maxcc = 0
zerrsm = ""
finding_undef = ""
finding_missing = ""
finding_stc = ""
 
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS MBRLIST",
  "ACPNAME TYPERUN) ASIS"
 
If return_code <> 0 then do
  Say pgmname "VGET RC =" return_code zerrsm
  Say pgmname "CONSLIST/"conslist "COMLIST/"comlist "SYMLIST/"symlist ,
    "TERMMSGS/"termmsgs
  Say pgmname "MBRLIST/"mbrlist "ACPNAME/"acpname "TYPERUN/"typerun
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" ,
  then Trace r
 
"(NUM) = LINENUM .ZL"
if num > 0 then ,
  "DELETE .ZF .ZL"
 
TYPRUN = left(acpname,1)typerun
interpret call TYPRUN
 
ERR_EXIT:
"SAVE"
"END"
Exit 0                                       /* End CACC1001 - RC 0  */
 
 
/*********************************************************************/
/*  Start of sub-routines                                            */
/*********************************************************************/
/* ACF2 Started Task userids with checking OMVS requirements         */
/*********************************************************************/
AOMVS:
AROOT:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  say pgmname userid dfltgrp uid home program
  if dfltgrp = "" | (dfltgrp <> "OMVSGRP" & dfltgrp <> "STCOMVS") | ,
     uid = "" | uid <> 0 | ,
     home = "" | home <> "/" | ,
     program = "" | program <> "/bin/sh" then do
    call process_detail_lines
    if uid = "" then do
      data = "          UID(0) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if uid <> 0 then do
        data = "          UID("uid") specified should be UID(0)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if dfltgrp = "" then do
      data = "          GROUP(OMVSGRP) or GROUP(STCOMVS) should",
        "be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if dfltgrp <> "OMVSGRP" & dfltgrp <> "STCOMVS" then do
        data = "          GROUP("dfltgrp") specified should be",
          "GROUP(OMVSGRP) or GROUP(STCOMVS)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if home = "" then do
      data = "          HOME(/) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if home <> "/" then do
        data = "          HOME("home") specified should be HOME(/)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if program = "" then do
      data = "          OMVSPGM(/bin/sh) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if program <> "/bin/sh" then do
        data = "          OMVSPGM("program") specified should be",
          "OMVSPGM(/bin/sh)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    end
  end
 
if finding_undef = "" & finding_missing = "" then do
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
  "LINE_AFTER .ZLAST = DATALINE ' '"
  do ln = 1 to out.0
    "LINE_AFTER .ZLAST = DATALINE '"out.ln"'"
    end
 
  end
 
return
 
 
/*********************************************************************/
/* ACF2 Started Task userids with STC attributes                     */
/*********************************************************************/
AABNDAID:
ACA1:
ACCS:
AHLTHCK:
ASDSF:
ATADZ:
AZSECURE:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  if stc = "" then do
    call process_detail_lines
    data = "          STC"
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* ACF2 Started Task userids with STC and NO-SMC attributes          */
/*********************************************************************/
ABMCMVZ:
ACAMIM:
ACSSMTP:
AVTAPE:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  if stc = "" | ,
     nosmc = "" then do
    call process_detail_lines
    if stc = "" then do
      data = "          STC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosmc = "" then do
      data = "          NO-SMC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* ACF2 Started Task userids with STC, MUSASS, and NO-SMC attribute  */
/*********************************************************************/
ABMCCTD:
ABMCCTM:
ABMCCTO:
ABMCIOA:
ACLSUPER:
AICSF:
AMQS:
ANETVIEW:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef= "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  if stc = "" | ,
     musass = "" | ,
     nosmc = "" then do
    call process_detail_lines
    if stc = "" then do
      data = "          STC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if musass = "" then do
      data = "          MUSASS"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosmc = "" then do
      data = "          NO-SMC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* ACF2 Started Task userids with STC, MUSASS, NO-SMC, and MUSUPDT   */
/* attributes                                                        */
/*********************************************************************/
ANCPASS:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  if stc = "" | ,
     musass = "" | ,
     nosmc = "" | ,
     musupdt = "" then do
    call process_detail_lines
    if stc = "" then do
      data = "          STC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if musass = "" then do
      data = "          MUSASS"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosmc = "" then do
      data = "          NO-SMC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if musupdt = "" then do
      data = "          MUSUPDT"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* ACF2 Started Task userids with STC, MUSASS, NO-SMC and JOBFROM    */
/* attributes                                                        */
/*********************************************************************/
AROSCOE:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  if stc = "" | ,
     musass = "" | ,
     nosmc = "" | ,
     jobfrom = "" then do
    call process_detail_lines
    if stc = "" then do
      data = "          STC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if musass = "" then do
      data = "          MUSASS"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosmc = "" then do
      data = "          NO-SMC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if jobfrom = "" then do
      data = "          JOBFROM"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* ACF2 Started Task userids with STC, MUSASS, NO-SMC, ACF2CICS, and */
/* NONON-CNCL attributes.                                            */
/*********************************************************************/
ACICS:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_acf2_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_acf2_user
  if stc = "" | ,
     musass = "" | ,
     nosmc = "" | ,
     acf2cics = "" |,
     noncncl <> "" then do
    call process_detail_lines
    if stc = "" then do
      data = "          STC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if musass = "" then do
      data = "          MUSASS"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosmc = "" then do
      data = "          NO-SMC"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if acf2cics = "" then do
      data = "          ACF2CICS"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if noncncl <> "" then do
      data = "          NON-CNCL"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* RACF Started Task userids with checking OMVS requirements         */
/*********************************************************************/
ROMVS:
RROOT:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_racf_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_racf_user
  say pgmname userid dfltgrp uid home program
  if dfltgrp = "" | (dfltgrp <> "OMVSGRP" & dfltgrp <> "STCOMVS") | ,
     uid = "" | uid <> 0 | ,
     home = "" | home <> "/" | ,
     program = "" | program <> "/bin/sh" then do
    call process_detail_lines
    if uid = "" then do
      data = "          UID(0) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if uid <> 0 then do
        data = "          UID("uid") specified should be UID(0)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if dfltgrp = "" then do
      data = "          DFLTGRP(OMVSGRP) or DFLTGRP(STCOMVS) should",
        "be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if dfltgrp <> "OMVSGRP" & dfltgrp <> "STCOMVS" then do
        data = "          DFLTGRP("dfltgrp") specified should be",
          "DFLTGRP(OMVSGRP) or DFLTGRP(STCOMVS)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if home = "" then do
      data = "          HOME(/) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if home <> "/" then do
        data = "          HOME("home") specified should be HOME(/)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if program = "" then do
      data = "          PROGRAM(/bin/sh) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if program <> "/bin/sh" then do
        data = "          PROGRAM("program") specified should be",
          "PROGRAM(/bin/sh)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    end
  end
 
if finding_undef = "" & finding_missing = "" then do
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
  "LINE_AFTER .ZLAST = DATALINE ' '"
  do ln = 1 to out.0
    "LINE_AFTER .ZLAST = DATALINE '"out.ln"'"
    end
 
return
 
 
/*********************************************************************/
/* RACF Started Task userids being defined                           */
/*********************************************************************/
RCICS:
RICSF:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_racf_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
if typerun = "CICS" then do
  do a = 1 to words(mbrlist)
    userid = word(mbrlist,a)
    return_code = 0
    "FIND '"userid" ' 6 FIRST"
    if return_code = 0 then iterate
    call process_started_task
    if return_code <> 0 then do
      if finding_stc = "" then do
        "LINE_AFTER .ZLAST = DATALINE 'The Product started task(s)",
          "is(are) improperly defined to the started resource",
          "class:'"
        "LINE_AFTER .ZLAST = DATALINE ' '"
        finding_stc = "X"
        end
      data = "     "userid
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_stc = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* RACF Started Task userids having the PROTECTED attribute          */
/*********************************************************************/
RABNDAID:
RBMCCTD:
RBMCCTM:
RBMCCTO:
RBMCIOA:
RBMCMVZ:
RCAMIM:
RCA1:
RCCS:
RCLSUPER:
RCSSMTP:
RHLTHCK:
RMQS:
RNCPASS:
RNETVIEW:
RROSCOE:
RSDSF:
RTADZ:
RVTAPE:
RZSECURE:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_racf_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_racf_user
  if protected = "" then do
    if finding_missing = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) do",
        "not have the PROTECTED attribute.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_missing = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
if typerun = "MQS" then do
  do a = 1 to words(mbrlist)
    userid = word(mbrlist,a)
    return_code = 0
    "FIND '"userid" ' 6 FIRST"
    if return_code = 0 then iterate
    call process_started_task
    if return_code <> 0 then do
      if finding_stc = "" then do
        "LINE_AFTER .ZLAST = DATALINE 'The Product started task(s)",
          "is(are) improperly defined to the started resource",
          "class:'"
        "LINE_AFTER .ZLAST = DATALINE ' '"
        finding_stc = "X"
        end
      data = "     "userid
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" & finding_stc = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* TSS Started Task userids has FACILITY(STC BATCH),                 */
/* PASSWORD(xxxxxxxx,0), and SOURCE(INTRDR)                          */
/*********************************************************************/
TOMVS:
TROOT:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_tss_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_tss_user
  say pgmname userid dfltgrp uid home program
  if dfltgrp = "" | (dfltgrp <> "OMVSGRP" & dfltgrp <> "STCOMVS") | ,
     uid = "" | uid <> 0 | ,
     home = "" | home <> "/" | ,
     program = "" | program <> "/bin/sh" then do
    call process_detail_lines
    if uid = "" then do
      data = "          UID(0) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if uid <> 0 then do
        data = "          UID("uid") specified should be UID(0)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if dfltgrp = "" then do
      data = "          DFLTGRP(OMVSGRP) or DFLTGRP(STCOMVS) should",
        "be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if dfltgrp <> "OMVSGRP" & dfltgrp <> "STCOMVS" then do
        data = "          DFLTGRP("dfltgrp") specified should be",
          "DFLTGRP(OMVSGRP) or DFLTGRP(STCOMVS)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if home = "" then do
      data = "          HOME(/) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if home <> "/" then do
        data = "          HOME("home") specified should be HOME(/)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    if program = "" then do
      data = "          OMVSPGM(/bin/sh) should be specified."
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    else
      if program <> "/bin/sh" then do
        data = "          OMVSPGM("program") specified should be",
          "OMVSPGM(/bin/sh)."
        "LINE_AFTER .ZLAST = DATALINE (DATA)"
        end
    end
  end
 
if finding_undef = "" & finding_missing = "" then do
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
  "LINE_AFTER .ZLAST = DATALINE ' '"
  do ln = 1 to out.0
    "LINE_AFTER .ZLAST = DATALINE '"out.ln"'"
    end
 
return
 
 
/*********************************************************************/
/* TSS Started Task userids has FACILITY(STC BATCH),                 */
/* PASSWORD(xxxxxxxx,0), and SOURCE(INTRDR)                          */
/*********************************************************************/
TCCS:
TICSF:
TTADZ:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_tss_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_tss_user
  if facility = "" | ,
     password = "" | ,
     source = "" then do
    call process_detail_lines
    if wordpos("STC",facility) = 0 | ,
       wordpos("BATCH",facility) = 0 then do
      data = "          FACILITY(STC BATCH)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if password = "" then do
      data = "          PASSWORD(xxxxxxxx,0)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if source = "" then do
      data = "          SOURCE(INTRDR)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* TSS Started Task userids has FACILITY(STC BATCH),                 */
/* PASSWORD(xxxxxxxx,0), SOURCE(INTRDR), and NOSUSPEND               */
/*********************************************************************/
TABNDAID:
TCAMIM:
THLTHCK:
TSDSF:
TCSSMTP:
TVTAPE:
TZSECURE:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_tss_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_tss_user
  if facility = "" | ,
     password = "" | ,
     source = "" | ,
     nosuspend = "" then do
    call process_detail_lines
    if wordpos("STC",facility) = 0 | ,
       wordpos("BATCH",facility) = 0 then do
      data = "          FACILITY(STC BATCH)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if password = "" then do
      data = "          PASSWORD(xxxxxxxx,0)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if source = "" then do
      data = "          SOURCE(INTRDR)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosuspend = "" then do
      data = "          NOSUSPEND"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
/*********************************************************************/
/* TSS Started Task userids has FACILITY(STC BATCH),                 */
/* PASSWORD(xxxxxxxx,0), SOURCE(INTRDR), NOSUSPEND, and              */
/* MASTFAC(xxxxxxxx)                                                 */
/*********************************************************************/
TCA1:
TCLSUPER:
TBMCCTD:
TBMCCTM:
TBMCCTO:
TBMCIOA:
TBMCMVZ:
TCICS:
TMQS:
TNCPASS:
TNETVIEW:
TROSCOE:
do a = 1 to words(mbrlist)
  userid = word(mbrlist,a)
  call process_tss_user
  if return_code <> 0 then do
    if finding_undef = "" then do
      "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) are",
        "not defined.'"
      "LINE_AFTER .ZLAST = DATALINE ' '"
      finding_undef = "X"
      end
    data = "     "userid
    "LINE_AFTER .ZLAST = DATALINE (DATA)"
    end
  end
return_code = 0
 
"(NUM) = LINENUM .ZL"
if num > 0 then,
  "LINE_AFTER .ZLAST = DATALINE ' '"
 
do a = 1 to words(mbrlist)
  userid_finding = ""
  userid = word(mbrlist,a)
  return_code = 0
  "FIND '"userid" ' 6 FIRST"
  if return_code = 0 then iterate
  call process_tss_user
  if facility = "" | ,
     password = "" | ,
     source = "" | ,
     nosuspend = "" then do
    call process_detail_lines
    if wordpos("STC",facility) = 0 | ,
       wordpos("BATCH",facility) = 0 then do
      data = "          FACILITY(STC BATCH)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if password = "" then do
      data = "          PASSWORD(xxxxxxxx,0)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if source = "" then do
      data = "          SOURCE(INTRDR)"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    if nosuspend = "" then do
      data = "          NOSUSPEND"
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  call process_tss_mastfac
  end
 
if typerun = "CICS" |,
   typerun = "MQS" then do
  "(NUM) = LINENUM .ZL"
  if num > 0 then,
    "LINE_AFTER .ZLAST = DATALINE ' '"
  do a = 1 to words(mbrlist)
    userid = word(mbrlist,a)
    return_code = 0
    "FIND '"userid" ' 6 FIRST"
    if return_code = 0 then iterate
    Say pgmname "Processing Started Task Table for" userid"."
    call process_started_task
    if return_code <> 0 then do
      if finding_stc = "" then do
        "LINE_AFTER .ZLAST = DATALINE 'The Product started task(s)",
          "is(are) improperly defined to the started task",
          "table:'"
        "LINE_AFTER .ZLAST = DATALINE ' '"
        finding_stc = "X"
        end
      data = "     "userid
      "LINE_AFTER .ZLAST = DATALINE (DATA)"
      end
    end
  end
 
if finding_undef = "" & finding_missing = "" & finding_stc = "" then,
  "LINE_AFTER .ZLAST = DATALINE 'Not a Finding'"
 
return
 
 
process_acf2_user:
stc       = ""
musass    = ""
noncncl   = ""
nosmc     = ""
musupdt   = ""
jobfrom   = ""
dfltgrp   = ""
uid       = ""
home      = ""
program   = ""
return_code = 0
x = outtrap("out.")
queue "SET LID"
queue "LIST" userid "SECTION(ALL) PROFILE(OMVS)"
queue "QUIT"
Address TSO ACF
if return_code <> 0 then return
do ln = 1 to out.0
  if pos("PRIVILEGES ",out.ln) = 2 then do
    if pos("STC ",out.ln) > 0 then stc = "STC"
    if pos("MUSASS ",out.ln) > 0 then musass = "MUSASS"
    if pos("NON-CNCL ",out.ln) > 0 then noncncl = "NON-CNCL"
    if pos("NO-SMC ",out.ln) > 0 then nosmc = "NO-SMC"
    if pos("JOBFROM ",out.ln) > 0 then jobfrom = "JOBFROM"
    iterate
    end
  if pos("MUSASS ",out.ln) = 2 & ,
     pos("MUSUPDT ",out.ln) > 0 then musupdt = "MUSUPDT"
  if pos("CICS ",out.ln) = 2 & ,
     pos("ACF2CICS ",out.ln) > 0 then acf2cics = "ACF2CICS"
  if pos("OMVS ",out.ln) = 2 & ,
     pos("UID(",out.ln) > 0 then do
      parse var out.ln . "UID(" uidx ")" .
      uidx = translate(uidx,"",",")
      do x = 1 to words(uidx)
        uid = uid""word(uidx,x)
        end
      end
  if pos("RESTRICTIONS ",out.ln) = 2 & ,
     pos("GROUP(",out.ln) > 0 then ,
      parse var out.ln . "GROUP(" dfltgrp ")" .
  if pos("OMVS ",out.ln) = 2 & ,
     pos("HOME(",out.ln) > 0 then ,
      parse var out.ln . "HOME(" home ")" .
  if pos("OMVS ",out.ln) = 2 & ,
     pos("OMVSPGM(",out.ln) > 0 then ,
      parse var out.ln . "OMVSPGM(" program ")" .
  end
return
 
 
process_racf_user:
protected = ""
dfltgrp   = ""
uid       = ""
home      = ""
program   = ""
return_code = 0
x = outtrap("out.")
Address TSO "LU" userid "OMVS"
if return_code <> 0 then return
do ln = 1 to out.0
  if pos("ATTRIBUTES=",out.ln) > 0 & ,
     pos("PROTECTED",out.ln) > 0 then do
    protected="PROTECTED"
    end
  if pos("DEFAULT-GROUP=",out.ln) <> 0 then,
    parse var out.ln . "DEFAULT-GROUP=" dfltgrp .
  if pos("UID=",out.ln) <> 0 then uid = word(out.ln,2)
  if pos("HOME=",out.ln) <> 0 then home = word(out.ln,2)
  if pos("PROGRAM=",out.ln) <> 0 then program = word(out.ln,2)
  end
return
 
 
process_tss_user:
facility  = ""
password  = ""
source    = ""
nosuspend = ""
mastfac   = ""
dfltgrp   = ""
uid       = ""
home      = ""
program   = ""
return_code = 0
x = outtrap("out.")
Address TSO "TSS LIST("userid") DATA(BASIC PASSWORD SOURCE PROFILE)",
  "SEGMENT(OMVS)"
if return_code <> 0 then return
do ln = 1 to out.0
  if pos("FACILITY   =",out.ln) = 1 then ,
    facility= facility" "substr(out.ln,14)
  if pos("PASSWORD   =",out.ln) = 1 & ,
     substr(out.ln,14,49) = " " then ,
    password= "PASSWORD(xxxxxxxx,0)"
  if pos("SOURCES    =",out.ln) = 1 then ,
    source = substr(out.ln,14)
  if pos("BYPASSING  =",out.ln) = 1 then ,
    nosuspend = substr(out.ln,14)
  if pos("MASTER FAC =",out.ln) = 1 then ,
    mastfac = substr(out.ln,14)
  if pos("UID        =",out.ln) = 1 then ,
    uid = substr(out.ln,14)
  if pos("DFLTGRP    =",out.ln) = 1 then ,
    dfltgrp = substr(out.ln,14)
  if pos("HOME       =",out.ln) = 1 then ,
    home = substr(out.ln,14)
  if pos("OMVSPGM    =",out.ln) = 1 then ,
    program = substr(out.ln,14)
  end
facility = strip(facility,"B")
return
 
 
process_tss_mastfac:
if typerun = "BMCCTD" & ,
   mastfac <> "CONTROLD" then do
  call process_detail_lines
  data = "          MASTFAC(CONTROLD)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "BMCCTM" & ,
   mastfac <> "CONTROLM" then do
  call process_detail_lines
  data = "          MASTFAC(CONTROLM)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "BMCCTO" & ,
   mastfac <> "CONTROLO" then do
  call process_detail_lines
  data = "          MASTFAC(CONTROLO)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "BMCIOA" & ,
   mastfac <> "IOA" then do
  call process_detail_lines
  data = "          MASTFAC(IOA)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "BMCMVZ" & ,
   (userid = "MV$CAS" | ,
    userid = "MV$PAS") & ,
   mastfac <> "BBI3" then do
  call process_detail_lines
  data = "          MASTFAC(BBI3)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "CA1" & ,
   mastfac <> "CA1" then do
  call process_detail_lines
  data = "          MASTFAC(CA1)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "CLSUPER" & ,
   mastfac <> "KLS" then do
  call process_detail_lines
  data = "          MASTFAC(KLS)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "MQS" & ,
   pos("MSTR",userid) = 4 &,
   mastfac <> userid &,
   pos("MSTR",mastfac) = 4 then do
  call process_detail_lines
  data = "          MASTFAC("userid")"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "NCPASS" & ,
   mastfac <> "NCPASS" then do
  call process_detail_lines
  data = "          MASTFAC(NCPASS)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "NETVIEW" & ,
   userid = "CNMPROC" & ,
   mastfac <> "NETVIEW" then do
  call process_detail_lines
  data = "          MASTFAC(NETVIEW)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
if typerun = "ROSCOE" & ,
   mastfac <> "ROSCOE" then do
  call process_detail_lines
  data = "          MASTFAC(ROSCOE)"
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  end
 
return
 
 
process_detail_lines:
if finding_missing = "" then do
  "LINE_AFTER .ZLAST = DATALINE 'The following User Id(s) do",
    "not have the specified attribute.'"
  "LINE_AFTER .ZLAST = DATALINE ' '"
  finding_missing = "X"
  end
 
if userid_finding = "" then do
  data = "     "userid
  "LINE_AFTER .ZLAST = DATALINE (DATA)"
  userid_finding = "X"
  end
 
return
 
 
process_started_task:
x = outtrap("stc.")
if acpname = "RACF" then do
  return_code = 0
  Address TSO "RLIST STARTED" userid".** NORACF STDATA"
  if return_code > 0 then do
    return_code = 0
    Address TSO "RLIST STARTED" userid".* NORACF STDATA"
    end
  data = "     "userid
  return
/*if return_code <> 0 then return*/
  end
 
if acpname = "TSS" then do
  return_code = 4
  Address TSO "TSS LIST(STC)"
  do xx = 1 to stc.0
    parse var stc.xx . "=" . "=" acidid .
    if userid = acidid then do
      return_code = 0
      data = "     "stc.xx
      return
    end
  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
