/* REXX */
/* CLS2REXXed by UMLA01S on 21 Jun 2019 at 19:17:16  */
/*trace r?*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"           /* CACM0370 EDIT MACRO */
/*********************************************************************/
/* This routine reads the PARMLIB member SMFPRMxx in TEMP19 as       */
/* provided by CACC0003. This edit macro provides the finding        */
/* details for SMFPRM member.  It verifies parameters as             */
/* specified in the STIG section: 2.1.2.10                           */
/*********************************************************************/
/* Change Log                                                        */
/* 06/11/2007 C Stern Created for AAMV0370.                          */
/* 09/22/2009 CL Fenton Added REMOVE_COMMENTS to remove comments     */
/*            from various member.  Modification made remove         */
/*            comment logic from other parts of this member.         */
/* 10/20/2009 CL Fenton Added AAMV0380 analysis for TYPE entries.    */
/* 02/24/2010 CL Fenton Chgd analysis of AAMV0380 to drop subtype    */
/*            record information from smf record types.              */
/* 03/19/2010 CL Fenton Corrected issue with subtype secified on     */
/*            NOTYPE entries being neglected.                        */
/* 02/22/2012 CL Fenton Removed record types 63, 67, 68, and 69      */
/*            from AAMV0380 analysis for IBM no longer supports      */
/*            these SMF records, CSD-AR003281302.                    */
/* 06/05/2014 CL Fenton Removed record types 101 and added record    */
/*            types 41, 42, 102, and 119 to AAMV0380 analysis,       */
/*            STS-005858.                                            */
/* 11/16/2017 CL Fenton Chgd process on evaluation of subtype        */
/*            record types for record type 92 in AAMV0380,           */
/*            STS-018482.                                            */
/* 06/07/2018 CL Fenton Chgd process to add record type 82 to        */
/*            evaluation of AAMV0380, STS-020193.                    */
/* 06/21/2019 CL Fenton Converted script from CLIST to REXX.         */
/* 06/05/2020 CL Fenton Chgd REMOVE_COMMENTS process when the        */
/*            slash-asterisk is found on a line, but asterisk-slash  */
/*            is not found on remaining lines, i.e. comments,        */
/*            STS-024781.                                            */
/* 01/29/2021 CL Fenton Added automation for addition SMFPRMxx       */
/*            vuls, STS-025825, STS-025826, and STS-025827.          */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CACM0370 01/29/21"
sysprompt = "OFF"                /* CONTROL NOPROMPT          */
sysflush = "OFF"                /* CONTROL NOFLUSH           */
sysasis = "ON"                 /* CONTROL ASIS - caps off   */
return_code = 0
maxcc = 0
max_rc = 0
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
 
/* GET VARIABLES FROM POOL */
Address ISPEXEC "VGET (ACPNAME CONSLIST COMLIST SYMLIST TERMMSGS",
  "TEMP8 CACM040A MEMBER MBRPREF MBRZFND PARMDSN PDIDD PDINAME",
  "PDIERROR RESVOL CATVOL) ASIS"
 
cm70vge = return_code
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 "ACPNAME/"acpname "TEMP8/"temp8 "CACM040A/"cacm040a,
    "MEMBER/"member "MBRPREF/"mbrpref
  Say pgmname "MBRZFND/"mbrzfnd "PARMDSN/"parmdsn "PDIDD/"pdidd,
    "PDINAME/"pdiname
  Say pgmname "PDIERROR/"pdierror "RESVOL/"resvol "CATVOL/"catvol
  SIGNAL ERR_EXIT
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" ,
  then Trace r
 
maxcc = 0
return_code = 0
/*******************************************/
/* TURN ON MESSAGES                        */
/*******************************************/
syssymlist = symlist          /* CONTROL SYMLIST/NOSYMLIST */
sysconlist = conslist         /* CONTROL CONLIST/NOCONLIST */
syslist = comlist             /* CONTROL LIST/NOLIST       */
sysmsg = termmsgs             /* CONTROL MSG/NOMSG         */
sysasis = "ON"                /* CONTROL ASIS - caps off   */
/*******************************************/
/* MAIN PROCESS                            */
/*******************************************/
vmember = member
"NUMBER = OFF"
"AUTONUM = OFF"
Call remove_comments
 
 
/* HOUSEKEEPING */
"(A) = DATASET"
"(LASTLINE) = LINENUM .ZLAST"
lp = "("
rp = ")"
active_switch   = "N"
jwt_switch      = "N"
swt_switch      = "N"
twt_switch      = "N"
buw_switch      = "N"
maxdorm_switch  = "N"
sid_switch      = "N"
sys_switch      = "N"
sys_sw          = " "
detail_switch   = "N"
interval_switch = "N"
finding_switch  = "N"
last_time       = "N"
x1 = parmdsn"("member")"
 
If pdiname = "AAMV0380" then,
  Call AAMV0380_PROCESS
If pdiname = "AAMV0370" then,
  Call AAMV0370_PROCESS
If pdiname = "AAMV0371" then,
  Call AAMV0371_PROCESS
If pdiname = "AAMV0372" then,
  Call AAMV0372_PROCESS
If pdiname = "AAMV0373" then,
  Call AAMV0373_PROCESS
 
 
END_IT_ALL:
return_code = 0
 
 
ERR_EXIT:
If maxcc >= 16 | return_code > 0 then do
  Address ISPEXEC "VGET (ZISPFRC) SHARED"
  If maxcc > zispfrc then
    zispfrc = maxcc
  Else
    zispfrc = return_code
  Address ISPEXEC "VPUT (ZISPFRC) SHARED"
  Say pgmname "ZISPFRC =" zispfrc
  end
Address ISPEXEC "VPUT (PDIERROR CM70VGE) ASIS"
"END"
Exit
 
 
AAMV0370_PROCESS:
/* Begin process on AAMV0370 */
return_code = 0
"FIND 'NOACTIVE' FIRST"
If return_code = 0 then do
  x2 = "NOACTIVE"
  active_switch = "Y"
  finding_switch = "Y"
  end
 
/* Commented out the following test, moved to AAMV0373.              */
/*return_code = 0                                                    */
/*"FIND 'JWT(' FIRST"                                                */
/*If return_code <> 0 then do                                        */
/*  Say pgmname vmember "does not specify JWT, default of",          */
/*    "JWT(0010) will be used."                                      */
/*  jwt_switch = "N"                                                 */
/*  jwt_time = "0010"                                                */
/*  end                                                              */
/*Else do                                                            */
/*  "(ROW) = LINENUM .ZCSR"                                          */
/*  "(DATA) = LINE" row                                              */
/*  parse var data . "JWT(" jwt_time ")" .                           */
/*  end                                                              */
/*If jwt_time > 0 & jwt_time < 16 & length(jwt_time) = 4 then,       */
/*  jwt_switch = "N"                                                 */
/*Else do                                                            */
/*  jwt_switch = "Y"                                                 */
/*  finding_switch = "Y"                                             */
/*  x3 = "JWT("jwt_time")"                                           */
/*  end                                                              */
 
 
MAX_DORM_CHECK:
return_code = 0
"FIND 'NOMAXDORM' FIRST"
If return_code = 0 then do
  x4 = "NOMAXDORM"
  maxdorm_switch = "Y"
  finding_switch = "Y"
  end
Else do
  return_code = 0
  "FIND 'MAXDORM(' FIRST"
  If return_code <> 0 then do
    x4 = "MAXDORM is missing."
    Say pgmname vmember "does not specify MAXDORM, default of",
      "MAXDORM(3000) will be used."
    max_dorm_time = "3000"
    end
  Else do
    "(ROW) = LINENUM .ZCSR"
    "(DATA) = LINE" row
    parse var data . "MAXDORM(" max_dorm_time ")" .
    end
  If max_dorm_time > 0 & max_dorm_time < 501 then,
      maxdorm_switch = "N"
  Else do
    x4 = "MAXDORM("max_dorm_time")"
    maxdorm_switch = "Y"
    finding_switch = "Y"
    end
  end
 
 
SID_CHECK:
"EXCLUDE ALL 'SUBSYS('"
return_code = 0
"FIND 'SID(' FIRST"
If return_code <> 0 then do
  sid_switch = "Y"
  finding_switch = "Y"
  end
 
 
SYS_CHECK:
Call Obtain_SYS_data
 
 
NODETAIL_CHECK:
If pos("NODETAIL",sys_data) > 0 then do
  detail_switch = "Y"
  finding_switch = "Y"
  end
Else do
  If pos("DETAIL",sys_data) = 0 then do
    Say pgmname vmember "does not specify DETAIL, default of",
      "NODETAIL will be used."
    detail_switch = "Y"
    finding_switch = "Y"
    end
  end
 
 
NOINTERVAL_CHECK:
If pos("NOINTERVAL",sys_data) > 0 then do
  interval_switch = "Y"
  finding_switch = "Y"
  end
Else do
  If pos("INTERVAL",sys_data) = 0 then do
    Say pgmname vmember "does not specify INTERVAL, default of",
      "NOINTERVAL will be used."
    interval_switch = "Y"
    finding_switch = "Y"
    end
  end
 
 
MAIN_PROCESS_END:
If finding_switch = "N" then do
  pdierror = 0
  Address ISPEXEC "VPUT (PDIERROR) ASIS"
  Return
/*SIGNAL END_IT_ALL*/
  end
 
If active_switch = "Y" then do
  ac = "          "x2
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
/*If jwt_switch = "Y" then do                                        */
/*  ac = "          "x3                                              */
/*  Call put_it                                                      */
/*  pdierror = 8                                                     */
/*  If pdiname <> " " then,                                          */
/*    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"                      */
/*  return_code = 0                                                  */
/*  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",        */
/*    "MEMBER("pdiname")"                                            */
/*  If return_code > 4 then do                                       */
/*    Say pgmname "EDIT PDI" pdiname "RC =" return_code zerrsm       */
/*    return_code = return_code + 16                                 */
/*    SIGNAL ERR_EXIT                                                */
/*    end                                                            */
/*  end                                                              */
 
If maxdorm_switch = "Y" then do
  ac = "          "x4
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
If sid_switch = "Y" then do
  ac = "          SID is missing."
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
If sys_switch = "Y" then do
  ac = "          SYS is missing."
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
If detail_switch = "Y" then do
  ac = "          SYS(NODETAIL)"
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
If interval_switch = "Y" then do
  ac = "          SYS(NOINTERVAL)"
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
Call blank_line
modify = "YES"
pdierror = 8
If pdiname <> " " then,
  Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
return_code = 0
Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
  "MEMBER("pdiname")"
If return_code > 4 then do
  Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  end
Return
 
 
AAMV0371_PROCESS:
/* Begin process on AAMV0371 for BUFUSEWARN */
return_code = 0
"FIND 'BUFUSEWARN(' FIRST"
If return_code <> 0 then do
  x4 = "BUFUSEWARN is missing."
  Say pgmname vmember "does not specify BUFUSEWARN, default of",
    "BUFUSEWARN(25) will be used."
  buw_percent = "25"
  end
Else do
  "(ROW) = LINENUM .ZCSR"
  "(DATA) = LINE" row
  parse var data . "BUFUSEWARN(" buw_percent ")" .
  end
If buw_percent < 76 then,
    buw_switch = "N"
Else do
  x4 = "BUFUSEWARN("buw_percent")"
  buw_switch = "Y"
  finding_switch = "Y"
  end
 
If finding_switch = "N" then do
  pdierror = 0
  Address ISPEXEC "VPUT (PDIERROR) ASIS"
  Return
  end
 
If buw_switch = "Y" then do
  ac = "          "x4
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
Return
 
 
AAMV0372_PROCESS:
/* Begin process on AAMV0372 for NOBUFFS */
return_code = 0
"FIND 'NOBUFFS(' FIRST"
If return_code <> 0 then do
  x4 = "NOBUFFS is missing."
  Say pgmname vmember "does not specify NOBUFFS, default of",
    "NOBUFFS(MSG) will be used."
  nobuffs_data = "MSG"
  end
Else do
  "(ROW) = LINENUM .ZCSR"
  "(DATA) = LINE" row
  parse var data . "NOBUFFS(" nobuffs_data ")" .
  end
If nobuffs_data = "HALT" then,
    nobuffs_switch = "N"
Else do
  x4 = "NOBUFFS("nobuffs_data")"
  nobuffs_switch = "Y"
  finding_switch = "Y"
  end
 
 
If finding_switch = "N" then do
  pdierror = 0
  Address ISPEXEC "VPUT (PDIERROR) ASIS"
  Return
  end
 
If nobuffs_switch = "Y" then do
  ac = "          "x4
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
Return
 
 
AAMV0373_PROCESS:
/* Begin process on AAMV0373 for JWT, SWT, and TWT */
return_code = 0
"FIND 'JWT(' FIRST"
If return_code <> 0 then do
  Say pgmname vmember "does not specify JWT, default of",
    "JWT(0010) will be used."
  jwt_switch = "N"
  jwt_time = "0010"
  end
Else do
  "(ROW) = LINENUM .ZCSR"
  "(DATA) = LINE" row
  parse var data . "JWT(" jwt_time ")" .
  end
return_code = 0
"FIND 'SWT(' FIRST"
If return_code <> 0 then do
  Say pgmname vmember "does not specify SWT, default of",
    "SWT("jwt_time") will be used."
  swt_switch = "N"
  swt_time = jwt_time
  end
Else do
  "(ROW) = LINENUM .ZCSR"
  "(DATA) = LINE" row
  parse var data . "SWT(" swt_time ")" .
  end
return_code = 0
"FIND 'TWT(' FIRST"
If return_code <> 0 then do
  Say pgmname vmember "does not specify TWT, default of",
    "TWT("jwt_time") will be used."
  twt_switch = "N"
  twt_time = jwt_time
  end
Else do
  "(ROW) = LINENUM .ZCSR"
  "(DATA) = LINE" row
  parse var data . "TWT(" twt_time ")" .
  end
 
If jwt_time > 0 & jwt_time < 16 & length(jwt_time) = 4 then,
  jwt_switch = "N"
Else do
  jwt_switch = "Y"
  finding_switch = "Y"
  x3 = "JWT("jwt_time")"
  end
 
If swt_time <= jwt_time & length(swt_time) = 4 then,
  swt_switch = "N"
Else do
  swt_switch = "Y"
  finding_switch = "Y"
  x4 = "SWT("swt_time")"
  end
 
If twt_time <= jwt_time & length(twt_time) = 4 then,
  ywt_switch = "N"
Else do
  twt_switch = "Y"
  finding_switch = "Y"
  x5 = "TWT("twt_time")"
  end
 
If finding_switch = "N" then do
  pdierror = 0
  Address ISPEXEC "VPUT (PDIERROR) ASIS"
  Return
  end
 
If jwt_switch = "Y" then do
  ac = "          "x3
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
If swt_switch = "Y" then do
  ac = "          "x4
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
If twt_switch = "Y" then do
  ac = "          "x5
  Call put_it
  pdierror = 8
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC PDIERROR) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
 
Return
 
 
AAMV0380_PROCESS:
return_code = 0
/* Setup field of SMF record numbers to be collected */
smf_nr = "0 6 7 14 15 17 18 24 25 26 30 32 41 42 43 45 47 48 49",
  "52 53 54 55 56 57 58 60 61 62 64 65 66"
 
If acpname = "RACF" then,
  smf_nr = smf_nr "80 81 82 83"
 
If acpname = "TSS" then,
  smf_nr = smf_nr "80 82"
 
If acpname = "ACF2" then,
  smf_nr = smf_nr "82"
 
smf_nr = smf_nr "90 92 102 103 110 118 119 199"
 
If acpname = "ACF2" then,
  smf_nr = smf_nr "230"
 
If acpname = "TSS" then,
  smf_nr = smf_nr "231"
 
smf_nr = smf_nr" "
/* FIND SYS RECORDS */
cnt = 0
Call Obtain_SYS_data
 
 
END_READ:
return_code = 0
sysdata1 = ""
sysdata = sys_data
x = pos("TYPE(",sys_data)
If x = 0 then do
  sys_nr = "0:255,999"
  Say pgmname vmember "does not specify TYPE, default of",
    "TYPE(0:255) will be used."
  end
Else do
  If substr(sys_data,x-1,1) = "(" | substr(sys_data,x-1,1) = "," then,
    type_sw = ""
  Else,
    type_sw = "N"
  x1 = x + 5
  lpsw = ""
  Do x1a = x1 to length(sys_data" ")
    If datatype(substr(sys_data" ",x1a,1)) = "NUM" then,
      sysdata1 = sysdata1||substr(sys_data" ",x1a,1)
    If substr(sys_data" ",x1a,1) = ":" & lpsw = " " then,
      sysdata1 = sysdata1||substr(sys_data" ",x1a,1)
    If substr(sys_data" ",x1a,1) = "(" then do
      If type_sw = " " then do
        Do x1b = length(sysdata1) to 1 by -1 until,
          substr(sysdata1" ",x1b,1) = " "
          end
        sysdata1 = left(sysdata1" ",x1b-1)
        x1a = pos(")",sys_data,x1a) + 1
        end
      Else do
        lpsw = "Y"
        sysdata1 = sysdata1||substr(sys_data" ",x1a,1)
        end
      end
    If substr(sys_data" ",x1a,1) = "," & lpsw = " " then,
      sysdata1 = sysdata1||" "
    If substr(sys_data" ",x1a,1) = ")" & lpsw = " " then,
      x1a = length(sys_data" ")
    If substr(sys_data" ",x1a,1) = ")" & lpsw = "Y" then do
      sysdata1 = sysdata1||substr(sys_data" ",x1a,1)
      lpsw = ""
      end
    If substr(sys_data" ",x1a,1) = "," & lpsw = "Y" then,
      sysdata1 = sysdata1||substr(sys_data" ",x1a,1)
    If substr(sys_data" ",x1a,1) = ":" & lpsw = "Y" then,
      sysdata1 = sysdata1||substr(sys_data" ",x1a,1)
    end
  end
sys_nr = sysdata1" 999 "
x1 = 1
x2 = 1
nr1 = ""
nr2 = ""
nr3 = ""
err_nr = ""
 
 
NR1_LOOP:
return_code = 0
nr1 = word(smf_nr,x1)
if nr1 = "" then,
  SIGNAL NR_LOOP_END
x1 = x1 + 1
 
 
NR2_LOOP:
return_code = 0
nr2 = word(sys_nr,x2)
x2 = x2 + 1
nr3 = ""
Do X = 1 to length(nr2)
  If substr(nr2,x,1) = ":" & pos("(",nr2) = 0 then do
    nr3 = substr(nr2,x+1)
    nr2 = left(nr2,x-1)
    leave
    end
  end
nr2 = strip(nr2,"B")
nr3 = strip(nr3,"B")
If type_sw <> "N" then do
  If nr1 = nr2 then do
    nr1 = ""
    If nr3 = " " then,
      nr2 = ""
    x2 = 1
    SIGNAL NR1_LOOP
    end
  If nr1 > nr2 & nr1 <= nr3 & nr3 <> " " then do
    nr1 = ""
    If nr3 = " " then,
      nr2 = ""
    x2 = 1
    SIGNAL NR1_LOOP
    end
  If nr1 > nr2 then do
    nr2 = ""
    SIGNAL NR2_LOOP
    end
  err_nr = err_nr||nr1||" "
  end
Else do
  If pos(nr1,nr2) = 1 then do
    If pos(nr1"(",sysdata" ") = 0 then do
      err_nr = err_nr||nr1" "
      nr1 = ""
      x2 = 1
      SIGNAL NR1_LOOP
      end
    If nr1 = 92 &,
       pos(nr1"(10,11)",sys_nr" ") = 0 &,
       pos(nr1"(10:11)",sys_nr" ") = 0 &,
       pos(nr1"(10)",sys_nr" ") = 0 &,
       pos(nr1"(11)",sys_nr" ") = 0 then do
      s92 = pos(nr1"(",sys_nr" ")
      e92 = pos(")",sys_nr" ",s92)
      parse var sys_nr . "92(" nra ")" .
      if nra <> "" then,
        nra = "92("nra")"
      err_nr = err_nr||nr2" "
      nr1 = ""
      SIGNAL NR1_LOOP
      end
    end
  parse var nr2 nr2a "(" .
  If nr1 > nr2 & nr1 <= nr3 & nr3 <> " " then do
    err_nr = err_nr||nr1||" "
    nr1 = ""
    x2 = 1
    SIGNAL NR1_LOOP
    end
  If nr1 > nr2 |,
     nr1 > nr2a then do
    nr2 = ""
    SIGNAL NR2_LOOP
    end
  end
x2 = 1
SIGNAL NR1_LOOP
 
 
NR_LOOP_END:
return_code = 0
If err_nr <> " " then do
  ac = "          "err_nr
  If pdiname <> " " then,
    Address ISPEXEC "VPUT (AC) ASIS"
  return_code = 0
  Address ISPEXEC "EDIT DATAID("pdidd") MACRO("cacm040a")",
    "MEMBER("pdiname")"
  If return_code > 4 then do
    Say pgmname "EDIT PDI" pdiname  "RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL ERR_EXIT
    end
  end
Return
 
 
/*******************************************/
/*  SYSCALL SUBROUTINES                    */
/*******************************************/
Obtain_SYS_data:
sys_data        = ""
"EXCLUDE ALL 'SUBSYS('"
return_code = 0
"FIND 'SYS(' FIRST NX"
If return_code = 0 then do
  "(ROW) = LINENUM .ZCSR"
  end
Else do
  sys_switch = "Y"
  detail_switch = "Y"
  interval_switch = "Y"
  finding_switch = "Y"
  sys_data = "SYS(TYPE(0:255),NOINTERVAL,NODETAIL)"
  Say pgmname vmember "does not specify SYS, default of",
    "SYS(TYPE(0:255),NOINTERVAL,NODETAIL) will be used."
  Return
  end
 
do x = row to lastline
  "(DATA) = LINE" x
  data = left(data,71)
  sys_data = sys_data""strip(data,"B")
  if right(sys_data,1) <> "," then leave
  end
Return
 
 
REMOVE_COMMENTS:
"CURSOR = 1 0"
do forever
  return_code = 0
  "FIND '/*'"
  If return_code <> 0 then leave
  "(BCR,BCL) = CURSOR"
  "(DATA) = LINE .ZCSR"
  "FIND '*/' .ZCSR .ZLAST"
  If return_code = 0 then do
    "(ECR,ECL) = CURSOR"
    If bcr < ecr then do
      If bcl = 1 then,
        data = ""
      Else,
        data = left(data,bcl-1)
      "LINE" bcr "= (DATA)"
      Do X = bcr+1 to ecr-1
        "LINE" x "= ' '"
        end
      "(DATA) = LINE" ecr
      data = left(" ",ecl+1)substr(data,ecl+2)
      "LINE" ecr "= (DATA)"
      end
    Else do
      ecl = pos("*/",data)
      If ecl = 0 then,
        ecl = 72
      If bcl = 1 then,
        data = left(" ",ecl+1)substr(data,ecl+2)
      Else,
        data = left(left(data,bcl-1),ecl+1)substr(data,ecl+2)
      "LINE .ZCSR = (DATA)"
      end
    end
  Else do
    If bcl = 1 then,
      data = ""
    Else,
      data = left(data,bcl-1)
    "LINE .ZCSR = (DATA)"
    end
  "CURSOR =" bcr 0
  end
 
 
BLANK_LINE:
ac = " "
return_code = 0
Address ISPEXEC "LMPUT DATAID("temp8") MODE(INVAR) DATALOC(AC)",
  "DATALEN("length(ac)") MEMBER("vmember")"
Return
 
 
PUT_IT:
return_code = 0
Address ISPEXEC "LMPUT DATAID("temp8") MODE(INVAR) DATALOC(AC)",
  "DATALEN("length(ac)") MEMBER("vmember")"
If return_code <> 0 then do
  Say pgmname "LMPUT TEMP8" vmember "RC =" return_code zerrsm
  return_code = return_code + 16
  SIGNAL ERR_EXIT
  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 >= 16 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
 
 
