home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 126
/
af126a.adf
/
Football.lzx
/
football
/
user
/
GamesPlayed.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
6KB
|
188 lines
/* ***********************************************************************
GAMES PLAYED PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 050197 First release.
060197 Added check so that it exits if the teams play each
other more than twice.
110197 Forgot to initialise the variable used above. Name
changed from 'GamesToBePlayed' to 'GamesPlayed'.
110197 Now shows all games played by selected team.
170197 Fixed bug where it displayed the team selected
instead of skipping it.
151297 Now shows selected team's score first in Away matches
as well. Tidied display.
210499 Added check for no team specified.
**************************************************************************
Procedure
---------
1. Check files exist. Read Teams.df datafile and store teams.
3. Open Schedule datafile.
4. Use selected team against either HOME or AWAY team and store the score
if a match has been played. Otherwise increment matches_to_play.
5. Close file. Display data then exit...
************************************************************************** */
PARSE ARG league_stuff
version = 1
input_file = '.df'
input2_file = '.sf'
title = '*LEAGUE_NAME='
playeo = '*PLAY_OTHER='
separator = '*'
teams. = '???'
teams2. = '???'
counter = 0
not_played = '__ __'
home. = '???'
away. = '???'
numplay = 2
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 : (GamesPlayed)"
say
say "Cannot view matches played as a team has not been selected."
say
say "This is a 'Set & Run' script. Program aborted."
say
exit
end
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(playeo,line) > 0 then
numplay = delstr(line,1,12)
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)
if numplay > 2 then do
say
say "ERROR : (GamesPlayed)"
say
say "This routine only works when each team play each other twice."
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
i = 0
mtp = 0
if sel > 0 then do
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(separator,line) = 0 then do
home_team = strip(substr(line,1,30))
goals_for = strip(substr(line,32,2))
goals_aga = strip(substr(line,37,2))
away_team = strip(substr(line,41,30))
strng = strip(teams.sel)
if strng = home_team then do
do i=1 to counter
if away_team = teams.i then do
if pos(not_played,line) > 0 then
home.i = '-'
else do
home.i = goals_for || "-" || goals_aga
mtp = mtp + 1
end
end
end
end
if strng = away_team then do
do i=1 to counter
if home_team = teams.i then do
if pos(not_played,line) > 0 then
away.i = '-'
else do
away.i = goals_aga || "-" || goals_for
mtp = mtp + 1
end
end
end
end
end
end
close(datafile)
end
else do
say
say "ERROR : (GamesPlayed)"
say
say "Cannot read '"league_file || input2_file"' datafile."
exit
end
say
say center("Games Played in '"league_title"'",78)
say "-------------------------------------------------------------------------------"
say
say "Team: "teams.sel" (Team's score is ALWAYS FIRST)"
say
say
say " Home Away Team"
say " ---- ---- ----"
do i=1 to counter
if pos(teams.sel,teams.i) = 0 then
say " "left(home.i,7)" "left(away.i,7)" "teams.i
end
say
say " Matches Played: "mtp
say
say "-------------------------------------------------------------------------------"
say
end
else do
say
say "ERROR : (GamesPlayed)"
say
say "Incorrect team. '"search_team"' cannot be found in this"
say "league."
exit
end
end
else do
say
say "ERROR : (GamesPlayed)"
say
say "Cannot read '"league_file || input_file"' datafile."
end
exit