home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 126
/
af126a.adf
/
Football.lzx
/
football
/
user
/
ViewTeamSchedule.rexx
< prev
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
5KB
|
181 lines
/* ***********************************************************************
VIEW TEAM SCHEDULE PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 150997 First release.
151297 Tidied display.
210499 Added check for no team specified.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store teams.
2. If league has not been autoscheduled then give an error and quit.
3. Search for specified team and if not found, give an error and quit.
4. Open Teams.sf datafile.
5. If "Week" or "Date" is found, grab the data and format it for later.
6. Use selected team against either HOME or AWAY team and if a match that
has yet to be played is found, display the data.
7. When the file is finished, print the number of matches and exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
title = '*LEAGUE_NAME='
autosched = '*AUTOSCHD='
separator = '*'
teams. = '???'
counter = 0
not_played = '__ __'
parse var league_stuff league_file search_team
league_file = "Data/" || league_file
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
if search_team = "" then do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot view schedules as a team has not been selected."
say
say "This is a 'Set & Run' script. Program aborted."
say
exit
end
autos = 0
if open(datafile,league_file || input_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then
league_title = delstr(line,1,13)
if pos(autosched,line) > 0 then do
autofile = delstr(line,1,10)
autos = 1
end
if pos(separator,line) = 0 then do
line = strip(line)
if counter = 0 then do
teams.1 = line
counter = 1
end
else do
counter = counter + 1
teams.counter = line
end
end
end
close(datafile)
end
else do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot open '"league_file||input_file"' for reading."
exit
end
if autos = 0 then do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot view schedules for '"search_team"'."
say
say "This program will only show schedule files that have"
say "created from a schedule definition file such as "
say "'Teams6.schd'. Program aborted."
say
exit
end
sel=-1
search_team = strip(search_team)
do i=1 to counter
if pos(search_team,teams.i) > 0 then
sel = i
end
if sel > 0 then do
say
say center("Display Team Schedule in '"league_title"'",78)
say "-------------------------------------------------------------------------------"
say
say "Created from '"autofile"' schedule defintion file."
say
say
say "Games Played By: "teams.sel
say
say "Date/Week Where? Opponent"
say "----------------------------------------------------"
say
matches = 0
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) > 0 then do
if pos("*Week:",line) > 0 then do
curr = subword(line,2)
end
if pos("*Date:",line) > 0 then do
year = word(line,5)
mnth = word(line,4)
day = word(line,3)
curr = right(day,2,0)||" "||substr(mnth,1,3)||" "||substr(year,3,2)
end
end
if pos(separator,line) = 0 then do
if pos(not_played,line) > 0 then do
home_team = strip(substr(line,1,30))
away_team = strip(substr(line,41,30))
strng = strip(teams.sel)
if strng = home_team then do
say left(curr,12)"Home "left(away_team,30)
matches = matches + 1
end
if strng = away_team then do
say left(curr,12)"Away "left(home_team,30)
matches = matches + 1
end
end
end
end
close(datafile)
say
if matches = 0 then
say "No matches to be played. The season is over..."
else
say "Number of matches to be played: "matches
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say "ERROR : (ViewTeamSchedule)"
say
say "Cannot read '"league_file || input2_file"' datafile."
exit
end
end
else do
say
say "ERROR : (ViewTeamProgress)"
say
say "Incorrect team. '"search_team"' cannot be found in this"
say "league."
end
exit