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

  1. /* ***********************************************************************
  2.  
  3.    VIEW SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
  4.   -----------------------------------------------
  5.                    Copyright  Mark Naughton 1997
  6.  
  7.  
  8. Version    Date     History
  9. --------------------------------------------------------------------------
  10.  1.0       150997   First release.
  11.            151297   Tidied display.
  12.            180499   Amended display, in line with Results.
  13.            250499   And again.
  14.  
  15. **************************************************************************
  16.  
  17. Procedure
  18. ---------
  19.  
  20. 1. Check files exist.
  21. 2. Open '.df' file and get the schedule definition file. Set marker.
  22. 3. If no file specified, then exit, giving an error.
  23. 2. Open file and print all lines without '*' with the exception of
  24.    the league name, weeks and dates which are underlined.
  25. 3. Close file and exit.
  26.  
  27. ************************************************************************** */
  28. ARG league_file
  29.  
  30. version     = 1
  31. league_file = "Data/" || league_file
  32. input_file  = '.sf'
  33. input2_file = '.df'
  34. autosched   = '*AUTOSCHD='
  35. separator   = '*'
  36.  
  37.  
  38. if exists(league_file || input_file) = 0  then exit
  39. if exists(league_file || input2_file) = 0  then exit
  40.  
  41. autos = 0
  42. if open(datafile,league_file || input2_file,'r') then do
  43.    do while ~eof(datafile)
  44.       line = readln(datafile)
  45.       if pos(autosched,line) > 0 then do
  46.          autofile = delstr(line,1,10)
  47.          autos = 1
  48.       end
  49.    end
  50.    close(datafile)
  51. end
  52. else do
  53.    say
  54.    say "ERROR :    (ViewScheduleAndResults)"
  55.    say
  56.    say "Cannot open '"league_file||input2_file"' for reading."
  57.    exit
  58. end
  59.  
  60. if autos = 0 then do
  61.    say
  62.    say "ERROR :    (ViewScheduleAndResults)"
  63.    say
  64.    say "This program will only show schedule files that have"
  65.    say "created from a schedule definition file such as "
  66.    say "'Teams6.schd'. Program aborted."
  67.    say
  68.    exit
  69. end
  70.  
  71. if open(datafile,league_file || input_file,'r') then do
  72.    say
  73.    say center("Display Schedule And Results",78)
  74.    say "-------------------------------------------------------------------------------"
  75.    say
  76.    say "Created from '"autofile"' schedule defintion file."
  77.    say
  78.    do while ~eof(datafile)
  79.       line = readln(datafile)
  80.       if pos(separator,line) = 0 then do
  81.          t1 = right(strip(substr(line,1,30)),30,' ')
  82.          say t1||substr(line,31)
  83.       end
  84.       else do
  85.          if words(line) > 1 then do
  86.             if pos("*Week",line) > 0 then do
  87.                chas = subword(line,2)
  88.                do mm=1 to length(chas)
  89.                   if substr(chas,mm,1) = "0" then
  90.                      chas = overlay(" ",chas,mm,1)
  91.                   else
  92.                      leave
  93.                end
  94.                chas = "Week "strip(chas)
  95.             end
  96.             else
  97.                chas = subword(line,2)
  98.             say chas
  99.             uline = ''
  100.             do i=1 to length(chas)
  101.                uline = insert('-',uline,i,1)
  102.             end
  103.             say strip(uline)
  104.          end
  105.          else
  106.             if words(line) = 1 then
  107.                say
  108.       end
  109.    end
  110.    say "-------------------------------------------------------------------------------"
  111.    close(datafile)
  112. end
  113. else do
  114.    say
  115.    say "ERROR :    (ViewScheduleAndResults)"
  116.    say
  117.    say "Cannot open '"league_file||input_file"' for reading."
  118. end
  119.  
  120. exit