/* REXX */
/* CLS2REXXed by FSOX001 on 28 Feb 2018 at 16:52:04  */
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"               /* EDIT PROCLIB(TCPIP) */
/*********************************************************************/
/* This EDIT MACRO provides the finding details for ITCP0010.        */
/*********************************************************************/
/* 08/05/2004 JL.NELSON ADDED EXIT CODE                              */
/* 08/09/2004 JL.NELSON ADDED comments for PDI checks                */
/* 08/09/2004 JL.NELSON ADDED check for continuation JCL and EOF     */
/* 02/11/2005 JL.NELSON Changed constants to variables before rename */
/* 03/09/2005 JL.NELSON Changed LMMREP to LMMADD/LMMREP to avoid     */
/*            errors.                                                */
/* 06/09/2005 JL.NELSON Pass MAXCC in ZISPFRC variable.              */
/* 07/11/2005 JL.NELSON Drop all comments in JCL.                    */
/* 07/14/2005 JL.NELSON Changed for PROFILE/SYSTCPD not found.       */
/* 07/15/2005 JL.NELSON Fixed numbering on only one error.           */
/* 10/24/2005 JL.NELSON Modified for V511 PDI name changes.          */
/* 03/02/2006 JL.NELSON maxcc=920 RESOLVER_CONFIG multiple           */
/*            delimiters                                             */
/* 03/02/2006 JL.NELSON Changed to correct variable substitution.    */
/* 03/02/2006 JL.NELSON Coded for RESOLVER_CONFIG on multiple lines. */
/* 03/09/2006 JL.NELSON Set/test RCode for every ISPEXEC command.    */
/* 03/20/2006 JL.NELSON Use NRSTR avoid abend 900 if ampersand in    */
/*            data.                                                  */
/* 03/29/2006 JL.NELSON Test for empty member LINENUM Rcode = 4.     */
/* 04/03/2006 JL.NELSON Added TRUNC_DATA routine to drop blanks      */
/*            RC=864.                                                */
/* 04/11/2006 JL.NELSON Added code for SYMDEF variable in JCL.       */
/* 04/12/2006 JL.NELSON Replace & with ? if varible not found.       */
/* 05/09/2006 JL.NELSON Avoid RC 20 on ISREDIT LINE when " or ' in   */
/*            data.                                                  */
/* 05/29/2014 CL.Fenton Chgs made to add DIALOG information for      */
/*            CSFTP, CSTCP, and CSTNT, STS-000653.                   */
/* 03/09/2018 CL.FENTON Converted script from CLIST to REXX.         */
/* 09/25/2018 CL.Fenton Chgs in processing proc member with          */
/*            symbolics that require replacing entry, STS-020789.    */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CACM0011 09/25/18"
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"
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMMSGS                                */
/*******************************************/
return_code = 0
zerrsm = ""
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS PDIDD",
  "TNMBR ACP ) ASIS"
cm11vget = 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 "PDIDD/"pdidd "ACP/"acp "TNMBR/"tnmbr
  return_code = return_code + 16
  SIGNAL  ERR_EXIT
  end
 
If CONSLIST = "ON" | COMLIST = "ON" | SYMLIST = "ON" ,
  then Trace r
 
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         */
/*******************************************/
/* MAIN PROCESS                            */
/*******************************************/
"(MEMBER) = MEMBER"
"(DSNAME) = DATASET"
return_code = 0
"(LASTLINE) = LINENUM .ZLAST"
 
If return_code > 0 then do
  If lastline = 0 then,
    Say pgmname "Empty file RCode =" return_code "DSN="dsname,
      "MEMBER="member zerrsm
  Else
    Say pgmname "LINENUM Error RCode =" return_code "DSN="dsname,
      "MEMBER="member zerrsm
  SIGNAL  ERR_EXIT
  end
 
find_profile = 12
find_systcpd = 12
find_resolver = 12
resolver_systcp = ""
ptdsn = ""
stdsn = ""
a = "*"
"EXCLUDE ALL '//*' 1"
"EXCLUDE ALL '/*' 1"
"EXCLUDE ALL '*' 1"
"DELETE ALL X"
return_code = 0
"(LASTLINE) = LINENUM .ZLAST"
If return_code > 0 then do
  If lastline = 0 then,
    Say pgmname "Empty file RCode =" return_code "DSN="dsname,
      "MEMBER="member zerrsm
  Else
    Say pgmname "LINENUM Error RCode =" return_code "DSN="dsname,
      "MEMBER="member zerrsm
  SIGNAL  ERR_EXIT
  end
 
return_code = 0
row = 1
col = 0
"CHANGE ALL X'50' X'6C'"             /* CHANGE ALL '&' '%'*/
 
 
PRE_LOOP:
do until return_code <> 0
  return_code = 0
  "CURSOR =" row col
  "FIND X'6C'"                          /* FIND '%'*/
  If return_code > 0 then leave
 
  "(ROW,COL) = CURSOR"
  "(DATA) = LINE" row
  scol = col + 1
  endx = length(data)
  ecol = pos(" ",data,col)-1
  If ecol = col then iterate
  If ecol <= 0 then,
    ecol = endx
  parse var data . =(scol) temp =(ecol) .
 
  If pos(",",temp) > 2 then,
    parse var temp temp "," .
  If pos("'",temp) > 2 then,
    parse var temp temp "'" .
  If pos('"',temp) > 2 then,
    parse var temp temp '"' .
  If pos('.',temp) > 2 then,
    parse var temp temp '.' .
  If pos('%',temp) > 2 then,
    parse var temp temp '%' .
  If pos("(",temp) > 2 then,
    parse var temp temp '(' .
  If pos(")",temp) > 2 then,
    parse var temp temp ')' .
  ecol = scol + length(temp)
  If temp <> " " then do
    name = temp
    Say pgmname "Variable" name "found in JCL."
    If substr(data,ecol,1) = "." then,
      ecol = ecol+1
    return_code = 0
    "FIND FIRST ' "name"='"
    If return_code <> 0 then do
      return_code = 0
      "FIND FIRST '"name"='"
      end
    If return_code = 0 then do
      "(ROW1,COL1) = CURSOR"
      If row1 >= row then,
        return_code = 4
      end
    If return_code <> 0 & length(name) < 9 then do
      return_code = 0
      save_maxcc = maxcc
      name2 = mvsvar("symdef",name)
      maxcc = save_maxcc
      If return_code = 0 & name2 <> " " then do
        Call NAME2_FOUND
        iterate
        end
      Else
        return_code = 4
      end
    If return_code <> 0 then do
      name2 = "?"name
      Call NAME2_FOUND
      iterate
      end
    "(DATA1) = LINE" row1
    x = pos("=",data1,col1)
    If x = 0 then iterate
    name2 = substr(data1,x+1)
    name2 = strip(name2,"B")
      parse var name2 name2 .
    If left(name2,1) = "'" then do
      parse var name2 . "'" name2 "'" .
      if name2 = "" then,
        name2 = "Null"
      end
    Else do
      parse var name2 name2 .
      If pos(",",name2) > 0 then do
        parse var name2 name2 "," .
        end
      end
    Call NAME2_FOUND
    end
  "LINE" row "= (DATA)"
  end
 
 
NEXT_1:
return_code = 0
"FIND FIRST '//PROFILE ' 1 10"
find_profile = return_code
b = 0
if find_profile = 0 then,
  "(ROW,COL) = CURSOR"
 
 
PROFILE_CHK:
do row = row to lastline
  If find_profile <> 0 then,
    leave
  "(DATA) = LINE" row
  If left(data,3) <> "// " &,
     left(data,10) <> "//PROFILE " then,
    leave
/*  SIGNAL  PROFILE_CHK*/
  return_code = 0
  a = pos("DSN=",data)
  If a > 0 then,
    a = a+4
  Else do
    a = pos("DSNAME=",data)
    If a > 0 then,
      a = a+7
    end
 
  If a > 1 then,
    b = pos(",",data,a)
  If a > 1 & a > b then,
    b = pos(" ",data,a)
  If a > 1 & a < b then do
    parse var data . =(a) ptdsn =(b) .
    leave
    end
  end
 
 
PROFILE_CHK_END:
return_code = 0
If tnmbr = member then,
  SIGNAL  ERR_EXIT
 
If ptdsn <> " " then,
  stigtxt1 = "The PROFILE DD statement does specify the Profile",
    "configuration file." ptdsn
Else do
  stigtxt1 = "The PROFILE DD statement does not specify the",
    "Profile configuration file."
  find_profile = 8
  end
 
return_code = 0
"FIND FIRST '//SYSTCPD ' 1 10"
find_systcpd = return_code
b = 0
If find_systcpd <> 0 then,
  SIGNAL  SYSTCPD_CHK_END
"(ROW,COL) = CURSOR"
 
 
SYSTCPD_CHK:
return_code = 0
do row = row to lastline
  If find_systcpd <> 0 then,
    leave
  "(DATA) = LINE" row
  If left(data,3) <> "// " &,
     left(data,10) <> "//SYSTCPD " then,
    leave
  a = pos("DSN=",data)
  If a > 0 then,
    a = a+4
  Else do
    a = pos("DSNAME=",data)
    If a > 0 then,
      a = a+7
  end
  If a > 1 then,
    b = pos(",",data,a)
  If a > 1 & a > b then,
    b = pos(" ",data,a)
  If a > 1 & a < b then do
    parse var data . =(a) stdsn =(b) .
    leave
    end
  end
 
 
SYSTCPD_CHK_END:
return_code = 0
 
If stdsn <> " " then,
  stigtxt2 = "The SYSTCPD DD statement does specify the Data",
    "configuration file." stdsn
Else do
  stigtxt2 = "The SYSTCPD DD statement does not specify the Data",
    "configuration file."
  find_systcpd = 8
  end
 
return_code = 0
"FIND FIRST 'RESOLVER_CONFIG'"
find_resolver = return_code
return_code = 0
 
If find_resolver = 0 then do
  "(ROW,COL) = CURSOR"
  "(DATA) = LINE" row
  stigtxt3 = "The RESOLVER_CONFIG variable is defined."
  end
Else,
  stigtxt3 = "The RESOLVER_CONFIG variable is not defined."
 
If find_systcpd  > 0 |  find_resolver > 0 then,
  SIGNAL  END_EDIT
res_data = data
 
/* Check for continuation of parameters  */
sctr = pos(" ",data,col)
If sctr > 0 then do
  If substr(data,sctr-1,1) = "," then do
    res_data = left(data,sctr-2)
    row2 = row + 1
 
 
NEXT_ROW2:
    do row2 = row2 to lastline
      "(DATA) = LINE" row2
      If left(data,3) <> "//" then,
        leave
      data = substr(data,4)
      If data = " " then,
        iterate
      data = strip(data,"B")
      res_data = res_data" "data
      end
    end
  end
 
 
RESOLVER_CONCAT_END:
return_code = 0
If pos(stdsn,res_data,col) > 0 then do
  resolver_systcp = ""
  stigtxt4 = "The RESOLVER_CONFIG variable is set to the same",
    "file name specified on the SYSTCPD DD statement."
  SIGNAL  END_EDIT
  end
 
tstv = substr(res_data,col-1,1)
end_resolve = pos(tstv,res_data,col)-1
 
If end_resolve < col then,
  end_resolve = pos(" ",res_data,col)-1
 
If end_resolve < col then,
  end_resolve = length(res_data)
 
/*resolver_systcp = substrc(col,end_resolve,res_data)*/
parse var res_data . (tstv) resolver_systcp (tstv) .
stigtxt4 = "The RESOLVER_CONFIG variable is not set to the same",
  "file name specified on the SYSTCPD DD statement. ",
  resolver_systcp
 
 
END_EDIT:
return_code = 0
ztcp0010_cnt = 0
If find_profile  > 0 then,
  ztcp0010_cnt = ztcp0010_cnt + 1
If find_systcpd  > 0 then,
  ztcp0010_cnt = ztcp0010_cnt + 1
If find_resolver > 0 then,
  ztcp0010_cnt = ztcp0010_cnt + 1
If resolver_systcp <> " " then,
  ztcp0010_cnt = ztcp0010_cnt + 1
 
If ztcp0010_cnt > 0 then do
  ac = "The JCL for the TCPIP started task is coded improperly."
  return_code = 0
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  ac = " "
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  If return_code <> 0 then do
    Say pgmname "LMPUT PDI ITCP0010  RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL  ERR_EXIT
    end
  a = 1
  If ztcp0010_cnt > 1 then
    pd = a") "
  Else,
    pd = ""
  end
Else do
  ac = "Not a Finding"
  return_code = 0
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  ac = " "
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  ac = 1") "stigtxt1
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
    ac = 2") "stigtxt2
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
    ac = 3") "stigtxt3
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
    ac = 4") "stigtxt4
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  If return_code <> 0 then do
    Say pgmname "LMPUT PDI ITCP0010  RC =" return_code zerrsm
    return_code = return_code + 16
    SIGNAL  ERR_EXIT
    end
  end
 
If find_profile > 0 then do
  ac = pd"The PROFILE DD statement does not specify the Profile config
     configuration file."
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  a = a + 1
  If ztcp0010_cnt > 1 then,
    pd = a") "
  end
 
If find_systcpd > 0 then do
  ac = pd"The SYSTCPD DD statement does not specify the Data",
    "configuration file."
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  a = a + 1
  If ztcp0010_cnt > 1 then,
    pd = a") "
  end
 
If find_resolver > 0 then do
  ac = pd"The RESOLVER_CONFIG variable is not defined."
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  a = a + 1
  If ztcp0010_cnt > 1 then,
    pd = a") "
  end
 
If resolver_systcp <> " " then do
  ac = pd"The RESOLVER_CONFIG variable is not set to the same",
    "file name specified on the SYSTCPD DD statement."
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  ac = " "
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  ac = "     "resolver_systcp
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  ac = "     //SYSTCPD DD DSN="stdsn
  Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
    "DATALEN("length(ac)") MEMBER(ITCP0010)"
  a = a + 1
  If ztcp0010_cnt > 1 then,
    pd = a") "
  end
Call ztcp0010_add
 
 
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
cm011rc = return_code
Address ISPEXEC "VPUT (PTDSN STDSN CM11VGET CM011RC) ASIS"
"END"
Exit (0)
 
 
/*******************************************/
/*  SYSCALL SUBROUTINES                    */
/*******************************************/
 
 
NAME2_FOUND:
Say pgmname "Variable" name "replaced with" name2
If name2 = "Null" then,
  name2 = ""
data = strip(left(data,col-1)name2""substr(data,ecol),"T")
/*data = left(data,length(data)-8)*/
"LINE" row "= (DATA)"
return
 
 
ZTCP0010_ADD:
return_code = 0
mbr = "ITCP0010"
Address ISPEXEC "LMMADD DATAID("pdidd") MEMBER("mbr")"
If return_code = 4 then do
  return_code = 0
  Address ISPEXEC "LMMREP DATAID("pdidd") MEMBER("mbr")"
  If return_code <> 0 then do
    Say pgmname "LMMREP_PDIDD_RCODE =" return_code mbr zerrsm
    end
  end
Else do
  If return_code <> 0 then,
    Say pgmname "LMMADD_PDIDD_RCODE =" return_code mbr zerrsm
  end
return_code = 0
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
 
 
