| $! *****************
$! **** RLS.COM ****
$! *****************
$!
$! ROTISSERIE LEAGUE STATISTICIAN
$!
$! Created by: Don Goguen (FREE::Goguen)
$!
$! THIS COMMAND PROCEDURE WILL PROVIDE FULL SYSTEM SUPPORT FOR A ROTISSERIE
$! LEAGUE STATISTICIAN FOR ONE OR MORE ROTISSERIE BASEBALL LEAGUES.
$!
$ set noverify
$!
$! ===========================
$! INITIALIZE ERROR CONDITIONS
$! ===========================
$!
$ on control_y then goto finished
$ on control_c then goto finished
$ on error then goto show_menu
$ on warning then goto show_menu
$ on severe_error then goto finished
$!
$! ====================================
$! SAVE CONTEXT FOR RESTORING UPON EXIT
$! ====================================
$!
$ wrap = f$getdvi("tt:","tt_wrap")
$ lines_per_page = f$getdvi("tt:","tt_page")
$ nobroad = f$getdvi("tt:","tt_nobrdcst")
$ set term /nowrap /nobroad
$!
$! ========
$! GET YEAR
$! ========
$!
$ time := "''f$time()'"
$ year := 'f$extract(7,4,time)'
$!
$! =================================
$! SHORTEN OUTPUT AND SEARCH SYMBOLS
$! =================================
$!
$ wso := write sys$output
$ sea := search /nolog /nohead /nohigh
$!
$! =========
$! VARIABLES
$! =========
$!
$ If f$trnlnm("RLS$") .eqs. "" then define RLS$ 'f$environment("default")'
$ rls$dir = f$trnlnm("RLS$")
$ rotis$ = f$extract(0,f$length(rls$dir)-1,rls$dir)
$ stats$ = "''rotis$'.STATS]"
$ mode = f$trnlnm("RLS$COMMAND")
$ suppl = 0
$ spring = 90
$ prior = 98
$ lge = ""
$ frz = ""
$ l_frz = ""
$ n_frz = ""
$ pre_yn = "Y"
$ clear = "CLEAR"
$!
$! ============
$! DEFINE VERBS
$! ============
$!
$ vr :== $rls$:vr.exe
$ rsort :== $rls$:alphabetize.exe
$ set command rls$:avail
$!
$! ============================================
$! READ RLS.TXT FOR LEAGUE-SPECIFIC INFORMATION
$! ============================================
$!
$ file = "''rls$dir'rls.txt"
$ open /read fspec 'file
$ read /end=read_error fspec rec
$ gosub skip_comments
$ editor = f$edit(rec,"TRIM")
$ editing := "''editor'"
$ gosub skip_comments
$ menu_size = f$edit(rec,"TRIM")
$ read /end=read_error fspec rec
$ long_window = f$edit(rec,"TRIM")
$ read /end=read_error fspec rec
$ wide_screen = f$edit(rec,"TRIM")
$ gosub skip_comments
$ leagues = f$edit(rec,"TRIM")
$ gosub skip_comments
$ types = f$edit(rec,"TRIM")
$ gosub skip_comments
$ no_teams = f$edit(rec,"TRIM")
$ gosub skip_comments
$ max_keepers = f$edit(rec,"TRIM")
$ gosub skip_comments
$ confs = f$edit(rec,"TRIM")
$ gosub skip_comments
$ roster_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ trans_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ freemove_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ standings_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ delta_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ team_tot_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ owner_stats = f$edit(rec,"TRIM")
$ gosub skip_comments
$ avail_pit_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ avail_bat_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ pos_elig_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ draft_nums = f$edit(rec,"TRIM")
$ gosub skip_comments
$ th1 = f$edit(rec,"TRIM")
$ gosub skip_comments
$ th2 = f$edit(rec,"TRIM")
$ gosub skip_comments
$ dline_day = f$edit(rec,"TRIM")
$ read /end=read_error fspec rec
$ dline_time = f$edit(rec,"TRIM")
$ gosub skip_comments
$ rating_file = f$edit(rec,"TRIM")
$ read /end=read_error fspec rec
$ gosub skip_comments
$ owners_0 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_1 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_2 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_3 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_4 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_5 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_6 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_7 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_8 = f$edit(rec,"TRIM")
$ read /end=no_more fspec rec
$ owners_9 = f$edit(rec,"TRIM")
$NO_MORE:
$ close fspec
$!
$! =======================
$! READ DISTRIBUTION LISTS
$! =======================
$!
$ num = 0
$DIS:
$ ac = ""
$ ow = ""
$ nk = ""
$ y = f$element(num,";",leagues)
$ if y .eqs. ";" then goto params
$ x = f$element(num,";",no_teams)
$ dist = "''rls$dir'''y'.DIS"
$ count = 0
$ open /read fspec 'dist
$ gosub skip_comments
$DIS1:
$ count = count + 1
$ cmp_rec = f$edit(rec,"COMPRESS,TRIM")
$ at = f$element(0," ",cmp_rec)
$ if f$locate("@",at) .lt. f$length(at) then at = """" + at + """"
$ ac = ac + at
$ ow = ow + f$element(2," ",cmp_rec)
$ if f$extract(f$length(ow)-1,1,ow) .eqs. "'" then -
ow = f$extract(0,f$length(ow)-1,ow)
$ if f$extract(f$length(ow)-2,2,ow) .eqs. "'s" then -
ow = f$extract(0,f$length(ow)-2,ow)
$ nk = nk + f$element(3," ",cmp_rec)
$ if f$element(4," ",cmp_rec) .nes. " " then -
nk = nk + " ''f$element(4," ",cmp_rec)'"
$ if f$element(5," ",cmp_rec) .nes. " " then -
nk = nk + " ''f$element(5," ",cmp_rec)'"
$ if count .eq. x then goto dis2
$ ac = ac + ";"
$ ow = ow + ";"
$ nk = nk + ";"
$ read /end=dis2 fspec rec
$ goto dis1
$DIS2:
$ accounts_'num = ac
$ all_owners_'num = "''ow'"
$ all_nicks_'num = "''nk'"
$ close fspec
$ num = num + 1
$ goto dis
$!
$! ====================================================================
$! PROCESS OPTIONAL PARAMETERS: p1 = league acronym; p2 = freeze number
$! ====================================================================
$!
$PARAMS:
$ if p1 .eqs. "" then goto show_menu
$ lge = p1
$ if p2 .nes. ""
$ then
$ frz = p2
$ if f$length(frz) .eq. 1 then frz = "0''frz'"
$ if frz .ne. 0
$ then
$ l_frz = frz - 1
$ if f$length(l_frz) .eq. 1 then l_frz = "0''l_frz'"
$ n_frz = frz + 1
$ if f$length(n_frz) .eq. 1 then n_frz = "0''n_frz'"
$ else
$ l_frz = ""
$ n_frz = ""
$ endif
$ endif
$ goto cl1
$!
$! ==============================================================
$! PROCESSING FOR CHOICES MADE WITHOUT SETTING A LEAGUE OR FREEZE
$! ==============================================================
$!
$NCL:
$ if mode .eqs. "EXPERT"
$ then
$ wso "No current league set ..."
$ else
$ wso "[1;7m[22;30HNo current league set ..."
$ endif
$ wait 00:00:01
$ if mode .nes. "EXPERT" then wso "[22;30H[m[K"
$ goto show_menu
$NCF:
$ if mode .eqs. "EXPERT"
$ then
$ wso "No current freeze set ..."
$ else
$ wso "[1;7m[22;30HNo current freeze set ..."
$ endif
$ wait 00:00:01
$ if mode .nes. "EXPERT" then wso "[22;30H[m[K"
$!
$! ================
$! DISPLAY THE MENU
$! ================
$!
$SHOW_MENU:
$ wso "[m"
$ if frz .ge. spring
$ then
$ values = "DC;DM;DU;DP;NC;SF;SD;SP;RM;RU;RP;RC;GS;GO;GF;" + -
"GR;GP;GT;GA;GZ;CL;CF;PV;PP;MR;MS;MP;EX"
$ exp_vals = "DRAFT {dc,dm,du,dp}; NOTES {nc}; " + -
"STATS {sf,sd,sp};
ROSTERS {rm,ru,rp,rc}; " + -
"GET DATA {gs,go,gf,gr,gp,gt,ga,gz};
" + -
"CURRENT {cl,cf}; POSITIONS {pv,pp}; " + -
"MISCELLANEOUS {mr,ms,mp}; EX"
$ else
$ values = "TM;TN;TP;TR;FM;FP;SF;SD;SP;RM;RU;RP;RC;GS;GO;GF;" + -
"GR;GP;GT;GA;GZ;CL;CF;PV;PP;MR;MS;MP;EX"
$ exp_vals = "TRANSACTIONS {tm,tn,tp,tr}; FREE MOVES {fm,fp}; " + -
"STATS {sf,sd,sp};
ROSTERS {rm,ru,rp,rc}; " + -
"GET DATA {gs,go,gf,gr,gp,gt,ga,gz};
" + -
"CURRENT {cl,cf}; POSITIONS {pv,pp}; " + -
"MISCELLANEOUS {mr,ms,mp}; EX"
$ endif
$ if mode .eqs. "EXPERT" then goto get_choice
$ if clear .eqs. "CLEAR"
$ then
$ wso "[m[2J[H"
$ set term /page='menu_size'
$ set term /width=80
$ endif
$!
$ wso "[01;01H#3[1;7m ROTISSERIE LEAGUE STATISTICIAN [m"
$ wso "[02;01H#4[1;7m ROTISSERIE LEAGUE STATISTICIAN [m"
$!
$ if frz .ge. spring
$ then
$ wso "[04;05H[1mDRAFT:[m "
$ wso "[06;05H[1;7m DC [m Create New Round"
$ wso "[07;05H[1;7m DM [m Modify "
$ wso "[08;05H[1;7m DU [m Update"
$ wso "[09;05H[1;7m DP [m Post "
$!
$ wso "[11;05H[1mNOTES: [m
$ wso "[13;05H[1;7m NC [m Create for"
$ wso "[14;05H new season"
$ else
$ wso "[04;05H[1mTRANSACTIONS:[m"
$ wso "[06;05H[1;7m TM [m Modify "
$ wso "[07;05H[1;7m TN [m Notify Owners"
$ wso "[08;05H[1;7m TP [m Post "
$ wso "[09;05H[1;7m TR [m Reset"
$!
$ wso "[11;05H[1mFREE MOVES:[m
$ wso "[13;05H[1;7m FM [m Modify "
$ wso "[14;05H[1;7m FP [m Post "
$ endif
$!
$ wso "[16;05H[1mSTATS PROCESSING:[m
$ wso "[18;05H[1;7m SF [m Freeze"
$ wso "[19;05H[1;7m SD [m Delta"
$ wso "[20;05H[1;7m SP [m Post & mail"
$!
$ wso "[04;29H[1mROSTERS:[m
$ wso "[06;29H[1;7m RM [m Modify (manual)"
$ wso "[07;29H[1;7m RU [m Update (auto)"
$ wso "[08;29H[1;7m RP [m Post"
$ wso "[09;29H[1;7m RC [m Copy"
$!
$ wso "[11;29H[1mGET DATA:[m
$ wso "[13;29H[1;7m GS [m Standings"
$ wso "[14;29H[1;7m GO [m Owner stats"
$ wso "[15;29H[1;7m GF [m Free agents"
$ wso "[16;29H[1;7m GR [m Roster"
$ wso "[17;29H[1;7m GP [m Player stats"
$ wso "[18;29H[1;7m GT [m Team stats"
$ wso "[19;29H[1;7m GA [m Affiliation"
$ if rating_file .nes. "" then -
wso "[20;29H[1;7m GZ [m player rating"
$!
$ wso "[04;53H[1mCURRENT SETTINGS:[m
$ wso "[06;53H[1;7m CL [m League"
$ wso "[06;67H[1m(''lge')[m"
$ wso "[07;53H[1;7m CF [m Freeze"
$ wso "[07;67H[1m(''frz')[m"
$!
$ wso "[09;53H[1mPOSITION ELIGIBILITY:[m
$ wso "[11;53H[1;7m PV [m Verify"
$ wso "[12;53H[1;7m PP [m Post"
$!
$ wso "[14;53H[1mMISCELLANEOUS:[m
$ wso "[16;53H[1;7m MR [m Refresh screen"
$ wso "[17;53H[1;7m MS [m Spawn to DCL"
$ wso "[18;53H[1;7m MP [m Purge"
$ wso "[20;53H[1;7m EX [m EXit"
$!
$! =====================================================
$! OBTAIN A MENU SELECTION FROM THE USER AND VALIDATE IT
$! =====================================================
$!
$GET_CHOICE:
$ if mode .eqs. "EXPERT"
$ then
$ wso ""
$ wso "League: ''lge'"
$ wso "Freeze: ''frz'"
$ wso ""
$ read /prompt="''exp_vals' > " /end=get_choice sys$command choice
$ choice = f$edit(choice,"UPCASE,TRIM")
$ else
$ read -
/prompt="[22;08H[1mCHOICE > [K[7m [K[22;18H" -
/end=get_choice sys$command choice
$ choice = f$edit(choice,"UPCASE,TRIM")
$ wso "[m"
$ endif
$VALIDATE:
$ num = 0
$LOOP1:
$ y = f$element(num,";",values)
$ if y .eqs. ";"
$ then
$ if mode .eqs. "EXPERT"
$ then
$ wso "Invalid option ..."
$ else
$ wso "[1;7m[22;30HInvalid option ..."
$ endif
$ wait 00:00:01
$ if mode .nes. "EXPERT" then wso "[22;30H[m[K"
$ goto get_choice
$ endif
$ if choice .nes. y then goto skip1
$ goto 'y'
$SKIP1:
$ num = num + 1
$ goto loop1
$!
$! ==================
$! SET CURRENT LEAGUE
$! ==================
$!
$CL:
$ clear = ""
$ lge = ""
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="League > " /end=show_menu sys$command lge
$ lge = f$edit(lge,"UPCASE,TRIM")
$ else
$ wso "[06;67H[K[m"
$ read /prompt="[06;66H> [K" /end=show_menu sys$command lge
$ lge = f$edit(lge,"UPCASE,TRIM")
$ wso "[06;66H [1m(''lge')[m"
$ endif
$CL1:
$ num = 0
$CL2:
$ y = f$element(num,";",leagues)
$ if y .eqs. ";" then goto cl
$ if lge .eqs. y then goto cl3
$ num = num + 1
$ goto cl2
$CL3:
$ lge_num = num
$ lge$ = "''rotis$'.''lge']"
$ del$ = "''rotis$'.''lge'.delta]"
$ if p2 .nes. "" then goto cf1
$ goto show_menu
$!
$! =========================
$! SET CURRENT FREEZE NUMBER
$! =========================
$!
$CF:
$ clear = ""
$ frz = ""
$ if mode .eqs. "EXPERT"
$ then
$ wso ""
$ wso " 0 = supplemental draft"
$ wso " 1 -> 89 = regular season (typically 1-26)"
$ wso "90 -> 97 = spring training stats"
$ wso "98 = last season's stats"
$ wso ""
$ read /prompt="Freeze > " /end=show_menu sys$command frz
$ else
$ wso "[22;25H0: supp; 1-26: in-season; 90-97: spring; 98: last yr"
$ wso "[07;67H[K[m"
$ read /prompt="[07;66H> " /end=show_menu sys$command frz
$ wso "[07;66H [1m(''frz')[m"
$ wso "[22;25H[K"
$ endif
$CF1:
$ if f$type(frz) .nes. "INTEGER" then goto cf
$ if frz .lt. suppl .or. frz .gt. prior then goto cf
$ if f$length(frz) .eq. 1 then frz = "0''frz'"
$ l_frz = frz - 1
$ if f$length(l_frz) .eq. 1 then l_frz = "0''l_frz'"
$ n_frz = frz + 1
$ if f$length(n_frz) .eq. 1 then n_frz = "0''n_frz'"
$ goto show_menu
$!
$! ===============================
$! TRANSACTIONS: FILE MODIFICATION
$! ===============================
$!
$TM:
$ gosub clear_it
$ temp = "''rls$dir'''lge'.trans"
$ assign /user 'f$logical("SYS$COMMAND") sys$input:
$ editing 'temp
$ goto show_menu
$!
$! ====================================
$! TRANSACTIONS: NOTIFICATION OF OWNERS
$! ====================================
$!
$TN:
$ gosub clear_long
$ f1 = "''rls$dir'''lge'.trans"
$ type /page 'f1
$ wso ""
$!
$ send_to = "@rls$:''lge'.dis"
$ read /prompt="To: [A]ll, (P)ending, (O)ther > " /end=tn1 -
sys$command xx
$ xx = f$edit(xx,"UPCASE,TRIM")
$ if xx .eqs. "O" then -
read /prompt="To > " /end=tn1 sys$command send_to
$ if xx .eqs. "P"
$ then
$ define /user league$dis "''rls$dir'''lge'.dis"
$ define /user trans$file "''rls$dir'''lge'.trans"
$ define /user pending$dis "''rls$dir'pending.dis"
$ run rls$:pending_trans
$ send_to = "@rls$:pending.dis"
$ wso ""
$ wso "Transactions will be sent to:"
$ wso ""
$ type rls$:pending.dis
$ wso ""
$ endif
$!
$ ccopy = ""
$ read /prompt="CC: > " /end=tn1 sys$command ccopy
$ wso ""
$!
$ subj = "''lge' transactions: due ''dline_day' at ''dline_time'"
$ read /prompt="Subj: [R]egular, (D)eadline, (F)inal, (O)ther > " -
/end=tn1 sys$command dd
$ dd = f$edit(dd,"UPCASE,TRIM")
$ if dd .eqs. "O" then -
read /prompt="Subj > " /end=tn1 sys$command subj
$ if dd .eqs. "D" then -
subj = "''lge' transactions: due TODAY at 4:00"
$ if dd .eqs. "F" then -
subj = "FINAL ''lge' transactions for freeze ''frz'"
$!
$ if ccopy .eqs. ""
$ then
$ mail /sub="''subj'" 'f1 "''send_to'"
$ else
$ mail /sub="''subj'" 'f1 "''send_to', ''ccopy'"
$ endif
$ wso "Transactions mailed ..."
$ wait 00:00:01
$TN1:
$ if mode .nes. "EXPERT" then set term /page='menu_size'
$ goto show_menu
$!
$! =====================
$! TRANSACTIONS: POSTING
$! =====================
$!
$TP:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ f1 = "''rls$dir'post.temp"
$ open /write temp 'f1
$ write temp "$ notes"
$ write temp "open /noauto ''f$element(lge_num,";",confs)'"
$ write temp "set mod"
$ write temp "''f$element(lge_num,";",trans_nums)'.LAST"
$ gosub del_prev
$ if y_n .nes. "Y" then goto tp1
$ write temp "del"
$ write temp "y"
$TP1:
$ write temp "reply /noed ''rls$dir'''lge'.trans"
$ gosub note_title
$ submit /nonotify /noprint /noidentify 'f1
$ goto get_choice
$!
$! ========================
$! TRANSACTIONS: FILE RESET
$! ========================
$!
$TR:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ f1 = "''rls$dir'''lge'.trans"
$ f2 = "''rls$dir'''lge'.alltrans"
$ assign /user _nla0: sys$error
$ assign /user _nla0: sys$output
$ dir /brief 'f2
$ if $status then goto tr1
$ create 'f2
$TR1:
$ open /read t1 'f1
$ open /append t2 'f2
$ open /write t3 'f1
$ write t2 ""
$ read /end=tr3 t1 rec
$ write t2 rec
$ write t3 rec
$ read /end=tr3 t1 rec
$ write t2 rec
$ date = f$extract(f$length(rec)-5,5,rec)
$TR2:
$ newdate = ""
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="New effective date (old date was ''date') > " -
/end=trz sys$command newdate
$ else
$ read /prompt="[22;30HNew effective date (old date was ''date') > [K[1;7m [22;73H" -
/end=trz sys$command newdate
$ wso "[m[22;30H[K"
$ endif
$ if newdate .eqs. "" then goto tr2
$TRZ:
$ write t3 "''f$extract(0,f$length(rec)-5,rec)'''newdate'"
$ l = 0
$TR3:
$ read /end=tr4 t1 rec
$ write t2 rec
$ write t3 rec
$ l = l + 1
$ if l .lt. 6 then goto tr3
$ owner = ""
$ prev_owner = ""
$ l = 1
$TR4:
$ read /end=tr5 t1 rec
$ if rec .eqs. ""
$ then
$ write t2 ""
$ else
$ if f$extract(0,1,rec) .nes. " "
$ then
$ prev_owner = owner
$ owner = f$extract(0,12,rec)
$ endif
$ if f$extract(f$length(rec)-1,1,rec) .eqs. "*"
$ then
$ write t2 "''f$extract(0,50,rec)'(LATE)"
$ if owner .eqs. prev_owner
$ then
$ write t3 " *''f$extract(13,f$length(rec)-12,rec)'"
$ else
$ if l .eq. 0 then write t3 ""
$ l = 0
$ write t3 "''owner'*''f$extract(13,f$length(rec)-12,rec)'"
$ prev_owner = owner
$ endif
$ else
$ write t2 rec
$ endif
$ endif
$ goto tr4
$TR5:
$ close t1
$ close t2
$ close t3
$ goto get_choice
$!
$! =============================
$! FREE MOVES: FILE MODIFICATION
$! =============================
$!
$FM:
$ gosub clear_it
$ temp = "''rls$dir'''lge'.freemoves"
$ assign /user 'f$logical("SYS$COMMAND") sys$input:
$ editing 'temp
$ goto show_menu
$!
$! ===================
$! FREE MOVES: POSTING
$! ===================
$!
$FP:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ f1 = "''rls$dir'post.temp"
$ open /write temp 'f1
$ write temp "$ notes"
$ write temp "open /noauto ''f$element(lge_num,";",confs)'"
$ write temp "set mod"
$ write temp "''f$element(lge_num,";",freemove_nums)'.LAST"
$ gosub del_prev
$ if y_n .nes. "Y" then goto fp1
$ write temp "del"
$ write temp "y"
$FP1:
$ write temp "reply /noed ''rls$dir'''lge'.freemoves"
$ gosub note_title
$ submit /nonotify /noprint /noidentify 'f1
$ goto get_choice
$!
$! ========================
$! STATS PROCESSING: FREEZE
$! ========================
$!
$SF:
$ gosub clear_it_2
$ pre_yn = "Y"
$ if frz .ge. spring .and. frz .lt. prior then -
read /prompt="First pre-season posting ([Y]/N) > " /end=show_menu -
sys$command pre_yn
$ pre_yn = f$edit(pre_yn,"UPCASE,TRIM")
$ if frz .eq. spring .or. frz .eq. prior
$ then
$ read /prompt="Current freeze is ''frz' -- run for freezes ''frz' and 0?? (Y/[N]) > " -
/end=show_menu sys$command ans
$ else
$ read /prompt="Current freeze is ''frz' -- run for freezes ''frz' and ''l_frz'?? (Y/[N]) > " -
/end=show_menu sys$command ans
$ endif
$ ans = f$edit(ans,"UPCASE,TRIM")
$ if ans .nes. "Y" then goto show_menu
$ wso ""
$ wso "[1mRUNNING WEEKLY STATS:[m"
$ subdir = "''rotis$'.''lge']"
$ define /nolog stats$al "''stats$'"
$ define /nolog stats$nl "''stats$'"
$ define /nolog stats$ini "''stats$'"
$ define /nolog stats$roster 'subdir
$ define /nolog stats$owners 'subdir
$ define /nolog stats$results 'subdir
$ define /nolog stats$log 'subdir
$ define /nolog stats$available 'subdir
$ l_type = f$element(lge_num,";",types)
$ if frz .ge. spring
$ then
$ if frz .eq. spring .or. frz .eq. prior
$ then
$ stats == "$stats$al:stats4.exe ''frz' 0 ''l_type' name=''lge' no_salary no_check"
$ else
$ stats == "$stats$al:stats4.exe ''frz' ''l_frz' ''l_type' name=''lge' no_salary no_check"
$ endif
$ else
$ stats == "$stats$al:stats4.exe ''frz' ''l_frz' ''l_type' name=''lge' no_salary"
$ endif
$ stats
$ wso ""
$ f1 = "stats$log:''lge'_''frz'.log"
$ wso "Searching STATS log file for duplicate player messages . . ."
$ sea 'f1 "already"
$ if mode .nes. "EXPERT" then inquire /nopunc x "Press RETURN to continue ... "
$ goto show_menu
$!
$! =======================
$! STATS PROCESSING: DELTA
$! =======================
$!
$SD:
$ gosub clear_it_2
$ read /prompt="Current freeze is ''frz' -- run for freezes ''frz' and ''l_frz'?? (Y/[N]) > " -
/end=show_menu sys$command ans
$ ans = f$edit(ans,"UPCASE,TRIM")
$ if ans .nes. "Y" then goto show_menu
$ wso ""
$ wso "[1mRUNNING DELTA STATS:[m"
$ subdir = "''rotis$'.''lge'.delta]"
$ x = "''subdir'delta_''l_frz'.*;*"
$ delete 'x /exc=(.standings,.rosters)
$ define /nolog stats$al "''stats$'"
$ define /nolog stats$nl "''stats$'"
$ define /nolog stats$ini "''stats$'"
$ define /nolog stats$roster 'subdir
$ define /nolog stats$owners 'subdir
$ define /nolog stats$results 'subdir
$ define /nolog stats$log 'subdir
$ define /nolog delta$dir 'subdir
$ stats == "$stats$al:stats4.exe ''frz' ''l_frz' ''l_type' name=delta no_avail no_salary"
$ stats 'p3 'p4
$ wso ""
$ f1 = "stats$log:delta_''frz'.log"
$ wso "Searching STATS log file for duplicate player messages . . ."
$ sea 'f1 already
$ if mode .nes. "EXPERT" then inquire /nopunc x "Press RETURN to continue ... "
$ goto show_menu
$!
$! =====================================
$! STATS PROCESSING: POSTING AND MAILING
$! =====================================
$!
$SP:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ if frz .eqs. "" then goto ncf
$ dir1 = "''rotis$'.''lge']"
$ dir2 = "''rotis$'.''lge'.delta]"
$ post1 = "''dir1'post.temp"
$ mail1 = "''dir1'mail.temp"
$ if frz .ge. spring
$ then
$ if mode .eqs."EXPERT"
$ then
$ read /prompt="After what draft round > " /end=show_menu -
sys$command round
$ else
$ read /prompt="[22;30HAfter what draft round > [K[1;7m [22;56H" -
/end=get_choice sys$command round
$ wso "[m[22;30H[K"
$ endif
$ endif
$ if mode .eqs. "EXPERT"
$ then
$ wso "Creating batch files for posting and mailing ..."
$ else
$ wso "[22;30HCreating batch files for posting and mailing..."
$ endif
$ open /write tmpfile 'post1
$ open /write mailfile 'mail1
$ num_tms = f$element('lge_num,";",no_teams)
$ write tmpfile "$ set default ''dir1'"
$ write tmpfile "$ notes"
$ x = f$element('lge_num,";",confs)
$ write tmpfile "open /noauto ''x'"
$ write tmpfile "set mod"
$ if frz .ge. spring then goto sp2
$ x = f$element('lge_num,";",owner_stats)
$ write tmpfile "''x'.L"
$ if frz .eq. 1 then goto sp2
$ count = 0
$SP1:
$ count = count + 1
$ write tmpfile "del"
$ write tmpfile "Y"
$ if count .lt. num_tms then goto sp1
$SP2:
$ o = all_owners_'lge_num
$ n = all_nicks_'lge_num
$ t = accounts_'lge_num
$ count = 0
$SP3:
$ o1 = f$element('count,";",o)
$ n1 = f$element('count,";",n)
$ t1 = f$element('count,";",t)
$ count = count + 1
$ if frz .ge. spring then goto sp4
$ write tmpfile "reply /noed ''dir1'''lge'_''frz'.''o1'"
$ write tmpfile "''n1' -- week ''frz'"
$ write tmpfile "Y"
$SP4:
$ f1 = "''dir1'''lge'_''frz'.''o1'"
$ f2 = "''dir2'delta_''frz'.''o1'"
$ if frz .ge. spring
$ then
$ write mailfile "$ mail /noself /sub=""''lge': after round ''round' - ''n1'"" ''f1' "+t1
$ else
$ write mailfile "$ mail /noself /sub=""''lge': freeze ''frz' - ''n1'"" ''f1' "+t1
$ write mailfile "$ mail /noself /sub=""''lge': freeze ''frz' delta - ''n1'"" ''f2' "+t1
$ endif
$ if count .lt. num_tms then goto sp3
$ x = f$element('lge_num,";",standings_nums)
$ write tmpfile "''x'.L"
$ if frz .ge. spring .and. pre_yn .eqs. "N"
$ then
$ write tmpfile "del"
$ write tmpfile "Y"
$ endif
$ write tmpfile "reply /noedit ''dir1'''lge'_''frz'.standings"
$ if frz .eq. suppl then write tmpfile "after supplemental draft"
$ if frz .gt. suppl .and. -
frz .lt. spring then write tmpfile "freeze ''frz'"
$ if frz .ge. spring then write tmpfile "after round ''round'"
$ write tmpfile "Y"
$ if frz .ge. spring then goto sp5
$ x = f$element('lge_num,";",delta_nums)
$ write tmpfile "''x'"
$ write tmpfile "reply /noed ''dir2'delta_''frz'.standings"
$ write tmpfile "freeze ''frz'"
$ write tmpfile "Y"
$ x = f$element('lge_num,";",team_tot_nums)
$ write tmpfile "''x'"
$ write tmpfile "reply /noedit ''dir1'''lge'_''frz'.totals"
$ write tmpfile "freeze ''frz'"
$ write tmpfile "Y"
$SP5:
$ x = f$element('lge_num,";",avail_pit_nums)
$ write tmpfile "''x'.l"
$ if frz .eq. 1 then goto sp6
$ if frz .ge. spring .and. pre_yn .eqs. "Y" then goto sp6
$ write tmpfile "del"
$ write tmpfile "y"
$SP6:
$ write tmpfile "reply /noedit ''dir1'''lge'_''frz'.pit_avail"
$ if frz .ge. spring
$ then
$ write tmpfile "after round ''round'"
$ else
$ write tmpfile "after freeze ''frz'"
$ endif
$ write tmpfile "Y"
$ x = f$element('lge_num,";",avail_bat_nums)
$ write tmpfile "''x'.l"
$ if frz .eq. 1 then goto sp7
$ if frz .ge. spring .and. pre_yn .eqs. "Y" then goto sp7
$ write tmpfile "del"
$ write tmpfile "y"
$SP7:
$ write tmpfile "reply /noedit ''dir1'''lge'_''frz'.bat_avail"
$ if frz .ge. spring
$ then
$ write tmpfile "after round ''round'"
$ else
$ write tmpfile "after freeze ''frz'"
$ endif
$ write tmpfile "Y"
$ write tmpfile "EXIT"
$ close tmpfile
$ close mailfile
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="Submit batch file to post stats (Y/[N]) > " -
/end=show_menu sys$command x
$ else
$ read /prompt="[22;30HSubmit batch file to [1mpost[m stats (Y/[N]) > [K[1;7m [22;73H" -
/end=get_choice sys$command x
$ wso "[m[22;30H[K"
$ endif
$ x = f$edit(x,"UPCASE,TRIM")
$ if x .eqs. "Y" then submit /notify /noprint /noidentify 'post1
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="Submit batch file to mail stats (Y/[N]) > " -
/end=show_menu sys$command x
$ else
$ read /prompt="[22;30HSubmit batch file to [1mmail[m stats (Y/[N]) > [K[1;7m [22;73H"-
/end=get_choice sys$command x
$ wso "[m[22;30H[K"
$ endif
$ x = f$edit(x,"UPCASE,TRIM")
$ if x .eqs. "Y" then submit /notify /noprint /noidentify 'mail1
$ if mode .nes. "EXPERT" then wso "[m[22;30H[K"
$ goto get_choice
$!
$! ==============================
$! ROSTERS: MODIFICATION (manual)
$! ==============================
$!
$RM:
$ gosub clear_it
$ games = 3
$ if frz .ge. spring then games = 20
$ temp = "''rls$dir'''lge'.rosters"
$ assign /user 'f$logical("SYS$COMMAND") sys$input:
$ editing 'temp
$ inquire /nopunc y_n "Validate positions (Y/[N]) > "
$ y_n = f$edit(y_n,"UPCASE,TRIM")
$ if y_n .eqs. "Y"
$ then
$ l_type = f$element(lge_num,";",types)
$ temp = "''rls$dir'''lge'.rosters"
$ if l_type .eqs. "AL"
$ then
$ vr 'temp rls$:vr.dat 'games rls$:vr.last 20
$ else
$ vr 'temp rls$:vr.dat 'games rls$:vr.last 20 NL
$ endif
$ inquire /nopunc x "Press RETURN to continue "
$ endif
$ goto show_menu
$!
$! ===========================
$! ROSTERS: UPDATE (automatic)
$! ===========================
$!
$RU:
$ gosub clear_it
$ games = 3
$ if frz .ge. spring then games = 20
$ wso "Do you want to delete the latest version of your roster file?"
$ wso ""
$ wso "NOTE: You'd only want to do this if you are re-running this"
$ wso " option for the same transaction freeze, after correcting errors..."
$ wso ""
$ read /prompt="(Y/[N]) > " /end=show_menu sys$command xx
$ xx = f$edit(xx,"UPCASE,TRIM")
$ if xx .eqs. "Y" then delete 'lge.rosters;
$ wso ""
$ wso "Updating ''lge'.ROSTERS from ''lge'.TRANS ..."
$ log = "''rls$dir'update_roster.log"
$ define /nolog roster$file "''rls$dir'''lge'.rosters"
$ define /nolog trans$file "''rls$dir'''lge'.trans"
$ define /nolog new_roster$file "''rls$dir'''lge'.rosters"
$ run rls$:update_roster
$ wso "Displaying Update Roster LOG (ran okay if no errors appear):"
$ wait 00:00:02
$ type /page 'log
$ inquire /nopunc y_n "Alphabetize rosters (Y/[N]) > "
$ y_n = f$edit(y_n,"UPCASE,TRIM")
$ if y_n .eqs. "Y" then rsort <new_roster$file >new_roster$file -noowner
$ inquire /nopunc y_n "Validate positions (Y/[N]) > "
$ y_n = f$edit(y_n,"UPCASE,TRIM")
$ if y_n .eqs. "Y"
$ then
$ l_type = f$element(lge_num,";",types)
$ temp = "''rls$dir'''lge'.rosters"
$ if l_type .eqs. "AL"
$ then
$ vr 'temp rls$:vr.dat 'games rls$:vr.last 20
$ else
$ vr 'temp rls$:vr.dat 'games rls$:vr.last 20 NL
$ endif
$ inquire /nopunc x "Press RETURN to continue "
$ endif
$ goto show_menu
$!
$! =============
$! ROSTERS: POST
$! =============
$!
$RP:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ f1 = "''rls$dir'post.temp"
$ open /write temp 'f1
$ write temp "$ notes"
$ write temp "open /noauto ''f$element(lge_num,";",confs)'"
$ write temp "set mod"
$ write temp "''f$element(lge_num,";",roster_nums)'.LAST"
$ gosub del_prev
$ if y_n .nes. "Y" then goto rp1
$ write temp "del"
$ write temp "y"
$RP1:
$ write temp "reply /noed ''rls$dir'''lge'.rosters"
$ gosub note_title
$ submit /nonotify /noprint /noidentify 'f1
$ goto get_choice
$!
$! =======================================
$! ROSTERS: COPY (TO STATS SUBDIRECTORIES)
$! =======================================
$!
$RC:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ if frz .eqs. "" then goto ncf
$ if mode .eqs. "EXPERT"
$ then
$ if frz .ge. spring
$ then
$ read sys$command x /end=show_menu -
/prompt="Copy to appropriate *_''frz'.ROSTERS (Y/[N]) > "
$ else
$ read sys$command x /end=get_choice -
/prompt="Copy to appropriate *_''n_frz'.ROSTERS (Y/[N]) > "
$ endif
$ else
$ if frz .ge. spring
$ then
$ read /prompt="[22;30HCopy to appropriate *_''frz'.ROSTERS (Y/[N]) > [K[1;7m [22;74H" -
/end=show_menu sys$command x
$ wso "[m[22;30H[K"
$ else
$ read /prompt="[22;30HCopy to appropriate *_''n_frz'.ROSTERS (Y/[N]) > [K[1;7m [22;74H" -
/end=get_choice sys$command x
$ wso "[m[22;30H[K"
$ endif
$ endif
$ x = f$edit(x,"UPCASE,TRIM")
$ if x .nes. "Y" then goto get_choice
$ f1 = "''rls$dir'''lge'.rosters"
$ f2 = "''rotis$'.''lge']''lge'_''n_frz'.rosters"
$ f3 = "''rotis$'.''lge'.delta]delta_''n_frz'.rosters"
$ copy /nolog 'f1 'f2
$ copy /nolog 'f1 'f3
$ if frz .ge. spring
$ then
$ f1 = "''rls$dir'''lge'.rosters"
$ f2 = "''rotis$'.''lge']''lge'_''frz'.rosters"
$ f3 = "''rotis$'.''lge'.delta]delta_''frz'.rosters"
$ copy /nolog 'f1 'f2
$ copy /nolog 'f1 'f3
$ endif
$ goto get_choice
$!
$! ===================
$! GET DATA: STANDINGS
$! ===================
$!
$GS:
$ gosub clear_long
$ def_frz = frz
$GS1:
$ gosub get_freeze
$ read /prompt="Cumulative (C) or Delta (D) > " /end=gs2 -
sys$command x
$ x = f$edit(x,"UPCASE,TRIM")
$ if x .eqs. "" then goto gs2
$ if x .nes. "D" .and. x .nes. "C" then goto gs1
$ if x .eqs. "D"
$ then
$ f1 = "''rotis$'.''lge'.delta]delta_''f'.standings"
$ else
$ f1 = "''rotis$'.''lge']''lge'_''f'.standings"
$ endif
$ type /page 'f1
$ wso ""
$ goto gs1
$GS2:
$ if mode .nes. "EXPERT" then set term /page='menu_size'
$ goto show_menu
$!
$! =====================
$! GET DATA: OWNER STATS
$! =====================
$!
$GO:
$ gosub clear_long
$ set term /width='wide_screen'
$ def_frz = frz
$GO1:
$ gosub get_freeze
$ read /prompt="Cumulative (C) or Delta (D) > " /end=go3 -
sys$command x
$ x = f$edit(x,"UPCASE,TRIM")
$ if x .eqs. "" then goto go3
$ if x .nes. "D" .and. x .nes. "C" then goto go1
$GO2:
$ read /prompt="Owner > " /end=go3 sys$command owner
$ if owner .eqs. "" then goto go1
$ if x .eqs. "D"
$ then
$ f1 = "''rotis$'.''lge'.delta]delta_''f'.''owner'"
$ else
$ f1 = "''rotis$'.''lge']''lge'_''f'.''owner'"
$ endif
$ type /page 'f1
$ wso ""
$ goto go2
$GO3:
$ if mode .nes. "EXPERT" then set term /page='menu_size'
$ set term /width=80
$ goto show_menu
$!
$! ==============================================
$! GET DATA: FREE AGENTS (AVAILABLE PLAYER LISTS)
$! ==============================================
$!
$GF:
$ gosub clear_it
$ def_frz = frz
$GF1:
$ gosub get_freeze
$ read /prompt="Batters or Pitchers (BAT, PIT) > " /end=gf2 -
sys$command x
$ x = f$edit(x,"UPCASE,TRIM")
$ if x .eqs. "" then goto show_menu
$ if x .nes. "BAT" .and. x .nes. "PIT" then goto gf1
$ avail /'x /freeze='def_frz 'lge
$ wso ""
$ goto gf1
$!
$! ================
$! GET DATA: ROSTER
$! ================
$!
$GR:
$ gosub clear_it
$GR1:
$ read /prompt="[22;5HOwner > " /end=show_menu sys$command owner
$ owner = f$edit(owner,"UPCASE,TRIM")
$ wso "[2J[H"
$ if owner .eqs. "" then goto show_menu
$ f1 = "''rls$dir'''lge'.rosters"
$ open /read fspec 'f1
$ read fspec rec
$ read fspec rec
$ read fspec rec
$ read fspec rec
$GR2:
$ read/end=grnone fspec rec
$ read/end=grnone fspec rec
$ cmp_rec = f$edit(rec,"COMPRESS,TRIM")
$ read fspec nick
$ read fspec rec
$ count = 0
$GR3:
$ lname = f$element(count," ",cmp_rec)
$ name = f$edit(lname,"UPCASE,TRIM")
$ len = f$length(name)
$ if f$extract(len-2,2,name) .eqs. "'S" then name = f$extract(0,len-2,name)
$ if f$extract(len-1,1,name) .eqs. "'" then name = f$extract(0,len-1,name)
$ if name .eqs. owner then goto gr5
$ count = count + 1
$ if count .lt. 4 then goto gr3
$GR4:
$ read/end=grnone fspec rec
$ rec = f$edit(rec,"TRIM")
$ if rec .eqs. "" then goto gr2
$ goto gr4
$GR5:
$ num_res = 0
$ nick = "''f$extract(19*count+3,18,nick)'"
$ wso "[2J[1;1H''lname' ''nick'"
$ wso "[1m[3;5HPitchers:[3;29HInfielders:"
$ wso "[3;53HDesignated Hitter:[7;53HReserves:"
$ wso "[12;29HOutfielders:[15;5HCatchers:[m"
$ wso "[5;30H1B[6;30H2B[7;30HSS[8;30H3B[9;30HCI[10;30HMI"
$ p = 0
$GR6:
$ read fspec rec
$ player = "''f$extract(19*count+3,18,rec)'"
$ row = p + 5
$ wso "[''row';9H''player'"
$ p = p + 1
$ if p .lt. 9 then goto gr6
$ read fspec rec
$GR7:
$ read fspec rec
$ if f$extract(0,2,rec) .eqs. "--" .or. f$extract(0,2,rec) .eqs. "==" -
then goto gr8
$ player = "''f$extract(19*count+3,18,rec)'"
$ if f$extract(0,1,player) .nes. " " .and. f$extract(0,1,player) .nes. ""
$ then
$ row = num_res + 9
$ wso "[''row';57H''player'"
$ num_res = num_res + 1
$ endif
$ goto gr7
$GR8:
$ num_res = num_res + 1
$ gosub get_player
$ wso "[17;9H''player'"
$ gosub get_player
$ wso "[18;9H''player'"
$ read fspec rec
$ gosub get_player
$ wso "[5;33H''player'"
$ gosub get_player
$ wso "[6;33H''player'"
$ gosub get_player
$ wso "[7;33H''player'"
$ gosub get_player
$ wso "[8;33H''player'"
$ read fspec rec
$ gosub get_player
$ wso "[9;33H''player'"
$ gosub get_player
$ wso "[10;33H''player'"
$ read fspec rec
$ gosub get_player
$ wso "[14;33H''player'"
$ gosub get_player
$ wso "[15;33H''player'"
$ gosub get_player
$ wso "[16;33H''player'"
$ gosub get_player
$ wso "[17;33H''player'"
$ gosub get_player
$ wso "[18;33H''player'"
$ read fspec rec
$ gosub get_player
$ wso "[5;57H''player'"
$ read fspec rec
$GR9:
$ read fspec rec
$ if f$extract(0,2,rec) .eqs. "--" .or. f$extract(0,2,rec) .eqs. "==" -
then goto grdone
$ player = "''f$extract(19*count+3,18,rec)'"
$ if f$extract(0,1,player) .nes. " "
$ then
$ row = num_res + 9
$ wso "[''row';57H''player'"
$ endif
$ num_res = num_res + 1
$ goto gr9
$GRNONE:
$ wso "No match for owner's name"
$GRDONE:
$ close fspec
$ goto gr1
$!
$! ======================
$! GET DATA: PLAYER STATS
$! ======================
$!
$GP:
$ gosub clear_long
$ if mode .nes. "EXPERT" then wso "[2J[H"
$GP1:
$ read /prompt="League & Position (ALBAT, ALPIT, NLBAT, NLPIT) > " -
/end=gp3 sys$command ext
$ ext = f$edit(ext,"UPCASE,TRIM")
$ if ext .eqs. "" then goto gp3
$ if ext .nes. "ALBAT" .and. ext .nes. "ALPIT" .and. -
ext .nes. "NLBAT" .and. ext .nes. "NLPIT" then goto gp1
$GP2:
$ read /prompt="Player's name > " /end=gp3 sys$command player
$ if player .eqs. "" then goto gp1
$ f1 = "''stats$'freeze_*.''ext'"
$ wso ""
$ if f$extract(2,3,ext) .eqs. "PIT"
$ then
$ wso " W L G GS CG GF SH SV IP H R ER HR BB SO"
$ else
$ wso " G AB R H TB 2B 3B HR RBI BB SO SB CS E"
$ endif
$ sea 'f1 "''player'"
$ wso ""
$ goto gp2
$GP3:
$ if mode .nes. "EXPERT" then set term /page='menu_size'
$ goto show_menu
$!
$! ===================================
$! GET DATA: TEAM STATS (major league)
$! ===================================
$!
$GT:
$ gosub clear_long
$ def_frz = frz
$ gosub get_freeze
$GT1:
$ read /prompt="League & Position (ALBAT, ALPIT, NLBAT, NLPIT) > " -
/end=gt7 sys$command ext
$ ext = f$edit(ext,"UPCASE,TRIM")
$ if ext .eqs. "" then goto gt7
$ if ext .nes. "ALBAT" .and. ext .nes. "ALPIT" .and. -
ext .nes. "NLBAT" .and. ext .nes. "NLPIT" then goto gt1
$GT2:
$ read /prompt="Three-letter team code > " /end=gt7 sys$command -
tcode
$ tcode = f$edit(tcode,"UPCASE,TRIM")
$ if tcode .eqs. "" then goto gt1
$ wso ""
$ f1 = "''stats$'freeze_''f'.''ext'"
$ open /read fspec 'f1
$GT3:
$ read /end=gt5 fspec /err=gt6 rec
$ if f$extract(0,3,rec) .nes. tcode then goto gt3
$ if f$extract(2,3,ext) .eqs. "PIT"
$ then
$ wso " W L G GS CG GF SH SV IP H R ER HR BB SO"
$ else
$ wso " G AB R H TB 2B 3B HR RBI BB SO SB CS E"
$ endif
$GT4:
$ read /end=gt6 fspec rec
$ if rec .eqs. "" then goto gt6
$ wso "''rec'"
$ goto gt4
$GT5:
$ wso "Team ''tcode' not found in ''ext'"
$GT6:
$ close fspec
$ wso ""
$ goto gt2
$GT7:
$ set term /page='menu_size'
$ goto show_menu
$!
$! =========================================
$! GET DATA: AFFILIATION (who owns a player)
$! =========================================
$!
$GA:
$ clear = "CLEAR"
$ if mode .nes. "EXPERT" then wso "[2J[H"
$GA1:
$ read /prompt="Player's name > " /end=show_menu sys$command player
$ if player .eqs. "" then goto show_menu
$ wso ""
$ wso "NOTE: Owner appears above player's name ..."
$ wso ""
$ num = 0
$GA2:
$ y = f$element(num,";",leagues)
$ if y .eqs. ";" then goto ga1
$ wso "[1m''y':[m"
$ f = "''rls$dir'''y'.rosters"
$ o = owners_'num
$ sea 'f "''player'", 'o
$ wso ""
$ num = num + 1
$ goto ga2
$!
$! =======================
$! GET DATA: PLAYER RATING
$! =======================
$!
$GZ:
$ clear = ""
$ if rating_file .nes. "" then goto gz1
$ if mode .eqs. "EXPERT"
$ then
$ wso "No rating file(s) defined ..."
$ else
$ wso "[1;7m[22;30HNo rating file(s) defined ..."
$ endif
$ wait 00:00:01
$ if mode .nes. "EXPERT" then wso "[22;30H[m[K"
$ goto show_menu
$GZ1:
$ clear = "CLEAR"
$ if mode .nes. "EXPERT" then wso "[2J[H"
$GZ2:
$ read /prompt="Player > " /end=show_menu sys$command pl
$ if pl .eqs. "" then goto show_menu
$ wso ""
$ sea 'rating_file "''pl'"
$ wso ""
$ goto gz2
$!
$! ============================
$! POSITION ELIGIBILITY: VERIFY
$! ============================
$!
$PV:
$ clear = "CLEAR"
$ if mode .nes. "EXPERT" then wso "[2J[H"
$ last_year = f$string(f$integer(year) - 1)
$PV1:
$ read /prompt="Major league (AL, NL) > " /end=show_menu sys$command -
maj_lge
$ maj_lge = f$edit(maj_lge,"UPCASE,TRIM")
$ if maj_lge .eqs. "" then goto show_menu
$ if maj_lge .nes. "AL" .and. maj_lge .nes. "NL" then goto pv1
$PV2:
$ read /prompt="Player's last name > " /end=show_menu sys$command player
$ if player .eqs. "" then goto pv1
$ f1 = "''rls$dir'''maj_lge'_positions.''last_year'"
$ f2 = "''rls$dir'''maj_lge'_positions.''year'"
$ wso ""
$ wso ""
$ wso "[1m''last_year':[m"
$ sea 'f1 'player, 'year, basemen, design, outfield
$ wso ""
$ wso "[1m''year':[m"
$ sea 'f2 'player, 'year, basemen, designated, outfield
$ wso ""
$ goto pv2
$!
$! ==========================
$! POSITION ELIGIBILITY: POST
$! ==========================
$!
$PP:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ f1 = "''rls$dir'post.temp"
$ open /write temp 'f1
$ write temp "$ notes"
$ write temp "open /noauto ''f$element(lge_num,";",confs)'"
$ write temp "set mod"
$ write temp "''f$element(lge_num,";",pos_elig_nums)'.LAST"
$ gosub del_prev
$ l_type = f$element(lge_num,";",types)
$ if y_n .nes. "Y" then goto pp1
$ write temp "del"
$ write temp "y"
$ if l_type .nes. "" then goto pp1
$ write temp "del"
$ write temp "y"
$PP1:
$ if l_type .eqs. ""
$ then
$ write temp "reply /noed ''rls$dir'al_positions.''year'"
$ write temp ""
$ write temp "y"
$ write temp "reply /noed ''rls$dir'nl_positions.''year'"
$ else
$ write temp "reply /noed ''rls$dir'''l_type'_positions.''year'"
$ endif
$ write temp ""
$ write temp "y"
$ write temp "exit"
$ close temp
$ submit /nonotify /noprint /noidentify 'f1
$ goto get_choice
$!
$! =======================
$! DRAFT: CREATE NEW ROUND
$! =======================
$!
$DC:
$ clear = ""
$ f1 = "''rls$dir'''lge'.round"
$ f2 = "''rls$dir'''lge'.draft"
$ f3 = "''rls$dir'''lge'.order"
$ keepers = f$element(lge_num,";",max_keepers)
$ assign /user _nla0: sys$error
$ assign /user _nla0: sys$output
$ dir /brief 'f1
$ if .not. $status then goto dc2
$ assign /user _nla0: sys$error
$ assign /user _nla0: sys$output
$ dir /brief 'f2
$ if $status then goto dc1
$ create 'f2
$DC1:
$ open /read t1 'f1
$ open /append t2 'f2
$ read t1 rec
$ space = f$locate(" ",rec)
$ colon = f$locate(":",rec)
$ round = f$extract(space+1,colon-space-1,rec)
$ if round .le. keepers then round = keepers
$ write t2 ""
$ write t2 ""
$ close t1
$ close t2
$ append 'f1 'f2
$ goto dc3
$DC2:
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="Fewest protected by any owner > " /end=show_menu -
sys$command round
$ else
$ wso ""
$ read /prompt="[22;30HFewest protected by any owner > " -
/end=get_choice sys$command round
$ wso "[22;30H[K"
$ endif
$DC3:
$ open /write t1 'f1
$DC3a:
$ round = round + 1
$ write t1 "ROUND ''round':"
$ write t1 ""
$ write t1 "OWNER POS/PLAYER TM. POSITION ADJUSTMENT"
$ write t1 "----- ---------- --- -------------------"
$ open /read t3 'f3
$DC4:
$ read /end=dc5 t3 rec
$ cmp_rec = f$edit(rec,"COMPRESS,TRIM")
$ if f$element(0," ",cmp_rec) .lt. round then -
write t1 "''f$element(1," ",cmp_rec)'"
$ goto dc4
$DC5:
$ if round .ge. keepers then goto dc6
$ write t1 ""
$ write t1 ""
$ close t3
$ goto dc3a
$DC6:
$ close t1
$ close t3
$ goto get_choice
$!
$! =============
$! DRAFT: MODIFY
$! =============
$!
$DM:
$ gosub clear_it
$ temp = "''rls$dir'''lge'.round"
$ assign /user 'f$logical("SYS$COMMAND") sys$input:
$ editing 'temp
$ goto show_menu
$!
$! ====================================
$! DRAFT: UPDATE (generates new roster)
$! ====================================
$!
$DU:
$ gosub clear_it
$ games = 3
$ if frz .ge. spring then games = 20
$ wso "Do you want to delete the latest version of your roster file?"
$ wso ""
$ wso "NOTE: You'd only want to do this if you are re-running this"
$ wso " option for the same draft round, after correcting errors..."
$ wso ""
$ read /prompt="(Y/[N]) > " /end=show_menu sys$command xx
$ xx = f$edit(xx,"UPCASE,TRIM")
$ if xx .eqs. "Y" then delete 'lge.rosters;
$ wso ""
$ wso "Updating ''lge'.ROSTERS from ''lge'.ROUND ..."
$ image = "''rls$dir'update_draft"
$ log = "''rls$dir'update_draft.log"
$ define /nolog roster$file "''rls$dir'''lge'.rosters"
$ define /nolog draft$file "''rls$dir'''lge'.round"
$ define /nolog new_roster$file "''rls$dir'''lge'.rosters"
$ run 'image
$ wso "Displaying Update Draft LOG (okay if no errors appear):"
$ wait 00:00:02
$ type /page 'log
$ inquire /nopunc y_n "Alphabetize rosters (Y/[N]) > "
$ y_n = f$edit(y_n,"UPCASE,TRIM")
$ if y_n .eqs. "Y" then rsort <new_roster$file >new_roster$file -noowner
$ inquire /nopunc y_n "Validate positions (Y/[N]) > "
$ y_n = f$edit(y_n,"UPCASE,TRIM")
$ if y_n .eqs. "Y"
$ then
$ l_type = f$element(lge_num,";",types)
$ temp = "''rls$dir'''lge'.rosters"
$ if l_type .eqs. "AL"
$ then
$ vr 'temp rls$:vr.dat 'games rls$:vr.last 20
$ else
$ vr 'temp rls$:vr.dat 'games rls$:vr.last 20 NL
$ endif
$ inquire /nopunc x "Press RETURN to continue "
$ endif
$ goto show_menu
$!
$! ===========
$! DRAFT: POST
$! ===========
$DP:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ f1 = "''rls$dir'post.temp"
$ open /write temp 'f1
$ write temp "$ notes"
$ write temp "open /noauto ''f$element(lge_num,";",confs)'"
$ write temp "set mod"
$ write temp "''f$element(lge_num,";",draft_nums)'.LAST"
$ gosub del_prev
$ if y_n .nes. "Y" then goto dp1
$ write temp "del"
$ write temp "y"
$DP1:
$ write temp "reply /noed ''rls$dir'''lge'.round"
$ gosub note_title
$ submit /nonotify /noprint /noidentify 'f1
$ goto get_choice
$!
$! ============================
$! NOTES: CREATE FOR NEW SEASON
$! ============================
$!
$NC:
$ gosub clear_it
$ wso "Creating batch job to write new notes to your conference..."
$ f1 = "''rls$dir'base_note.temp"
$ open /write temp 'f1
$ write temp " Please do not reply to this note -- for league statistician only"
$ close temp
$ f1 = "''rls$dir'misc_note.temp"
$ open /write temp 'f1
$ write temp " Use this note for miscellaneous discussions for the current season..."
$ close temp
$ f1 = "''rls$dir'post.temp"
$ open /write temp 'f1
$ write temp "$ notes"
$ write temp "open /noauto ''f$element(lge_num,";",confs)'"
$! write temp "set mod"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Draft"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Rosters"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Transactions & Trades"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Free Moves"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Standings"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Delta Standings"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Team Totals"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Team Stats"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Available Pitchers"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Available Batters"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'base_note.temp"
$ write temp "''year' ''lge' Position Eligibilities"
$ write temp "Y"
$ write temp "write /noed ''rls$dir'misc_note.temp"
$ write temp "''year' ''lge' Miscellaneous"
$ write temp "Y"
$ write temp "exit"
$ close temp
$ submit /nonotify /noprint /noidentify 'f1
$ wso "Batch job submitted"
$ wso ""
$ wso "NOTE: Please check your conference in a few minutes and make"
$ wso " note of the newly created notes and their note numbers."
$ wso ""
$ wso " Before continuing, you should exit RLS, modify RLS.TXT to "
$ wso " reflect the new note numbers, and then re-enter RLS..."
$ wso ""
$ inquire /nopunc x "Press RETURN to continue . . ."
$ goto show_menu
$!
$! =============================
$! MISCELLANEOUS: REFRESH SCREEN
$! =============================
$!
$MR:
$ wso "[2J[H"
$ goto show_menu
$!
$! ===========================
$! MISCELLANEOUS: SPAWN TO DCL
$! ===========================
$!
$MS:
$ clear = "CLEAR"
$ if mode .nes. "EXPERT" then wso "[2J[H"
$ if .not. nobroad then set term /broadcast
$ spawn /prompt="[1mLOGOUT[m to resume RLS > "
$ set term /nobroadcast
$ goto show_menu
$!
$! ====================
$! MISCELLANEOUS: PURGE
$! ====================
$!
$MP:
$ clear = ""
$ xx = f$environment("DEFAULT")
$ set default rls$
$ if mode .eqs. "EXPERT"
$ then
$ wso "Purging files under ''rls$dir' ..."
$ purge [...]
$ wso "Finished"
$ else
$ wso "[22;30HPurging files under ''rls$dir' ..."
$ purge [...]
$ wso "[22;30H[K"
$ endif
$ set default 'xx
$ goto get_choice
$!
$! ===================
$! ... SUBROUTINES ...
$! ===================
$!
$! ============================
$! FIND NEXT NON-COMMENTED LINE
$! ============================
$!
$SKIP_COMMENTS:
$ read /end=read_error fspec rec
$ if f$extract(0,1,rec) .eqs. "!" then goto skip_comments
$ return
$!
$! ===============
$! DELETE PREVIOUS
$! ===============
$!
$DEL_PREV:
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="Delete previous posting (Y/[N]) > " /end=stop_dp -
sys$command y_n
$ else
$ read /prompt="[22;30HDelete previous posting (Y/[N]) > [K[1;7m [22;65H" -
/end=stop_dp sys$command y_n
$ wso "[m[22;30H[K"
$ endif
$ y_n = f$edit(y_n,"UPCASE,TRIM")
$ return
$STOP_DP:
$ close temp
$ goto get_choice
$!
$! =====
$! CLEAR
$! =====
$!
$CLEAR_IT:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ clear = "CLEAR"
$ wso "[2J[H"
$ return
$!
$! =======
$! CLEAR 2
$! =======
$!
$CLEAR_IT_2:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ if frz .eqs. "" then goto ncf
$ clear = "CLEAR"
$ if mode .nes. "EXPERT" then wso "[2J[H"
$ return
$!
$! ==========
$! CLEAR LONG
$! ==========
$!
$CLEAR_LONG:
$ clear = ""
$ if lge .eqs. "" then goto ncl
$ if frz .eqs. "" then goto ncf
$ clear = "CLEAR"
$ if mode .nes. "EXPERT"
$ then
$ wso "[2J[H"
$ set term /page='long_window'
$ endif
$ return
$!
$! ==========
$! GET_PLAYER
$! ==========
$!
$GET_PLAYER:
$ read fspec rec
$ player = "''f$extract(19*count+3,18,rec)'"
$ return
$!
$! ==========
$! NOTE TITLE
$! ==========
$!
$NOTE_TITLE:
$ title = ""
$ if mode .eqs. "EXPERT"
$ then
$ read /prompt="[Title] > " /end=stop_nt sys$command title
$ else
$ wso ""
$ read /prompt="[22;30H[Title] > " /end=stop_nt sys$command -
title
$ wso "[22;30H[K"
$ endif
$ write temp "''title'"
$ write temp "y"
$ write temp "exit"
$ close temp
$ return
$STOP_NT:
$ close temp
$ goto get_choice
$!
$! ==========
$! GET FREEZE
$! ==========
$!
$GET_FREEZE:
$ read /prompt="Freeze [''def_frz'] > " /end=show_menu sys$command f
$ if f$length(f) .eq. 1 then f = "0''f'"
$ if f .eqs. ""
$ then
$ f = def_frz
$ else
$ def_frz = f
$ endif
$ return
$!
$! ====
$! EXIT
$! ====
$!
$FINISHED:
$ close t1
$ close t2
$ close temp
$ close tmpfile
$ close fspec
$EX:
$ if mode .nes. "EXPERT" then wso "[m[H[J"
$ if .not. nobroad then set term /broadcast
$ if wrap then set term /wrap /page='lines_per_page'
$ wso "Checking to see if you received any VAXmail while in RLS ...."
$ mail
$ wso ""
$ exit
$!
$! ==============
$! ERROR HANDLING
$! ==============
$!
$READ_ERROR:
$ wso "[2J[H"
$ wso ""
$ wso "Insufficient data reading RLS.TXT"
$ wso ""
$ exit
|