The following REXX code will list all tasks that are currently running on the mainframe system:
/* REXX */
/* Developed by S. Tresadern */
cvt = c2x(Storage(10,4))
asvt = mvsaddr(cvt 22C 4)
asvtmaxu = x2d(mvsaddr(asvt 204 4))
do i = 0 to asvtmaxu - 1
offset = d2x(x2d(210) + (i * 4))
ascb = mvsaddr(asvt offset 4)
ascbascb = x2c(mvsaddr(ascb 0 4))
if ascbascb = 'ASCB' then do
ascbjbns = mvsaddr(ascb B0 4)
jobname = x2c(mvsaddr(ascbjbns 0 8))
cscb = mvsaddr(ascb 38 4)
procname = x2c(mvsaddr(cscb 20 8))
say jobname procname
end
end
Exit
/**** Subroutine *********************************/
Mvsaddr:
procedure
arg address offset length .
above = 'NO'
if length(address) = 8 then do
topbyte = substr(address,1,2)
if topbyte >= '80' then do
above = 'YES'
address = substr(address,3)
end
end
address = d2x(x2d(address) + x2d(offset))
if above = 'YES' then address = topbyte||address
addr = storage(address,length)
addr = c2x(addr)
return addr
An example of the output of this REXX code is:
DUMPSRV DUMPSRV
XCFAS IEFPROC
GRS
SMSPDSE
CONSOLE
WLM IEFPROC
ANTMAIN IEFPROC
ANTAS000 IEFPROC
DEVMAN IEFPROC
OMVS OMVS
JESXCF IEFPROC
ALLOCAS
SMS IEFPROC
...
...
This REXX code has been developed and contributed by Steve Tresadern.
Be the first to comment