/* REXX */
/* CLS2REXXed by UMLA01S on 18 Jun 2021 at 11:21:30  */
/*Trace ?r*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"               /* CAAM0506 EDIT MACRO */
/*********************************************************************/
/* 03/01/2006 C Stern Created from CAAM0006 for ACF0300.             */
/* 05/31/2006 C Stern Changes per FSO.                               */
/* 06/06/2006 C Stern Changes per FSO to include ZSMSA008 and        */
/*            ZUSSA060.                                              */
/* 07/11/2007 CL Fenton Changes to remove blank line after CLASMAP.  */
/* 06/18/2021 CL Fenton Converted script from CLIST to REXX.         */
/* 06/29/2021 CL Fenton Chgs to remove ACF0300, STS-026845.          */
/* 10/09/2025 CL Fenton Chgs to add new automation for IBM zSecure   */
/*            Suite, SCTASKU0461677.                                 */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CAAM0506 10/09/25"
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
/*******************************************/
/* This EDIT MACRO provides the finding    */
/* details for ACF2 SHOW CLASMAP command   */
/*******************************************/
table = "ZSMSA008 MGMTCLAS MGM ZSMSA008 STORCLAS STR ZUSSA060",
        "FACILITY FAC ZUSSA060 SURROGAT SUR ZUSSA060 UNIXPRIV UNI",
 
old_pdimbr  = ""
return_code = 0
maxcc       = 0
zerrlm      = ""
zerrsm      = ""
am06vge     = 0
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMPRO                                 */
/* TERMMSGS                                */
/*******************************************/
Address ISPEXEC "VGET (CONSLIST COMLIST SYMLIST TERMMSGS",
  "TEMPS PDIDD) ASIS"
If return_code <> 0 then do
  am06vge = return_code
  Say pgmname "VGET RC =" return_code zerrsm
  Say pgmname "CONSLIST/"conslist "COMLIST/"comlist
  Say pgmname "SYMLIST/"symlist "TERMMSGS/"termmsgs "TEMPS/"temps
  Say pgmname "PDIDD/"pdidd
  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         */
sysprompt = "OFF"                       /* CONTROL NOPROMPT          */
sysasis = "ON"                          /* CONTROL ASIS - caps off   */
 
/*******************************************/
/* MAIN PROCESS                            */
/*******************************************/
"(ROW) = LINENUM .ZLAST"
 
a = 0
b = 0
c = 0
ndvarres. = ""
ndvartyp. = ""
nfvarres. = ""
nfvartyp. = ""
varres. = ""
vartyp. = ""
varfnd. = ""
pdimbr  = ""
 
Address ISPEXEC "LMOPEN DATAID("pdidd") OPTION(OUTPUT)"
return_code = 0
"CURSOR = 1 0"
 
 
READRF:
Do X = 1 to words(table) by 3
  return_code = 0
  if pdimbr <> word(table,x) &,
     pdimbr <> "" then do
    call Process_Details
    end
  pdimbr   = word(table,x)
  resclass = word(table,x+1)
  typecode = word(table,x+2)
  "FIND '"resclass" ' 12 FIRST"
  If return_code <> 0 then do
    a = a + 1
    ndvarres.a = resclass
    ndvartyp.a = typecode
    iterate
    end
  "(DATA) = LINE .ZCSR"
  If typecode = substr(data,24,3) then do
    b = b + 1
    nfvarres.b = resclass
    nfvartyp.b = typecode
    End
  Else do
    c = c + 1
    varres.c = resclass
    vartyp.c = typecode
    varfnd.c = substr(data,24,3)
    End
  End
 
 
ENDIT:
return_code = 0
Call Process_Details
return_code = 0
Call Process_CACT0001
 
 
ERR_EXIT:
zispfrc = return_code
Address ISPEXEC "VPUT (ZISPFRC) SHARED"
 
 
ENDITALL:
Address ISPEXEC "VPUT (AM06VGE) ASIS"
"END"
Exit
 
 
/*******************************************/
/*  SYSCALL SUBROUTINES                    */
/*******************************************/
Process_Details:
If a > 0 | c > 0 then Call Process_Finding
Else Call Process_No_Finding
a = 0
b = 0
c = 0
ndvarres. = ""
ndvartyp. = ""
nfvarres. = ""
nfvartyp. = ""
varres. = ""
vartyp. = ""
varfnd. = ""
return
 
 
Process_Finding:
ac = "The following GSO record value(s) is (are) set improperly:"
Call put_it
Call blank_line
ac = "     CLASMAP"
Call put_it
 
If a <> 0 then Do count = 1 to a
  x1 = ndvarres.count
  x2 = ndvartyp.count
  x1 = left(x1,8)
  If x2 = "" then,
    ac = "          "x1 "is not defined."
  else,
    ac = "          "x1 "with RSRCTYPE" x2 "is not defined."
  Call put_it
  end
 
Call blank_line
If c <> 0 then Do count = 1 to c
  x1 = varres.count
  x2 = vartyp.count
  x3 = varfnd.count
  x1 = left(x1,8)
  ac = "          "x1 "found RSRCTYPE" x3", it should be" x2"."
  Call put_it
  end
 
Call add_member
 
return
 
 
Process_No_Finding:
ac = "Not a Finding"
Call put_it
Call blank_line
ac = "     CLASMAP"
Call put_it
Do count = 1 to b
  x1 = nfvarres.count
  x2 = nfvartyp.count
  x1 = left(x1,8)
  ac = "          "x1" RSRCTYPE is" x2"."
  Call put_it
  end
Call blank_line
ac = "All CLASMAP GSO record value(s) is (are) set properly."
Call put_it
Call add_member
Return
 
 
Process_CACT0001:
tabledd = "TABLE"
a = 0
b = 0
c = 0
ndvarres. = ""
ndvartyp. = ""
nfvarres. = ""
nfvartyp. = ""
varres. = ""
vartyp. = ""
varfnd. = ""
pdimbr  = ""
return_code = listdsi(tabledd "FILE")
if return_code > 0 then do
  say pgmname "DDNAME:"tabledd "RC:"return_code "SYSREASON:"sysreason
  say pgmname sysmsglvl1
  SIGNAL ERR_EXIT
  end
dsnmbr = sysdsname"(CACT0001)"
If sysdsn("'"dsnmbr"'") <> "OK" then do
  return_code = 8
  say pgmname dsnmbr "=" sysdsn("'"dsnmbr"'")
  return
  end
Address TSO "Alloc f(test) ds('"dsnmbr"') shr reuse"
Address TSO "Execio * diskr test (finis stem in."
Do x = 1 to in.0
  return_code = 0
  if pdimbr <> substr(in.x,1,8) &,
     pdimbr <> "" then do
    call Process_Details
    end
  pdimbr   = substr(in.x,1,8)
  resclass = substr(in.x,9,8)
  "FIND '"resclass" ' 12 FIRST"
  If return_code <> 0 then do
    a = a + 1
    ndvarres.a = resclass
    iterate
    end
  Else do
    "(DATA) = LINE .ZCSR"
    b = b + 1
    nfvarres.b = resclass
    nfvartyp.b = substr(data,24,3)
    End
  end
Call Process_Details
 
Return
 
 
ADD_MEMBER:
return_code = 0
Address ISPEXEC "LMMADD DATAID("pdidd") MEMBER("pdimbr")"
If return_code = 4 then do
  return_code = 0
  Address ISPEXEC "LMMREP DATAID("pdidd") MEMBER("pdimbr")"
  If return_code <> 0 then do
    Say pgmname "LMMREP_PDI_RCODE =" return_code pdimbr zerrsm
    end
  end
Else do
  If return_code <> 0 then,
    Say pgmname "LMMADD_PDI_RCODE =" return_code pdimbr zerrsm
  end
return
 
 
BLANK_LINE:
ac = " "
Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
  "DATALEN("length(ac)") MEMBER("pdimbr")"
Return
 
 
PUT_IT:
Address ISPEXEC "LMPUT DATAID("pdidd") MODE(INVAR) DATALOC(AC)",
  "DATALEN("length(ac)") MEMBER("pdimbr")"
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':' strip(ERRORTEXT(rc))
  say SOURCELINE(sigl)
  end
return
 
 
