home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Format 126
/
af126a.adf
/
Football.lzx
/
football
/
exec
/
ViewCupCurRound.rexx
< prev
next >
Wrap
OS/2 REXX Batch file
|
1999-05-22
|
4KB
|
158 lines
/* ***********************************************************************
VIEW CURRENT ROUND PROGRAM FOR FOOTBALL REXX SUITE
----------------------------------------------------
Copyright Mark Naughton 1997
Version Date History
--------------------------------------------------------------------------
1.0 011197 First release.
141297 Wasn't working properly. It would pick up all the
results. Changed to use method from 'CupSchedNextRnd'
program.
151297 Added routine to improve on round name. Tidied the
display.
260898 Amended bettername() for 1 or 2 legs.
**************************************************************************
Procedure
---------
1. Check files exist.
2. Open working file and get current round name.
3. Open file and search for the round starting with the current name,
then print out all the matches.
4. Close file and exit.
************************************************************************** */
PARSE ARG league_file
version = 1
league_file = "Data/" || league_file
input_file = '.scf'
input2_file = '.cfrw'
separator = '*'
curr = ''
title = '*CUP_TITLE='
currrondn = '*CUP_CRDN='
roundddef = '*CUP_RDEF='
cuplegs = '*CUP_LEGS='
if exists(league_file || input_file) = 0 then exit
if exists(league_file || input2_file) = 0 then exit
if open(datafile,league_file || input2_file,'r') then do
do while ~eof(datafile)
line = readln(datafile)
if pos(title,line) > 0 then cupname = substr(line,12,35)
if pos(currrondn,line) > 0 then crondn = strip(substr(line,11,30))
if pos(roundddef,line) > 0 then tcrondn = strip(substr(line,11,5))
if pos(cuplegs,line) > 0 then cupleg = strip(substr(line,11,5))
end
close(datafile)
end
else do
say
say "ERROR : (ViewCupCurRound)"
say
say "Unable to open '"league_file || input2_file"' for reading."
exit
end
a = 0
if open(datafile,league_file || input_file,'r') then do
say
say center("Display Current Round of '"trim(cupname)"'",78)
say "-------------------------------------------------------------------------------"
say
do while ~eof(datafile)
line = readln(datafile)
if pos("*Round="strip(tcrondn),line) > 0 then do
a = 1
parse var line "*Round="tn
if pos(" Leg",tn) > 0 then do
k = pos(" Leg",tn)
tempname = "Round : "bettername(substr(tn,1,5),substr(tn,k-1,6))
end
else
tempname = "Round : "bettername(tn,"Blank")
say
say tempname
uline = ''
do i=1 to length(tempname)
uline = insert('-',uline,i,1)
end
say strip(uline)
end
if a = 1 then do
if pos(separator,line) > 0 then
say
else
say line
end
end
say
say "-------------------------------------------------------------------------------"
close(datafile)
end
else do
say
say "ERROR : (ViewCupCurRound)"
say
say "Cannot open '"league_file||input_file"' for reading."
end
exit
/* Routine ----------------------------------------------------------- */
bettername:
parse arg crn,legless
trdn = substr(crn,1,1)
if datatype(trdn,'n') = 1 then do
if pos("Replay",crn) > 0 then
trn = strip(word(crn,1))" Round "strip(word(crn,2))
else do
parse var crn roundno" "extra
trn = strip(crn)" Round "extra
end
end
else do
if pos("Final",crn) > 0 then do
parse var crn . " "extra
if pos("Replay",crn) > 0 then
trn = "Final "extra
else
trn = "Final"
end
if pos("Semi",crn) > 0 then do
parse var crn . " "extra
if pos("Replay",crn) > 0 then
trn = "Semi-Final "extra
else
trn = "Semi-Finals"
end
if pos("Quart",crn) > 0 then do
parse var crn . " "extra
if pos("Replay",crn) > 0 then
trn = "Quarter-Final "extra
else
trn = "Quarter-Finals"
end
if pos("Third",crn) > 0 then do
trn = "Third Place Play-Off"
end
end
if pos("1 Leg",legless) > 0 then
trn = trn||" (1st Leg)"
if pos("2 Legs",legless) > 0 then
trn = trn||" (2nd Leg)"
return trn
/* ------------------------------------------------------------------- */