/* REXX */
/* CLS2REXXed by UMLA01S on 2 Apr 2024 at 12:33:57  */
/*trace r?*/
Signal On NoValue
Call On Error
Signal On Failure
Signal On Syntax
Parse source opsys . exec_name .
Address ISREDIT
 
"MACRO"
/*********************************************************************/
/* This edit macro (CATM1002) generates the WHOHAS reports and       */
/* creates the WHOHXXXX member depending on the values in variable   */
/* RESOURCE.  VALUE variable contains the resource to be generated.  */
/*********************************************************************/
/* 10/03/2011 CL Fenton Added ERROR checking.                        */
/* 04/02/2024 CL Fenton Converted script from CLIST to REXX.         */
/*                                                                   */
/*                                                                   */
/*                                                                   */
/*********************************************************************/
pgmname = "CATM1002 04/02/24"
sysprompt = "OFF"                       /* CONTROL NOPROMPT          */
sysflush = "OFF"                        /* CONTROL NOFLUSH           */
sysasis = "ON"                          /* CONTROL ASIS - caps off   */
return_code = 0
maxcc = 0
Address ISPEXEC "CONTROL NONDISPL ENTER"
Address ISPEXEC "CONTROL ERRORS RETURN"
 
/*******************************************/
/* VARIABLES ARE PASSED TO THIS MACRO      */
/* RESOURCE                                */
/* VALUE                                   */
/* CONSLIST                                */
/* COMLIST                                 */
/* SYMLIST                                 */
/* TERMPRO                                 */
/* TERMMSGS                                */
/*******************************************/
 
Address ISPEXEC "VGET (RESOURCE VALUE CONSLIST COMLIST SYMLIST",
  "TERMPRO ACP ACPVER EXAMVER TERMMSGS) ASIS"
 
 
MESSAGE_HOUSEKEEPING:
syssymlist = symlist                    /* CONTROL SYMLIST/NOSYMLIST */
sysconlist = conslist                   /* CONTROL CONLIST/NOCONLIST */
syslist = comlist                       /* CONTROL LIST/NOLIST       */
sysmsg = termmsgs                       /* CONTROL MSG/NOMSG         */
 
"STATS = OFF"
"NUMBER OFF"
line = 1
x = outtrap("out.")
var = strip(substr(resource,1,8),"T")  /* SET RESOURCE CLASS */
syslist = "ON"
return_code = 0
Address TSO "TSS WHOH" var"("value")"
syslist = "OFF"
data = "TSS WHOH" var"("value")"
"LINE_AFTER .ZLAST = (DATA)"
"LINE_AFTER .ZLAST = ""READY"""
Do X = 1 to out.0
  data = out.x
  "LINE_AFTER .ZLAST = (DATA)"
  end
 
 
END_EXIT:
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
zispfrc = 0
Address ISPEXEC "VPUT (ZISPFRC) SHARED"
"SAVE"
"END"
Exit 0
 
 
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
 
 
