home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 126
/
af126a.adf
/
Football.lzx
/
football
/
exec
/
Games.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
7KB
|
200 lines
/* ***********************************************************************
GAMES PROGRAM FOR FOOTBALL REXX SUITE
-------------------------------------------
Copyright Mark Naughton 1996
Version Date History
--------------------------------------------------------------------------
1.0 230996 First release. Finished putting in code to display
fixtures. Started 17/09/96. Added whether its a WIN,
a DRAW or LOST to output. Added error check in case
the selected team was incorrect.
270996 Updated to use new filenames. Improved error messages.
300996 Tidied code slightly. Added error message.
1.1 111196 Updated to use different leagues and to become a
component called by FOOTBALL. Changed to read info
from '*.sflearn' as this data is in the correct order.
Gets team name from argument.
131196 Added checks for files - if not found, exits without
a message.
211196 Updated and tidied the display.
190497 Added title to display.
1.2 150997 Added code to handle dates/weeks from Automatic-
Scheduling. Tidied display and added headings.
151297 Tidied display.
050599 Amended display.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store teams.
2. Search for specified team and if not found, give an error and quit.
3. Open datafile depending whether it was autoscheduled or not.
4. If "Week" or "Date" is found, grab the data and format it for later.
5. Use selected team against either HOME or AWAY team and if a match is
found then display the data.
6. When the file is finished, print the number of matches and exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sflearn'
input3_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 exists(league_file || input3_file) = 0 then exit
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
autos = 1
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)
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 Results in '"league_title"'",78)
say "-------------------------------------------------------------------------------"
say
say "Games Played By: "teams.sel
say " (The selected team's score is always first)"
say
matches = 0
if autos = 1 then do
file_to_open = league_file || input3_file
say "Date/Week Where Opponent Score"
say "----------------------------------------------------------------------"
end
else do
file_to_open = league_file || input2_file
say "Where Opponent Score"
say "----------------------------------------------------------"
end
if open(datafile,file_to_open,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if autos = 1 then do
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
end
else
curr = ''
if pos(separator,line) = 0 then do
if pos(not_played,line) = 0 then do
home_team = strip(substr(line,1,30))
goals_for = substr(line,32,2)
goals_aga = substr(line,37,2)
away_team = strip(substr(line,41,30))
strng = strip(teams.sel)
if strng = home_team then do
if goals_for > goals_aga then
ttemp = 'Home Win'
if goals_for = goals_aga then
ttemp = 'Draw'
if goals_for < goals_aga then
ttemp = 'Lost'
if autos = 1 then
say left(curr,12)"Home "left(away_team,30)" "goals_for" -"goals_aga" "right(ttemp,12)
else
say "Home "left(away_team,30)" "goals_for" -"goals_aga" "right(ttemp,12)
matches = matches + 1
end
if strng = away_team then do
if goals_for > goals_aga then
ttemp = 'Lost'
if goals_for = goals_aga then
ttemp = 'Draw'
if goals_for < goals_aga then
ttemp = 'Away Win'
if autos = 1 then
say left(curr,12)"Away "left(home_team,30)" "goals_aga" -"goals_for" "right(ttemp,12)
else
say "Away "left(home_team,30)" "goals_aga" -"goals_for" "right(ttemp,12)
matches = matches + 1
end
end
end
end
close(datafile)
say
if matches = 0 then
say "No matches yet played."
else
say "Number of matches played: "matches
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say "ERROR : (Games)"
say
say "Cannot read '"league_file || input2_file"' datafile."
exit
end
end
else do
say
say "ERROR : (Games)"
say
say "Incorrect team. '"search_team"' cannot be found in this"
say "league."
exit
end
end
else do
say
say "ERROR : (Games)"
say
say "Cannot read '"league_file || input_file"' datafile."
end
exit