home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 126
/
af126a.adf
/
Football.lzx
/
football
/
user
/
FlipSchedule.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
4KB
|
125 lines
/* ***********************************************************************
FLIPSCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------
Copyright Mark Naughton 1996
Version Date History
--------------------------------------------------------------------------
1.0 270996 First release.
1.1 121196 Added to Football as a callable component. Amended for
different leagues. Removed messages.
131196 Added checks for files - if not found, exits without
a message.
241196 Now called as an External script. Added info messages.
1.2 050599 Updated to only allow non-scheduled leagues to be
flipped and printed.
**************************************************************************
Procedure
---------
1. Check files exist. Read '.df' file for schedule info.
2. If scheduled, exit with message. Open Learn file and output file.
3. Read from Learn, then flip the home and away teams, reset the scores
to 'not_played' and then write to output file.
4. Close files and end. When finished this file can then be printed off
and it'll make entering data into GAMEPLAY much easier.
************************************************************************** */
ARG league_file
league_file = "Data/" || league_file
version = 1
input_file = '.sflearn'
input2_file = '.df'
output_file = '.sflisting'
not_played = '__ __'
separator = '*'
autosched = "*AUTOSCHD="
autos = 0
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
if open(datafile2,league_file || input2_file,'r') then do
do while ~eof(datafile2)
line = readln(datafile2)
if pos(autosched,line) > 0 then
autos = 1
end
close(datafile2)
end
else do
say
say "ERROR : (FlipSchedule)"
say
say "Cannot read '"league_file || input2_file"' datafile."
exit
end
if autos = 1 then do
say
say "ERROR : (FlipSchedule)"
say
say "This program will only work on schedules created by the"
say "Scheduler program and NOT from a schedule file."
say "See 'ViewScheduleAndResults.rexx' for its equivalent."
say
exit
end
say
say "FlipSchedule For Manual Schedule Files"
say
say "This program will flip the schedule and display all the"
say "alternate fixtures. If a schedule is not known, then it"
say "is 'learnt' using 'Enter Scores'. When the season is halfway"
say "through, this program can be run to print the next half"
say "of the seasons fixtures. A file '"league_file || output_file"'"
say "produced and can then be printed."
say
say "Working..."
say
if open(datafile,league_file || input_file,'r') then do
if open(datafile2,league_file || output_file,'w') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) = 0 then do
home = substr(line,1,30)
away = substr(line,41,30)
line = overlay(away,line,1)
line = overlay(home,line,41)
if pos(not_played,line) = 0 & words(line) > 0 then
line = overlay(not_played,line,32)
end
writeln(datafile2,line)
end
close(datafile2)
say "Schedule has been 'flipped'."
say "The file '"league_file || output_file"' can now be printed."
say
say
end
else do
say
say "ERROR : (FlipSchedule)"
say
say "Cannot open '"league_file || output_file"' for writing."
close(datafile)
exit
end
close(datafile)
end
else do
say
say "ERROR : (FlipSchedule)"
say
say "Cannot open '"league_file || input_file"' for reading."
end
exit