YCOSAREX - this rexx will split itself if you call it!

REXX Tool

Beispiel:                                 

/* REXX YCOSAREX Copyright YCOS Yves Colliard Software 1990-2009 */
/* MVS Version 21.03.2009 - V6                           */
/*-------------------------------------------------------*/
/*  the different members have to be separated by        */
/*    8 $ signs    the name of the member  8 $ signs     */
/*  please change dsout to your conventions              */
/*         if the dataset does not exist it will be      */
/*         allocated as a po                             */
/*         dsout must be fully qualified without quotes! */
/*  USE procedure YCOS to add the Output PO to SYSEXEC!  */
/*-------------------------------------------------------*/
  /* */
/* TRACE ?R  */
  /* einschalten des interaktiven Trace Modus */
  /* */
  /* Give Output Dataset Name (PO) fully qualified and without Quote */
  /* Give Output Dataset Name (PO) fully qualified and without Quote */
  /* Give Output Dataset Name (PO) fully qualified and without Quote */
  /*      Default userid.YCOS.REXX!!!                                */
dsout = "DATA.SET.OUTPUT"                /* <--------- */
dsout = "YVES.YCOS.ALLREXXO"             /* <--------- */
dsout = SYSVAR(SYSUID)".YCOS.REXX"
  /* and run this rexx                                               */
  /*     TSO EX 'your.data.set(YCOSAREX)'                            */
/* */
if sysdsn("'"dsout"'")<>"OK" then do
  x=msg('OFF')
  address tso "free fi(outfile)"
  x=msg('ON')
  address tso "alloc fi(outfile) da('"dsout"') space(30 15) dir(44)",
              "lrecl(80) recfm(f b) tra"
  if rc<>0 then do
    say "Please prealloc" dsout "dataset using following parameter:",
        "SPACE=(TRK(30,15),44),LRECL=80,RECFM=FB"
    exit
  end
end
x=msg('OFF')
address tso "free fi(outfile)"
x=msg('ON')
/* */
Address ISPEXEC "LMINIT"   "DATAID(YCOSRXID)",
                           "DATASET('&dsout')"
if rc>0 then do
  say "Problem with LMINIT - RC:" rc "- Contact YCOS"
  exit
end
/* */
resp  = outtrap(errycos.,"*","NOCONCAT")
/* */
recog1 = "$$$$"
recog1 = "/*$$$$"recog1
recog2 = "$$$$*/"
recog2 = "$$$$"recog2
lastmem=""
/* */
line.1= recog1 "SPLITMBR" recog2
numl  = SOURCELINE()
/* */
/* */
totfiles = 0
totlines = 0
curlines = 0
totinput = 0
/* */
call yspl
/* */
do i=1 to numl
   line.1=sourceline(i)      /* get line */
   if left(line.1,6)='yjcl="' & substr(line.1,67)='"' then do
     line.1=substr(line.1,7,60)
   end
   totinput = totinput + 1
   call yspl
   /* */
end
/* */
if totfiles <> 0 then do
   address tso "execio 0 diskw outfile (finis"
   address tso "free fi(outfile)"
   address ISPEXEC,
           "LMMSTATS" "DATAID(&YCOSRXID)",
                      "MEMBER("lastmem")",
                      "USER(YCOSREX)",
                      "INITSIZE(&curlines)",
                      "CURSIZE(&curlines)",
                      "CREATED("date("O")")",
                      "MODDATE("date("O")")",
                      "MODTIME("left(time(),5)")"
   address ISPEXEC "LMFREE"   "DATAID(&YCOSRXID)"
end
/* */
say totinput "Input lines"
say totfiles "Files created"
say totlines "Lines in files"
/* */
say 'End of YCOS Procedure'
/* */
exit
/* sub routine */
yspl:
   /* */
   parse var line.1 (recog1) mem (recog2) .
   /* */
   if mem = "" then do
      address tso "execio 1 diskw outfile (stem line."
      totlines = totlines + 1
      curlines = curlines + 1
   end
      /* */
   else do
      mem = strip(mem)
      totfiles = totfiles + 1
      if totfiles <> 1 then do
         address tso "execio 0 diskw outfile (finis"
         address tso "free fi(outfile)"
         address ISPEXEC,
                 "LMMSTATS" "DATAID(&YCOSRXID)",
                            "MEMBER("lastmem")",
                            "USER(YCOSREX)",
                            "INITSIZE(&curlines)",
                            "CURSIZE(&curlines)",
                            "CREATED("date("O")")",
                            "MODDATE("date("O")")",
                            "MODTIME("left(time(),5)")"
         curlines = 0
      end
      else do
         address tso "free fi(outfile)"
      end
      lastmem=mem
      /* */
      address tso "free fi(outfile)"
      address tso "alloc fi(outfile) da('"dsout"("mem")') shr"
      if rc <> 0 then do
         say "Error on ALLOC Input File" dsout ", RC =" rc
         do i=1 to errycos.0
            say errycos.i
         end
         exit
      end
   end
return
end
/* */