System REXX - list all address space with status - parm

Sample
System REXX

Beispiel:                                 

/* REXX MYREXN2 Copyright YCOS Yves Colliard Software 2008-2009 */
/* TRACE ?R  */
  /* einschalten des interaktiven Trace Modus */
  /* */
/* MUST BE COPIED TO SYS1.SAXREXEC                                */
what=strip(arg(1))
if what="" then what="NSW"
cmd = "D A,A"
parse source . . myrx .
pref = "Y-Y-Y" myrx
time = 10  /* wait max 10 seconds */
yrc  = AXRCMD(cmd,rsp.,time)
as   = 0
ast.0=0
fnd  = 0
if yrc=0 then do
  do i=1 to rsp.0
    parse var rsp.i t1 "A=" asid "PER="
    if asid<>"" then do
      if ast.as<>"AST."as then do
        as=as+1
      end
      if pos(" "what" ",t1)>0 then do
        fnd=fnd+1
        parse var t1 ast.as .
        wuid.as=""
        usri.as=""
        srvc.as=""
      end
    end
    else do
      parse var rsp.i "WUID=" wuid "USERID=" usri .
      if wuid<>"" then do
        wuid.as=wuid
        if usri<>"" then do
          usri.as=usri
        end
      end
      else do
        parse var rsp.i "SCL=" srvc .
        if srvc<>"" then do
          srvc.as=srvc
        end
      end
    end
  end
  if fnd=0 then do
    lin="NO ADDRESS SPACES FOUND AS" what
    yrc = AXRWTO(pref lin)
  end
  else do
    lin="ADDRSPAC JOBNUM   USERID   SRVCLASS"
    ml_id="FIRSTLINE"
    yrc = AXRMLWTO(pref lin,'ml_id',"L")
    do i=1 to as
      if ast.i<>"AST."i then do
        if left(strip(wuid),i,3)="TSU" then usri.i=ast.i
        lin=left(strip(ast.i),8),
            left(strip(wuid.i),8),
            left(strip(usri.i),8),
            left(strip(srvc.i),8)
        yrc = AXRMLWTO(pref lin,'ml_id',"D")
      end
    end
    lin="FOUND="fnd
    yrc = AXRMLWTO(pref lin,'ml_id',"DE")
  end
end
else do
  lin="ERROR:" yrc
  yrc = AXRWTO(pref lin)
end