home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 126 / af126a.adf / Football.lzx / football / user / Reformat_Schedule.rexx < prev    next >
OS/2 REXX Batch file  |  1999-05-22  |  1KB  |  42 lines

  1. /* */
  2. parse arg filen year1 year2
  3.  
  4. say "This program formats a schedule file from DDMM to DDMMYYYY."
  5. say "Working..."
  6.  
  7. filen = strip(filen)
  8. year1 = strip(year1)
  9. year2 = strip(year2)
  10.  
  11. if open(datafile,filen".schd",'r') then do
  12.    if open(datafile2,filen".schd2",'w') then do
  13.       do while ~eof(datafile)
  14.          line = readln(datafile)
  15.          if line ~= '' & pos('*',line) = 0 then do
  16.             counter = words(line)
  17.             do i=1 to counter
  18.                sdate = word(line,i)
  19.                mnth  = substr(sdate,3,2)
  20.                if mnth > 7 then
  21.                   sdate = sdate||year1" "
  22.                else do
  23.                   if mnth < 7 & mnth ~= 0 then
  24.                      sdate = sdate||year2" "
  25.                   else
  26.                      sdate = sdate||"0000 "
  27.                end
  28.                writech(datafile2,sdate)
  29.             end
  30.             writeln(datafile2,"")
  31.          end
  32.          else if pos('*',line) > 0 then
  33.                  writeln(datafile2,line)
  34.       end
  35.       close(datafile2)
  36.    end
  37.    close(datafile)
  38. end
  39.  
  40. say "New schedule file is "filen".schd2."
  41. exit
  42.