YCOS - Rearrange SYSEXEC

REXX Tool

Beispiel:                                 

/* REXX YCOS Copyright YCOS Yves Colliard Software 1990-2009 */
/* Rearrange SYSEXEC                              */
  /* */
/* First REXX Procedure to get the Data Set       */
/* concanated and searched for REXX Procs         */
  /* */
/* TRACE ?R  */
  /* einschalten des interaktiven Trace Modus */
  /* */
/* Set dataset name */
/* Set dataset name */
/* Set dataset name */
/* Set dataset name */
userda = "'YVES.YCOS.ALLREXXO'"
userda = "'"SYSVAR(SYSUID)".YCOS.REXX'"
upper userda
/* Dataset already exist? */
if listdsi(userda) <> 0 then do
   /* Allocate new dataset */
   address tso "alloc fi(YCOS) da("userda") new space(15 15) cyl",
               "catalog dir(44) dsorg(ps) recfm(f b) lrecl(80)"
   if rc <> 0 then do
      say "Error allocating" userda
      say "Procedure end!"
      address tso "free fi(ycos)"
      exit
   end
   address tso "free fi(ycos)"
end
/* get all messages of LISTA */
x=outtrap(ycos.)
/* List all allocations */
address tso "LISTA ST"
x=outtrap("OFF")  /* Reset message trapping */
anz_dsn=0
alloc_exec=userda
anz_sys=1
say anz_sys strip(userda,,"'") "concat to SYSEXEC"
/* Work the output of LISTA */
/* --DDNAME---DISP--        */
/* SYS1.UADS                */
/*   SYSUADS  KEEP          */
/* SYS1.BRODCAST            */
/*   SYSLBC   KEEP          */
/* YVES.YCOS.CLIST          */
/*   SYSPROC  KEEP          */
/* YVES.HEM.CLIST           */
/*            KEEP          */
/* ...                      */
do i=1 to ycos.0
  select
  when left(ycos.i,2)="--" then do
    nop
  end
  when left(ycos.i,1)<>" " then do
    anz_dsn=anz_dsn+1
    dsn.anz_dsn=strip(ycos.i)
  end
  otherwise
    if substr(ycos.i,3,8)<>"" then do
      lib=strip(substr(ycos.i,3,8))
    end
    if lib="SYSEXEC" & "'"dsn.anz_dsn"'"<>userda then do
      /* Keep all SYSEXEC allocations */
      alloc_exec=alloc_exec "'"dsn.anz_dsn"'"
      anz_sys=anz_sys+1
      say anz_sys dsn.anz_dsn
    end
    /* Keep all DSN/DD - not used here */
    dsn.anz_dsn=dsn.anz_dsn"/"lib
  end
end
/* do not search SYSEXEC */
address tso "executil searchdd(no)"
/* Deallocate SYSEXEC */
address tso "free fi(sysexec)"
/* Reallocate SYSEXEC with User DS on TOP */
address tso "alloc fi(sysexec) da("alloc_exec") shr"
/* Seach again SYSEXEC */
address tso "executil searchdd(yes)"
  /* */