IDENTIFICATION DIVISION. PROGRAM-ID. NFLBOOKIE. * This program performs betting on NFL games. * The Master Controller (username SYSTEM) should enter the games * and the line on Wednesday, and players can place bets on Thursday or Friday * The Master Controller should then run update on Tuesday * If you want another user to also be the Master Controller, put * their username in the variable OTHER-MASTER. * System or other Logical Name NFL$LOC: should point to data file directory * 25-OCT-90 ELG Original version (for 1990 season). * 03-JAN-91 ELG Updated for the 1991 playoffs * 13-AUG-91 ELG Updated for 1991+ seasons - added parlays * 04-SEP-91 ELG Bug fixes in updates * 24-OCT-91 ELG Added OVER/UNDER betting capability * 31-OCT-91 ELG Made parlays a separate file * 23-JAN-92 ELG Changed ext on files to reflect season year ENVIRONMENT DIVISION. CONFIGURATION SECTION. SPECIAL-NAMES. SYMBOLIC CHARACTERS FORM-FEED IS 13. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT GAMES-FILE ASSIGN TO "NFL$LOC:" ORGANIZATION RELATIVE ACCESS DYNAMIC RELATIVE KEY IS GAME-NUMBER FILE STATUS IS F-STAT. SELECT FUNDS-FILE ASSIGN TO "NFL$LOC:" ORGANIZATION INDEXED ACCESS DYNAMIC RECORD KEY IS FUNDS-KEY FILE STATUS IS F-STAT. SELECT PARLAYS-FILE ASSIGN TO "NFL$LOC:" ORGANIZATION INDEXED ACCESS DYNAMIC RECORD KEY IS PARLAY-KEY FILE STATUS IS F-STAT. SELECT DATE-FILE ASSIGN TO "NFL$LOC:" FILE STATUS IS F-STAT. SELECT OUTPUT-FILE ASSIGN TO " ". DATA DIVISION. FILE SECTION. FD FUNDS-FILE VALUE OF ID FUNDS-FILE-ID. 01 FUNDS-RECORD. 05 FUNDS-KEY. 10 FUNDS-USERNAME PIC X(14). 05 FUNDS-DATE PIC 9(6). 05 FUNDS-YTD. 10 FUNDS-YTD-WON PIC S9(9) COMP. 10 FUNDS-YTD-WCNT PIC 9(4) COMP. 10 FUNDS-YTD-LCNT PIC 9(4) COMP. 10 FUNDS-YTD-TCNT PIC 9(4) COMP. 10 FUNDS-YTD-OWCT PIC 9(4) COMP. 10 FUNDS-YTD-OLCT PIC 9(4) COMP. 10 FUNDS-YTD-OTCT PIC 9(4) COMP. 10 FUNDS-YTD-PWCT PIC 9(4) COMP. 10 FUNDS-YTD-PLCT PIC 9(4) COMP. 05 FUNDS-ARRAY OCCURS 21. 10 FUNDS-WK-WON PIC S9(9) COMP. 10 FUNDS-WK-WCNT PIC 99 COMP. 10 FUNDS-WK-LCNT PIC 99 COMP. 10 FUNDS-WK-TCNT PIC 99 COMP. 10 FUNDS-WK-OWCT PIC 99 COMP. 10 FUNDS-WK-OLCT PIC 99 COMP. 10 FUNDS-WK-OTCT PIC 99 COMP. 10 FUNDS-WK-PWCT PIC 99 COMP. 10 FUNDS-WK-PLCT PIC 99 COMP. FD PARLAYS-FILE VALUE OF ID PARLAYS-FILE-ID. 01 PARLAY-RECORD. 05 PARLAY-KEY. 10 PL-USERNAME PIC X(14). 10 PL-WK PIC 99. 05 PARLAY-DATA. 10 PL-TOT-AMT PIC S9(9) COMP. 10 PL-UPD-FLG PIC X. 10 PL-NUM-PARLAYS PIC 9 COMP. 10 PL-WK-PARLAY OCCURS 0 TO 9 TIMES DEPENDING ON PL-NUM-PARLAYS. 15 PL-AMT PIC S9(4) COMP. 15 PL-TYPE PIC X. 15 PL-WL PIC X. 15 PL-NUM-TEAMS PIC 99 COMP. 15 PL-TEAM PIC S99 OCCURS 15. FD GAMES-FILE VALUE OF ID GAMES-FILE-ID. 01 GAME-RECORD. 05 WHO-PLAYS. 10 VTEAM PIC 99. 10 HTEAM PIC 99. 05 DATE-PLAYED PIC 9(6). 05 OUTCOME. 10 SCV PIC 99. 10 SCH PIC 99. 05 SB-VLINE PIC S99V9 COMP. 05 SB-OUPTS PIC S99V9 COMP. 05 NUMBER-OF-BETTORS PIC 99 COMP. 05 ACTION OCCURS 0 TO 12 TIMES DEPENDING ON NUMBER-OF-BETTORS. 10 BETTOR PIC X(14). 10 BV-AMT PIC S9(4) COMP. 10 BH-AMT PIC S9(4) COMP. 10 BO-AMT PIC S9(4) COMP. 10 BU-AMT PIC S9(4) COMP. 10 WL-AMT PIC S9(4) COMP. FD DATE-FILE VALUE OF ID DATE-FILE-ID. 01 DATE-RECORD. 05 MIN-DATE PIC 9(6). 05 MAX-DATE PIC 9(6). 05 CLOS-DATE PIC 9(6) OCCURS 21. FD OUTPUT-FILE RECORD VARYING DEPENDING ON REC-DEPEND VALUE OF ID OUTPUT-FILE-ID. 01 OUT-LINE PIC X(80). 01 OUT-LINE-1. 05 O-GAME-NUM PIC Z9-. 05 O-TEAM-BET PIC X(13). 05 O-BET-LINE PIC +(4)9.9. 05 FILLER PIC X. 05 O-VS PIC X(7). 05 FILLER PIC X. 05 O-TEAM-PLAYING PIC X(13). 05 OUT-1-ORIG. 10 FILLER PIC X(4). 10 O-BET-AMT PIC ZZZ9. 05 OUT-1-REDEF REDEFINES OUT-1-ORIG. 10 FILLER PIC XX. 10 O-PTS-LIN PIC Z9.9. 10 FILLER PIC XX. 05 O-SCORE-TEAM PIC ZZ9. 05 O-DASH PIC X. 05 O-SCORE-OTHER PIC Z9. 05 O-EQUAL PIC X. 05 O-PTS-TOT PIC Z9-. 05 O-RESULT PIC X(5). 05 O-WON PIC -(7)9. 01 OUT-LINE-1A. 05 FILLER PIC X(17). 05 O1-PLUS PIC XXX. 05 O1-TEAM-PLAYING PIC X(14). 05 O1-VS PIC X(9). 05 O1-BET-LINE PIC Z9.9. 01 OUT-LINE-2. 05 FILLER PIC X(4). 05 O2-USER PIC X(14). 05 O2-DID PIC X(4). 05 FILLER PIC X. 05 O2-AMT PIC Z(7)9. 05 FILLER PIC X. 05 O2-RES. 10 O2-WCNT PIC ZZZ9. 10 O2-D1 PIC X. 10 O2-LCNT PIC ZZZ9. 10 O2-D2 PIC X. 10 O2-TCNT PIC ZZ9. 10 FILLER PIC X. 10 O2-WPCT PIC Z.999. 05 O2-RES-RED REDEFINES O2-RES. 10 O2-AMT1 PIC -(7)9. 10 FILLER PIC XXX. 10 O2-AMT2 PIC -(7)9. 05 O2-RES1. 10 O21-OWCT PIC ZZZ9. 10 O21-D1 PIC X. 10 O21-OLCT PIC ZZ9. 10 O21-D2 PIC X. 10 O21-OTCT PIC ZZ9. 05 O2-RES2. 10 FILLER PIC X. 10 O22-P1 PIC X. 10 O22-PWCT PIC Z9. 10 O22-D1 PIC X. 10 O22-PLCT PIC Z9. 10 O22-P2 PIC X. 01 OUT-LINE-3. 05 O3-TYPE PIC X(6). 05 FILLER PIC X. 05 O3-WON-LOST PIC X(4). 05 FILLER PIC X. 05 O3-AMT-BET PIC $$$$9-. 05 FILLER PIC X. 05 O3-NUM-TMS PIC ZZ9. 05 FILLER PIC X. 05 O3-DESC1 PIC X(12). 05 O3-PTPAY PIC $$$$$9.99. 05 O3-DESC2 PIC X(8). 05 O3-WLPAY PIC $$$$$9.99. 01 OUT-LINE-4. 05 O4-WINNER PIC X(13). 05 O4-OVER PIC X(6). 05 O4-LOSER PIC X(13). 05 O4-SCW PIC ZZ9. 05 O4-DASH PIC X. 05 O4-SCL PIC ZZ9. WORKING-STORAGE SECTION. 01 MASTER-USER PIC X(6) VALUE "SYSTEM". 01 OTHER-MASTER PIC XXX VALUE "LEE". *01 OTHER-MASTER PIC X(8) VALUE "SYSMAINT". 01 F-STAT PIC XX. 88 SOFT-LOCK VALUE "90". 88 RECORD-LOCKED VALUE "92". 88 FILE-NOT-FOUND VALUE "35" "97". 01 GAME-NUMBER PIC 99 COMP. 01 CREATE-GAMES-FILE-CMD. 05 FILLER PIC X(28) VALUE "CREATE/FDL=NFL$LOC:BETS.FDL ". 05 GAMES-FILE-ID. 10 FILLER PIC X(9) VALUE "NFL$LOC:". 10 FILLER PIC X(4) VALUE "BETS". 10 WEEK-NUMBER PIC 99. 10 FILLER PIC XX VALUE ".Y". 10 YEAR-NUMBER PIC 99. 01 FUNDS-FILE-ID. 05 FILLER PIC X(7) VALUE "FUNDS.Y". 05 YEAR-NUMBER PIC 99. 01 PARLAYS-FILE-ID. 05 FILLER PIC X(9) VALUE "PARLAYS.Y". 05 YEAR-NUMBER PIC 99. 01 DATE-FILE-ID. 05 FILLER PIC X(11) VALUE "GAMEDATES.Y". 05 YEAR-NUMBER PIC 99. 01 REC-DEPEND PIC 999 COMP. 01 L-CNT PIC 999 COMP. 01 PRINT-OUT-CMD. 05 FILLER PIC X(11) VALUE "PRINT/FORM=". 05 FORM-NAME PIC X(24) VALUE "NFLBETS". 05 FILLER PIC X VALUE SPACES. 05 OUTPUT-FILE-ID. 10 FILLER PIC X(10) VALUE "SYS$LOGIN:". 10 FILLER PIC X(4) VALUE "BETS". 10 WEEK-NUMBER PIC 99. 10 FILLER PIC X(5) VALUE ".OUT". 01 NAME-ARRAYS. 05 TEAM-NAMES-DEFINED. 10 FILLER PIC X(13) VALUE "Atlanta". 10 FILLER PIC X(13) VALUE "Buffalo". 10 FILLER PIC X(13) VALUE "Chicago". 10 FILLER PIC X(13) VALUE "Cincinnati". 10 FILLER PIC X(13) VALUE "Cleveland". 10 FILLER PIC X(13) VALUE "Dallas". 10 FILLER PIC X(13) VALUE "Denver". 10 FILLER PIC X(13) VALUE "Detroit". 10 FILLER PIC X(13) VALUE "Green Bay". 10 FILLER PIC X(13) VALUE "Houston". 10 FILLER PIC X(13) VALUE "Indianapolis". 10 FILLER PIC X(13) VALUE "Kansas City". 10 FILLER PIC X(13) VALUE "L.A. Raiders". 10 FILLER PIC X(13) VALUE "L.A. Rams". 10 FILLER PIC X(13) VALUE "Miami". 10 FILLER PIC X(13) VALUE "Minnesota". 10 FILLER PIC X(13) VALUE "N.Y. Giants". 10 FILLER PIC X(13) VALUE "N.Y. Jets". 10 FILLER PIC X(13) VALUE "New England". 10 FILLER PIC X(13) VALUE "New Orleans". 10 FILLER PIC X(13) VALUE "Philadelphia". 10 FILLER PIC X(13) VALUE "Phoenix". 10 FILLER PIC X(13) VALUE "Pittsburgh". 10 FILLER PIC X(13) VALUE "San Diego". 10 FILLER PIC X(13) VALUE "San Francisco". 10 FILLER PIC X(13) VALUE "Seattle". 10 FILLER PIC X(13) VALUE "Tampa Bay". 10 FILLER PIC X(13) VALUE "Washington". 05 TEAM-NAME REDEFINES TEAM-NAMES-DEFINED PIC X(13) OCCURS 28. 05 PLUS-17-STUFF. 10 FILLER PIC X(24) VALUE "WILD CARD PLAYOFFS". 10 FILLER PIC X(24) VALUE "CONFERENCE SEMI-FINALS". 10 FILLER PIC X(24) VALUE "CONFERENCE CHAMPIONSHIPS". 10 FILLER PIC X(24) VALUE "SUPER BOWL". 05 PLUS-17 REDEFINES PLUS-17-STUFF PIC X(24) OCCURS 4. 05 PLUS-17-ITEM PIC X(24) VALUE SPACES. 01 PARLAY-TEASER-STUFF. 05 MAX-PARLAY PIC 99 COMP VALUE 10. 05 MAX-TEASER PIC 99 COMP VALUE 15. 05 PARLAY-PAYS-DEFINED. 10 FILLER PIC 999V9 COMP VALUE 0. 10 FILLER PIC 999V9 COMP VALUE 1. 10 FILLER PIC 999V9 COMP VALUE 6.5. 10 FILLER PIC 999V9 COMP VALUE 12. 10 FILLER PIC 999V9 COMP VALUE 22. 10 FILLER PIC 999V9 COMP VALUE 50. 10 FILLER PIC 999V9 COMP VALUE 80. 10 FILLER PIC 999V9 COMP VALUE 150. 10 FILLER PIC 999V9 COMP VALUE 300. 10 FILLER PIC 999V9 COMP VALUE 600. 05 PARLAY-PAYS REDEFINES PARLAY-PAYS-DEFINED PIC 999V9 COMP OCCURS 10. 05 TEASER-PAYS-DEFINED. 10 FILLER PIC 999V9 COMP VALUE 0. 10 FILLER PIC 999V9 COMP VALUE 0. 10 FILLER PIC 999V9 COMP VALUE 1. 10 FILLER PIC 999V9 COMP VALUE 3.5. 10 FILLER PIC 999V9 COMP VALUE 5. 10 FILLER PIC 999V9 COMP VALUE 7. 10 FILLER PIC 999V9 COMP VALUE 10. 10 FILLER PIC 999V9 COMP VALUE 15. 10 FILLER PIC 999V9 COMP VALUE 20. 10 FILLER PIC 999V9 COMP VALUE 25. 10 FILLER PIC 999V9 COMP VALUE 35. 10 FILLER PIC 999V9 COMP VALUE 50. 10 FILLER PIC 999V9 COMP VALUE 80. 10 FILLER PIC 999V9 COMP VALUE 100. 10 FILLER PIC 999V9 COMP VALUE 150. 05 TEASER-PAYS REDEFINES TEASER-PAYS-DEFINED PIC 999V9 COMP OCCURS 15. * Note: Teaser adds 6 points to score for team bet 05 TODAYS-DATE PIC 9(6). 05 TEST-DATE PIC 9(6). 05 TD-REDEF REDEFINES TEST-DATE. 10 TD-YR PIC 99. 10 TD-MO PIC 99. 10 TD-DA PIC 99. 05 TEST-DATE-2 PIC 9(6). 05 TD2-REDEF REDEFINES TEST-DATE-2. 10 TD2-YR PIC 99. 10 TD2-MO PIC 99. 10 TD2-DA PIC 99. 01 OTHER-STUFF. 05 INPUT-STRING. 10 OPTION PIC X. 10 ANS PIC X. 10 FILLER PIC X(12). 05 JPI-USERNAME PIC S9(9) COMP VALUE EXTERNAL JPI$_USERNAME. 05 ERROR-CODE PIC S9(4) COMP. 05 IDX-INP PIC S99 COMP. 05 IDX-WK PIC 99 COMP. 05 IDX-USR PIC 99 COMP. 05 IDX-MAX PIC 99 COMP. 05 IDX-TM PIC 99 COMP. 05 IDX-GM PIC 99 COMP. 05 IDX-GI PIC 99 COMP. 05 IDX-PL PIC 99 COMP. 05 IDX-PLI PIC 99 COMP. 05 IDX-CK PIC S99 COMP. 05 FIXED-PARLAY-OFFSET PIC 99 COMP. 05 BET-AMT PIC S9(4) COMP. 05 SCR-INP PIC 99 COMP. 05 PTS-INP PIC S99V9 COMP. 05 WS-HLINE PIC S99V9 COMP. 05 WS-FUNDS-AVAIL PIC S9(9) COMP. 05 WS-FUNDS-CHECK PIC S9(9) COMP. 05 STR-LEN PIC 99 COMP. 01 RESULTS-STUFF. 05 WS-USERNAME PIC X(14). 05 DISP-DATE PIC X(8). 05 DISP-THRU PIC X(8). 05 WS-STRING PIC X(14). 05 SBV-OUT PIC ++9.9. 05 SBH-OUT PIC ++9.9. 05 SBP-OUT PIC ZZ9.9. 05 SCORE-OUT. 10 SCV-OUT PIC Z9. 10 SCH-OUT PIC Z9. 10 SCT-OUT PIC ZZ9. 10 SCT-RES PIC X. 05 LINE-NO PIC 99. 05 NET-OUT PIC +(9)9. 05 BET-OUT PIC ZZZ9-. 05 WHERE-AT-ARRAY. 10 WHAT-LINE PIC S99 OCCURS 28. 05 WIN-ARRAY OCCURS 20. 10 W-USER PIC X(14). 10 W-WCNT PIC 99 COMP. 10 W-LCNT PIC 99 COMP. 10 W-TCNT PIC 99 COMP. 10 W-OWCT PIC 99 COMP. 10 W-OLCT PIC 99 COMP. 10 W-OTCT PIC 99 COMP. 10 W-PWCT PIC 99 COMP. 10 W-PLCT PIC 99 COMP. 10 W-AMT PIC S9(9) COMP. 05 GAM-ARRAY. 10 GAR-ENTRY OCCURS 20. 15 G-USER PIC X(14). 15 G-AMT PIC S9(9) COMP. 15 G-AMT1 PIC S9(9) COMP. 15 G-AMT2 PIC S9(9) COMP. 05 ANAL-ARRAY. 10 ANAL-ITEM OCCURS 4. 15 PTSO PIC 9(3)V9 COMP. 15 PTSD PIC 9(3)V9 COMP. 15 GMCT PIC 99 COMP. * FWK-PARLAY-RECORD is a copy of PARLAY-RECORD 01 FWK-PARLAY-RECORD. 05 FWKP-KEY PIC X(16). 05 FWKP-DATA. 10 FWK-PL-TOT-AMT PIC S9(9) COMP. 10 FWK-UPD-FLG PIC X. 10 FWK-NUM-PARLAYS PIC 9 COMP. 10 FWK-WK-PARLAY OCCURS 9 TIMES. 15 FWK-PL-AMT PIC S9(4) COMP. 15 FWK-PL-TYPE PIC X. 15 FWK-PL-WL PIC X. 15 FWK-PL-NUM-TEAMS PIC 99 COMP. 15 FWK-PL-TEAM PIC S99 OCCURS 15. * 01 CONTROL-KEY. 05 FILLER PIC X. 05 CK23 PIC XX. 88 NORMAL-INPUT VALUE SPACES. * 88 PF1 VALUE "P". * 88 PF2 VALUE "Q". * 88 PF3 VALUE "R". * 88 PF4 VALUE "S". * 88 FUNC17 VALUE "31". * 88 FUNC18 VALUE "32". * 88 FUNC19 VALUE "33". * 88 FUNC20 VALUE "34". 05 CK4 PIC X. * 88 FUNC-TOP VALUE "~". PROCEDURE DIVISION. DECLARATIVES. ERROR-USE SECTION. USE AFTER ERROR PROCEDURE ON FUNDS-FILE PARLAYS-FILE GAMES-FILE. HANDLE-ERR. IF SOFT-LOCK MOVE "92" TO F-STAT. IF RECORD-LOCKED DISPLAY "* RECORD LOCKED *" LINE 24 ERASE LINE CALL "M$SLEEP" GO TO HANDLE-ERR-EXIT. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF RMS-STS OF FUNDS-FILE IS FAILURE AND NOT = 0 CALL "M$FILERR" USING RMS-STS OF FUNDS-FILE RMS-STV OF FUNDS-FILE F-STAT RMS-FILENAME OF FUNDS-FILE. IF RMS-STS OF PARLAYS-FILE IS FAILURE AND NOT = 0 CALL "M$FILERR" USING RMS-STS OF PARLAYS-FILE RMS-STV OF PARLAYS-FILE F-STAT RMS-FILENAME OF PARLAYS-FILE. IF FILE-NOT-FOUND GO TO HANDLE-ERR-EXIT. DISPLAY " REL-KEY = " GAME-NUMBER WITH CONVERSION. CALL "M$FILERR" USING RMS-STS OF GAMES-FILE RMS-STV OF GAMES-FILE F-STAT RMS-FILENAME OF GAMES-FILE. HANDLE-ERR-EXIT. EXIT. * DATE-FILE-ERR SECTION. USE AFTER ERROR PROCEDURE ON DATE-FILE. DAT-ERR-USE. IF FILE-NOT-FOUND NEXT SENTENCE ELSE CALL "M$FILERR" USING RMS-STS OF DATE-FILE RMS-STV OF DATE-FILE F-STAT RMS-FILENAME OF DATE-FILE. END DECLARATIVES. * MAIN-PROGRAM SECTION. BEGIN-RUN. CALL "M$TERM132". ACCEPT TODAYS-DATE FROM DATE. CALL "M$DATCNV" USING TODAYS-DATE DISP-DATE. MOVE TODAYS-DATE TO TEST-DATE. MOVE TD-YR TO YEAR-NUMBER OF GAMES-FILE-ID. IF TD-MO < 5 SUBTRACT 1 FROM YEAR-NUMBER OF GAMES-FILE-ID. MOVE YEAR-NUMBER OF GAMES-FILE-ID TO YEAR-NUMBER OF FUNDS-FILE-ID YEAR-NUMBER OF PARLAYS-FILE-ID YEAR-NUMBER OF DATE-FILE-ID. * DISPLAY "DECUS SPORTSBAR" LINE 1 ERASE SCREEN "NFL FOOTBALL" COLUMN 34 DISP-DATE COLUMN 82. CALL "LIB$GETJPI" USING JPI-USERNAME OMITTED OMITTED OMITTED BY DESCRIPTOR WS-USERNAME. GO TO OPEN-DATE-FILE. * CREATE-DATE-FILE. OPEN OUTPUT DATE-FILE. DISPLAY "Creating new Game Date File" LINE 4. INPUT-SDATE. DISPLAY "Enter first Sunday Game Date: " LINE 6 ERASE LINE. ACCEPT INPUT-STRING COLUMN PLUS AT END STOP RUN. DISPLAY LOW-VALUES LINE 7 ERASE END SCREEN. CALL "M$DATCHK" USING ERROR-CODE INPUT-STRING TEST-DATE. IF ERROR-CODE NOT = 0 DISPLAY "%Invalid date" LINE 7 GO TO INPUT-SDATE. MOVE SPACES TO INPUT-STRING. CALL "M$WEKDAY" USING TEST-DATE INPUT-STRING. IF INPUT-STRING(1:3) NOT = "Sun" DISPLAY "%Not a Sunday" LINE 7 GO TO INPUT-SDATE. MOVE TEST-DATE TO MIN-DATE. SUBTRACT 100 FROM MIN-DATE. MOVE 0 TO IDX-WK. DTF-LOOP. ADD 1 TO IDX-WK. MOVE TEST-DATE TO CLOS-DATE(IDX-WK). IF IDX-WK = 21 GO TO DTF-DONE. ADD 7 TO TD-DA. CALL "M$DATNCK" USING ERROR-CODE TEST-DATE. IF ERROR-CODE = 0 GO TO DTF-LOOP. MOVE TEST-DATE TO TEST-DATE-2. ADD 1 TO TD-MO. MOVE 1 TO TD-DA. CALL "M$DAYBEF" USING TEST-DATE. SUBTRACT TEST-DATE FROM TEST-DATE-2. ADD 1 TO TD-MO. IF TD-MO > 12 MOVE 1 TO TD-MO ADD 1 TO TD-YR. MOVE TD2-DA TO TD-DA. GO TO DTF-LOOP. DTF-DONE. DISPLAY "Dates computed" LINE 9 ERASE END SCREEN. CALL "M$DATCNV" USING CLOS-DATE(IDX-WK) DISP-DATE. DISPLAY "Is the Super Bowl on" LINE 11 DISP-DATE COLUMN PLUS "?" COLUMN PLUS 0. ACCEPT ANS COLUMN PLUS AT END STOP RUN. IF ANS = "Y" OR "y" GO TO DTF-FINISH. INPUT-SBDATE. DISPLAY "Enter Super Bowl Game Date: " LINE 12 ERASE LINE. ACCEPT INPUT-STRING COLUMN PLUS AT END STOP RUN. DISPLAY LOW-VALUES LINE 13 ERASE END SCREEN. CALL "M$DATCHK" USING ERROR-CODE INPUT-STRING CLOS-DATE(IDX-WK) DISP-DATE TEST-DATE. IF ERROR-CODE NOT = 0 DISPLAY "%Invalid date" LINE 13 GO TO INPUT-SBDATE. DTF-FINISH. MOVE CLOS-DATE(IDX-WK) TO TEST-DATE. ADD 1 TO TD-MO. MOVE TEST-DATE TO MAX-DATE. WRITE DATE-RECORD. CLOSE DATE-FILE. * DISPLAY LOW-VALUES LINE 2 ERASE END SCREEN. OPEN-DATE-FILE. OPEN INPUT DATE-FILE. IF F-STAT NOT = "00" GO TO CREATE-DATE-FILE. READ DATE-FILE. CLOSE DATE-FILE. IF TODAYS-DATE > MAX-DATE GO TO CREATE-DATE-FILE. * * If you want someone other than SYSTEM to also be the MASTER USER, * place their username in the variable OTHER-MASTER IF WS-USERNAME NOT = OTHER-MASTER GO TO CHECK-FOR-MASTER. BECOME-SOMEONE. DISPLAY "Who do you want to be?<" LINE 22 ERASE END SCREEN OTHER-MASTER COLUMN PLUS 0 ">" COLUMN PLUS 0. ACCEPT WS-USERNAME DEFAULT OTHER-MASTER AT END STOP RUN. MOVE 14 TO STR-LEN. CALL "M$CVTUPC" USING STR-LEN WS-USERNAME. DISPLAY WS-USERNAME LINE 23 "OK?" COLUMN PLUS. ACCEPT ANS COLUMN PLUS AT END STOP RUN. IF ANS = "N" OR "n" GO TO BECOME-SOMEONE. * CHECK-FOR-MASTER. IF WS-USERNAME = MASTER-USER GO TO MASTER-CONTROL. OPEN I-O FUNDS-FILE ALLOWING ALL. OPEN I-O PARLAYS-FILE ALLOWING ALL. MOVE WS-USERNAME TO FUNDS-USERNAME. PERFORM READ-FUNDS-FILE. IF FUNDS-YTD-WON = 0 PERFORM GIVE-INSTRUCTIONS. DISPLAY "REMAINING BET:" LINE 1 COLUMN 52. DISPLAY WS-USERNAME LINE 3. MOVE 1000 TO WS-FUNDS-AVAIL. RECOMPUTE-YTD-TOTALS. INITIALIZE FUNDS-YTD. MOVE 0 TO IDX-GM. PERFORM 21 TIMES ADD 1 TO IDX-GM ADD FUNDS-WK-WON(IDX-GM) TO FUNDS-YTD-WON ADD FUNDS-WK-WCNT(IDX-GM) TO FUNDS-YTD-WCNT ADD FUNDS-WK-LCNT(IDX-GM) TO FUNDS-YTD-LCNT ADD FUNDS-WK-TCNT(IDX-GM) TO FUNDS-YTD-TCNT ADD FUNDS-WK-OWCT(IDX-GM) TO FUNDS-YTD-OWCT ADD FUNDS-WK-OLCT(IDX-GM) TO FUNDS-YTD-OLCT ADD FUNDS-WK-OTCT(IDX-GM) TO FUNDS-YTD-OTCT ADD FUNDS-WK-PWCT(IDX-GM) TO FUNDS-YTD-PWCT ADD FUNDS-WK-PLCT(IDX-GM) TO FUNDS-YTD-PLCT END-PERFORM. DISPLAY-BALANCE. MOVE WS-FUNDS-AVAIL TO BET-OUT. DISPLAY BET-OUT LINE 1 COLUMN 68. DISPLAY-YTD. CALL "M$DATCNV" USING FUNDS-DATE DISP-THRU. MOVE FUNDS-YTD-WON TO NET-OUT. DISPLAY "YOU ARE" LINE 4 COLUMN 20 NET-OUT COLUMN PLUS "THRU" COLUMN PLUS DISP-THRU COLUMN PLUS. * GET-OPTION. DISPLAY "PLACE BET(P), REVIEW RESULTS(R), HARDCOPY BETS(H), ? FOR HELP:" LINE 22 ERASE LINE. ACCEPT OPTION COLUMN PLUS AT END GO TO END-JOB. MOVE 1 TO STR-LEN. CALL "M$CVTUPC" USING STR-LEN OPTION. IF OPTION = "?" PERFORM GIVE-INSTRUCTIONS GO TO GET-OPTION. IF OPTION = "P" GO TO PLACE-BETS. IF OPTION = "R" GO TO REVIEW-MODE. IF OPTION = "H" GO TO HARDCOPY-BETS. END-JOB. CALL "M$TERM80". DISPLAY LOW-VALUES LINE 24. STOP RUN. * HARDCOPY-BETS. IF WEEK-NUMBER OF GAMES-FILE-ID IS NUMERIC AND NOT = 0 GO TO HC-START. PERFORM GET-WEEK-NUMBER. IF IDX-WK > 21 MOVE 21 TO IDX-WK GO TO HC-WEEK. IF IDX-WK < 2 MOVE 1 TO IDX-WK GO TO HC-WEEK. HC-GET-WEEK. DISPLAY "Hardcopy Prior Week (P) or Current Week(C): " LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END STOP RUN. IF ANS = "P" OR "p" SUBTRACT 1 FROM IDX-WK GO TO HC-WEEK. IF ANS = "C" OR "c" GO TO HC-WEEK. GO TO HC-GET-WEEK. HC-WEEK. MOVE IDX-WK TO WEEK-NUMBER OF GAMES-FILE-ID WEEK-NUMBER OF OUTPUT-FILE-ID. PERFORM GP17. HC-START. DISPLAY "Print on form:<" LINE 23 FORM-NAME COLUMN PLUS 0 ">" COLUMN PLUS 0. ACCEPT FORM-NAME COLUMN PLUS DEFAULT CURRENT VALUE AT END GO TO GET-OPTION. * OPEN INPUT GAMES-FILE ALLOWING ALL. OPEN OUTPUT OUTPUT-FILE. DISPLAY "Outputting BETTING SLIP to Printer" LINE 23 ERASE LINE. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. STRING "DECUS SPORTSBAR - NFL WEEK " WEEK-NUMBER OF GAMES-FILE-ID " " PLUS-17-ITEM DELIMITED SIZE INTO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. CALL "M$DATCNV" USING TODAYS-DATE DISP-DATE. STRING "BETTING SLIP FOR " WS-USERNAME " AS OF " DISP-DATE DELIMITED SIZE INTO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE "STRAIGHT BETS:" TO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE 0 TO GAME-NUMBER WS-FUNDS-CHECK WS-FUNDS-AVAIL. HC-LOOP. ADD 1 TO GAME-NUMBER. HC-RETRY. READ GAMES-FILE INVALID KEY GO TO HC-DONE. IF RECORD-LOCKED GO TO HC-RETRY. MOVE 1 TO IDX-USR. HC-LOOP2. IF NUMBER-OF-BETTORS < IDX-USR GO TO HC-LOOP. IF WS-USERNAME NOT = BETTOR(IDX-USR) ADD 1 TO IDX-USR GO TO HC-LOOP2. IF BV-AMT(IDX-USR) = 0 AND BH-AMT(IDX-USR) = 0 GO TO HC-BET-POINTS. IF BV-AMT(IDX-USR) NOT = 0 AND BH-AMT(IDX-USR) NOT = 0 GO TO HC-BET-VIS. IF BV-AMT(IDX-USR) NOT = 0 PERFORM HC-BET-VIS ELSE PERFORM HC-BET-HOM. GO TO HC-BET-POINTS. HC-BET-VIS. MOVE SPACES TO OUT-LINE. MOVE "to beat" TO O-VS. IF IDX-USR > 0 MOVE GAME-NUMBER TO O-GAME-NUM. MOVE TEAM-NAME(VTEAM) TO O-TEAM-BET. MOVE SB-VLINE TO O-BET-LINE. MOVE TEAM-NAME(HTEAM) TO O-TEAM-PLAYING. MOVE 13 TO STR-LEN. CALL "M$CVTUPC" USING STR-LEN O-TEAM-PLAYING. IF IDX-USR > 0 MOVE BV-AMT(IDX-USR) TO O-BET-AMT ADD BV-AMT(IDX-USR) TO WS-FUNDS-CHECK. IF DATE-PLAYED < TODAYS-DATE MOVE SCV TO O-SCORE-TEAM MOVE "-" TO O-DASH MOVE SCH TO O-SCORE-OTHER ADD SB-VLINE SCV GIVING PTS-INP IF PTS-INP > SCH MOVE "WON" TO O-RESULT IF IDX-USR > 0 MOVE BV-AMT(IDX-USR) TO O-WON ADD BV-AMT(IDX-USR) TO WS-FUNDS-AVAIL END-IF ELSE IF PTS-INP < SCH MOVE "LOST" TO O-RESULT IF IDX-USR > 0 MULTIPLY -1 BY BV-AMT(IDX-USR) GIVING O-WON SUBTRACT BV-AMT(IDX-USR) FROM WS-FUNDS-AVAIL END-IF ELSE MOVE "PUSH" TO O-RESULT IF IDX-USR > 0 MOVE 0 TO O-WON. PERFORM WR-OUT. HC-BET-HOM. MOVE SPACES TO OUT-LINE. MOVE "to beat" TO O-VS. IF IDX-USR > 0 MOVE GAME-NUMBER TO O-GAME-NUM. MOVE TEAM-NAME(HTEAM) TO O-TEAM-BET. MOVE 13 TO STR-LEN. CALL "M$CVTUPC" USING STR-LEN O-TEAM-BET. MULTIPLY SB-VLINE BY -1 GIVING WS-HLINE. MOVE WS-HLINE TO O-BET-LINE. MOVE TEAM-NAME(VTEAM) TO O-TEAM-PLAYING. IF IDX-USR > 0 MOVE BH-AMT(IDX-USR) TO O-BET-AMT ADD BH-AMT(IDX-USR) TO WS-FUNDS-CHECK. IF DATE-PLAYED < TODAYS-DATE MOVE SCH TO O-SCORE-TEAM MOVE "-" TO O-DASH MOVE SCV TO O-SCORE-OTHER ADD WS-HLINE SCH GIVING PTS-INP IF PTS-INP > SCV MOVE "WON" TO O-RESULT IF IDX-USR > 0 MOVE BH-AMT(IDX-USR) TO O-WON ADD BH-AMT(IDX-USR) TO WS-FUNDS-AVAIL END-IF ELSE IF PTS-INP < SCV MOVE "LOST" TO O-RESULT IF IDX-USR > 0 MULTIPLY -1 BY BH-AMT(IDX-USR) GIVING O-WON SUBTRACT BH-AMT(IDX-USR) FROM WS-FUNDS-AVAIL END-IF ELSE MOVE "PUSH" TO O-RESULT IF IDX-USR > 0 MOVE 0 TO O-WON. PERFORM WR-OUT. HC-BET-BOTH. MOVE " Warning - you have bet both teams in this game" TO OUT-LINE. PERFORM WR-OUT. HC-BET-POINTS. IF BU-AMT(IDX-USR) = 0 AND BO-AMT(IDX-USR) = 0 GO TO HC-LOOP. IF BU-AMT(IDX-USR) NOT = 0 AND BO-AMT(IDX-USR) NOT = 0 GO TO HC-BET-UNDER. IF BU-AMT(IDX-USR) NOT = 0 PERFORM HC-BET-UNDER ELSE PERFORM HC-BET-OVER. GO TO HC-LOOP. HC-BET-UNDER. MOVE SPACES TO OUT-LINE. IF IDX-USR > 0 MOVE GAME-NUMBER TO O-GAME-NUM. MOVE TEAM-NAME(VTEAM) TO O-TEAM-BET. MOVE TEAM-NAME(HTEAM) TO O1-TEAM-PLAYING. MOVE 13 TO STR-LEN. CALL "M$CVTUPC" USING STR-LEN O1-TEAM-PLAYING. MOVE "at" TO O1-PLUS. MOVE " TOTAL <" TO O1-VS. MOVE SB-OUPTS TO O1-BET-LINE. IF IDX-USR > 0 MOVE BU-AMT(IDX-USR) TO O-BET-AMT ADD BU-AMT(IDX-USR) TO WS-FUNDS-CHECK. IF DATE-PLAYED < TODAYS-DATE MOVE SCV TO O-SCORE-TEAM MOVE "+" TO O-DASH MOVE "=" TO O-EQUAL MOVE SCH TO O-SCORE-OTHER ADD SCV SCH GIVING PTS-INP MOVE PTS-INP TO O-PTS-TOT IF SB-OUPTS > PTS-INP MOVE "WON" TO O-RESULT IF IDX-USR > 0 MOVE BU-AMT(IDX-USR) TO O-WON ADD BU-AMT(IDX-USR) TO WS-FUNDS-AVAIL END-IF ELSE IF SB-OUPTS < PTS-INP MOVE "LOST" TO O-RESULT IF IDX-USR > 0 MULTIPLY -1 BY BU-AMT(IDX-USR) GIVING O-WON SUBTRACT BU-AMT(IDX-USR) FROM WS-FUNDS-AVAIL END-IF ELSE MOVE "PUSH" TO O-RESULT IF IDX-USR > 0 MOVE 0 TO O-WON. PERFORM WR-OUT. HC-BET-OVER. MOVE SPACES TO OUT-LINE. IF IDX-USR > 0 MOVE GAME-NUMBER TO O-GAME-NUM. MOVE TEAM-NAME(VTEAM) TO O-TEAM-BET. MOVE TEAM-NAME(HTEAM) TO O1-TEAM-PLAYING. MOVE 13 TO STR-LEN. CALL "M$CVTUPC" USING STR-LEN O1-TEAM-PLAYING. MOVE "at" TO O1-PLUS. MOVE " TOTAL >" TO O1-VS. MOVE SB-OUPTS TO O1-BET-LINE. IF IDX-USR > 0 MOVE BO-AMT(IDX-USR) TO O-BET-AMT ADD BO-AMT(IDX-USR) TO WS-FUNDS-CHECK. IF DATE-PLAYED < TODAYS-DATE MOVE SCV TO O-SCORE-TEAM MOVE "+" TO O-DASH MOVE "=" TO O-EQUAL MOVE SCH TO O-SCORE-OTHER ADD SCV SCH GIVING PTS-INP MOVE PTS-INP TO O-PTS-TOT IF PTS-INP > SB-OUPTS MOVE "WON" TO O-RESULT IF IDX-USR > 0 MOVE BO-AMT(IDX-USR) TO O-WON ADD BO-AMT(IDX-USR) TO WS-FUNDS-AVAIL END-IF ELSE IF PTS-INP < SB-OUPTS MOVE "LOST" TO O-RESULT IF IDX-USR > 0 MULTIPLY -1 BY BO-AMT(IDX-USR) GIVING O-WON SUBTRACT BO-AMT(IDX-USR) FROM WS-FUNDS-AVAIL END-IF ELSE MOVE "PUSH" TO O-RESULT IF IDX-USR > 0 MOVE 0 TO O-WON. PERFORM WR-OUT. HC-BET-BOTH-OU. MOVE " Warning - you have bet both OVER & UNDER in this game" TO OUT-LINE. PERFORM WR-OUT. GO TO HC-LOOP. WR-OUT. CALL "M$PRTLEN" USING REC-DEPEND BY DESCRIPTOR OUT-LINE. WRITE OUT-LINE. ADD 1 TO L-CNT. SKIP-LINE. MOVE 0 TO REC-DEPEND. WRITE OUT-LINE. ADD 1 TO L-CNT. NEW-PAGE. MOVE FORM-FEED TO OUT-LINE(1:1). MOVE 1 TO REC-DEPEND. WRITE OUT-LINE. MOVE 1 TO L-CNT. HC-DONE. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE " TOTAL" TO O-TEAM-PLAYING. MOVE WS-FUNDS-CHECK TO O-BET-AMT. IF WS-FUNDS-AVAIL NOT = 0 MOVE WS-FUNDS-AVAIL TO O-WON. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE " Home team is shown in CAPITAL LETTERS" TO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. PERFORM HARDCOPY-PARLAYS. CLOSE OUTPUT-FILE GAMES-FILE. CALL "LIB$SPAWN" USING BY DESCRIPTOR PRINT-OUT-CMD. GO TO END-JOB. * GET-PARLAY. MOVE WS-USERNAME TO PL-USERNAME FUNDS-USERNAME. MOVE IDX-WK TO PL-WK. PERFORM READ-PARLAY. PERFORM READ-FUNDS-FILE. * READ-PARLAY. READ PARLAYS-FILE INVALID KEY PERFORM INIT-PARLAY. IF RECORD-LOCKED GO TO READ-PARLAY. MOVE PARLAY-RECORD TO FWK-PARLAY-RECORD. INIT-PARLAY. MOVE PARLAY-KEY TO FWKP-KEY. INITIALIZE FWKP-DATA. MOVE FWK-PARLAY-RECORD TO PARLAY-RECORD. WRITE PARLAY-RECORD. REWRITE-PARLAY. MOVE FWK-PARLAY-RECORD TO PARLAY-RECORD. REWRITE PARLAY-RECORD. IF RECORD-LOCKED GO TO REWRITE-PARLAY. READ-FUNDS-FILE. READ FUNDS-FILE INVALID KEY PERFORM NEW-FUNDS-ENTRY. IF RECORD-LOCKED GO TO READ-FUNDS-FILE. NEW-FUNDS-ENTRY. INITIALIZE FUNDS-RECORD. MOVE WS-USERNAME TO FUNDS-USERNAME. MOVE TODAYS-DATE TO FUNDS-DATE. WRITE FUNDS-RECORD. GIVE-INSTRUCTIONS. DISPLAY "WELCOME, PILGRIM!" LINE 3 ERASE END SCREEN. DISPLAY LOW-VALUES. DISPLAY "You have entered the game of NFL FOOTBALL wagering - you are allowed a". DISPLAY "maximum of 1000 ""DECUS Computer Dollars"" per week to bet on games based". DISPLAY "on the Wednesday line. You must bet on Thursday or Friday for the games". DISPLAY "played on the weekend (Thursday day for Thursday night games). Results". DISPLAY "will be posted on Tuesday and the next week entered on Wednesday. Bet". DISPLAY "at least $1 on EVERY game - we will keep track of who guesses best, too.". DISPLAY LOW-VALUES. DISPLAY "To play, you must enter the NUMBER of the team you wish to bet on, and". DISPLAY "then the amount you wish to bet. Visitor information is displayed on the". DISPLAY "left, the game number and date in the center, and home team information". DISPLAY "on the right. Team information is as follows:". DISPLAY " 01 Atlanta 0 +10.5 25 <---- Amount bet(blank if no bet)". DISPLAY " ^ ^ ^ ^ - point spread (added to final score)". DISPLAY " ^ ^ ^ - Final score (will be blank before kickoff)". DISPLAY " ^ ^ - Team Name". DISPLAY " ^ - Team Number". DISPLAY LOW-VALUES. DISPLAY "You can also bet the OVER or UNDER (total points) on any game or parlay". DISPLAY "Press return to continue" LINE 24. ACCEPT ANS COLUMN PLUS AT END STOP RUN. DISPLAY LOW-VALUES LINE 3 ERASE END SCREEN. DISPLAY "You can also bet PARLAYS and TEASERS of 3 to 14 items. These pay very well,". DISPLAY "but require that you win EVERY game bet. A PARLAY will use the actual line". DISPLAY "of each game shown and pays the best. A TEASER will allow your team 6 extra". DISPLAY "points in determining the outcome for a game, or 6 points on Over/Under bets.". DISPLAY " NUMBER OF TEASER PARLAY" LINE 8. DISPLAY " TEAMS BET PAYS PAYS" LINE 9. MOVE 10 TO LINE-NO. MOVE 2 TO IDX-PL. PERFORM UNTIL IDX-PL = 15 ADD 1 TO LINE-NO IDX-PL DISPLAY IDX-PL WITH CONVERSION LINE LINE-NO COLUMN 10 TEASER-PAYS(IDX-PL) WITH CONVERSION COLUMN 21 "TO 1" COLUMN PLUS IF IDX-PL NOT > MAX-PARLAY DISPLAY PARLAY-PAYS(IDX-PL) WITH CONVERSION COLUMN 33 "TO 1" COLUMN PLUS END-IF END-PERFORM. DISPLAY "Press return to start program " LINE 24. ACCEPT ANS COLUMN PLUS AT END STOP RUN. * DISPLAY LOW-VALUES LINE 3 ERASE END SCREEN. REVIEW-MODE. PERFORM GET-WEEK-NUMBER. IF IDX-WK < 2 DISPLAY "NOTHING TO REVIEW" LINE 6 GO TO GET-OPTION. SUBTRACT 1 FROM IDX-WK. MOVE IDX-WK TO IDX-CK. PERFORM GP17. DISPLAY "Week to review (-1 for team) <" LINE 22 ERASE LINE IDX-WK WITH CONVERSION ">" COLUMN PLUS 0. ACCEPT IDX-CK WITH CONVERSION COLUMN PLUS DEFAULT CURRENT VALUE AT END STOP RUN. IF IDX-CK = 0 OR IDX-CK > IDX-WK DISPLAY "NOTHING TO REVIEW" LINE 6 GO TO GET-OPTION. IF IDX-CK = -2 GO TO ANALYSE-GAME. IF IDX-CK < 0 GO TO SHOW-RECORD-BEGIN. MOVE IDX-CK TO IDX-WK. DISPLAY "REVIEW MODE - WEEK" LINE 1 ERASE END SCREEN IDX-WK WITH CONVERSION COLUMN PLUS PLUS-17-ITEM COLUMN PLUS. INITIALIZE WIN-ARRAY(1). PERFORM DISPLAY-GAMES-SCREEN. CLOSE GAMES-FILE. MOVE SPACES TO OUT-LINE-2. MOVE WS-USERNAME TO O2-USER. IF W-AMT(1) NOT < 0 MOVE "WON" TO O2-DID MOVE W-AMT(1) TO O2-AMT ELSE MOVE "LOST" TO O2-DID MULTIPLY -1 BY W-AMT(1) GIVING O2-AMT. MOVE W-WCNT(1) TO O2-WCNT. MOVE "-" TO O2-D1 O2-D2. MOVE W-LCNT(1) TO O2-LCNT. MOVE W-TCNT(1) TO O2-TCNT. COMPUTE O2-WPCT ROUNDED = (W-WCNT(1) + .5 * W-TCNT(1)) / (W-WCNT(1) + W-LCNT(1) + W-TCNT(1)) ON SIZE ERROR MOVE 0 TO O2-WPCT. MOVE W-OWCT(1) TO O21-OWCT. MOVE W-OLCT(1) TO O21-OLCT. MOVE W-OTCT(1) TO O21-OTCT. MOVE "(" TO O22-P1. MOVE ")" TO O22-P2. MOVE "-" TO O21-D1 O21-D2 O22-D1. MOVE W-PWCT(1) TO O22-PWCT. MOVE W-PLCT(1) TO O22-PLCT. DISPLAY OUT-LINE-2 LINE 1 COLUMN 60. RM-DONE. DISPLAY "Press return to continue" LINE 24 ERASE LINE. ACCEPT OPTION COLUMN PLUS AT END STOP RUN. GO TO GET-OPTION. * PLACE-BETS. PERFORM GET-WEEK-NUMBER. IF IDX-WK > 21 DISPLAY "Season is over - see me next season" LINE 6 GO TO GET-OPTION. DISPLAY "PLACE BETS - WEEK " LINE 1 ERASE END SCREEN IDX-WK WITH CONVERSION COLUMN PLUS PLUS-17-ITEM COLUMN PLUS "REMAINING BET:" COLUMN 52. MOVE 1000 TO WS-FUNDS-AVAIL. PERFORM DISPLAY-GAMES-SCREEN. PERFORM DISPLAY-BALANCE. PB-LOOP. DISPLAY "TEAM NUMBER TO BET ON (-1 for Points):" LINE 22 ERASE LINE. ACCEPT IDX-INP WITH CONVERSION COLUMN PLUS CONTROL KEY CONTROL-KEY AT END STOP RUN. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF NOT NORMAL-INPUT PERFORM PB-ANALYSE GO TO PB-LOOP. IF IDX-INP < 0 GO TO PB-POINTS. IF IDX-INP = 0 GO TO PB-DONE. IF IDX-INP > 28 DISPLAY "Invalid team number" LINE 23 GO TO PB-LOOP. MOVE IDX-INP TO IDX-TM. IF WHAT-LINE(IDX-TM) = 0 DISPLAY "THAT TEAM IS OFF THIS WEEK" LINE 23 GO TO PB-LOOP. DISPLAY IDX-TM WITH CONVERSION LINE 22 ERASE END SCREEN TEAM-NAME(IDX-TM) COLUMN PLUS. PROCESS-BET. IF WHAT-LINE(IDX-TM) < 0 MULTIPLY -1 BY WHAT-LINE(IDX-TM) GIVING LINE-NO ELSE MOVE WHAT-LINE(IDX-TM) TO LINE-NO. SUBTRACT 2 FROM LINE-NO GIVING GAME-NUMBER. RETRY-READ-GAMES. READ GAMES-FILE. IF RECORD-LOCKED GO TO RETRY-READ-GAMES. IF DATE-PLAYED < TODAYS-DATE DISPLAY "%Nice try, but that game is over" LINE 23 ERASE LINE GO TO PB-LOOP. PERFORM LOCATE-USER-TO-BET. GET-BET-AMT. DISPLAY "Amount to bet: " LINE 23 ERASE LINE. ACCEPT BET-AMT WITH CONVERSION COLUMN PLUS. DISPLAY LOW-VALUES LINE 24 ERASE LINE. MOVE WS-FUNDS-AVAIL TO WS-FUNDS-CHECK. IF WHAT-LINE(IDX-TM) < 0 ADD BV-AMT(IDX-USR) TO WS-FUNDS-CHECK ELSE ADD BH-AMT(IDX-USR) TO WS-FUNDS-CHECK. IF BET-AMT > WS-FUNDS-CHECK DISPLAY "You don't have that much money left - try again" LINE 24 GO TO GET-BET-AMT. UPDATE-USER-BET. IF WHAT-LINE(IDX-TM) < 0 ADD BV-AMT(IDX-USR) TO WS-FUNDS-AVAIL MOVE BET-AMT TO BV-AMT(IDX-USR) DISPLAY BV-AMT(IDX-USR) WITH CONVERSION LINE LINE-NO COLUMN 26 ELSE ADD BH-AMT(IDX-USR) TO WS-FUNDS-AVAIL MOVE BET-AMT TO BH-AMT(IDX-USR) DISPLAY BH-AMT(IDX-USR) WITH CONVERSION LINE LINE-NO COLUMN 70. IF BH-AMT(IDX-USR) NOT = 0 AND BV-AMT(IDX-USR) NOT = 0 DISPLAY "%Warning - you have bet both teams in this game!" LINE 24 BELL. PB-RECORD. SUBTRACT BET-AMT FROM WS-FUNDS-AVAIL. REWRITE GAME-RECORD. PERFORM DISPLAY-BALANCE. IF ANS = "U" OR "O" NEXT SENTENCE ELSE GO TO PB-LOOP. * PB-POINTS. DISPLAY "Over or Under?(O/U)" LINE 23. ACCEPT ANS COLUMN PLUS CONTROL KEY CONTROL-KEY AT END GO TO PB-POINTS. IF NOT NORMAL-INPUT PERFORM PB-ANALYSE GO TO PB-POINTS. IF ANS = "O" OR "o" MOVE "O" TO ANS ELSE IF ANS = "U" OR "u" MOVE "U" TO ANS ELSE GO TO PB-LOOP. PB-PGAM. DISPLAY "Game number to bet on:" LINE 22 ERASE LINE. ACCEPT IDX-GM WITH CONVERSION COLUMN PLUS. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF IDX-GM < 1 GO TO PB-LOOP. MOVE IDX-GM TO GAME-NUMBER. ADD IDX-GM 2 GIVING LINE-NO. RETRY-2-READ-GAMES. READ GAMES-FILE INVALID KEY DISPLAY "%No such game number" LINE 23 GO TO PB-POINTS. IF RECORD-LOCKED GO TO RETRY-2-READ-GAMES. DISPLAY LOW-VALUES LINE 22 ERASE END SCREEN. PERFORM LOCATE-USER-TO-BET. GET-PBET-AMT. DISPLAY "Amount to bet: " LINE 23 ERASE LINE. ACCEPT BET-AMT WITH CONVERSION COLUMN PLUS. DISPLAY LOW-VALUES LINE 24 ERASE LINE. MOVE WS-FUNDS-AVAIL TO WS-FUNDS-CHECK. IF ANS = "O" ADD BO-AMT(IDX-USR) TO WS-FUNDS-CHECK ELSE ADD BU-AMT(IDX-USR) TO WS-FUNDS-CHECK. IF BET-AMT > WS-FUNDS-CHECK DISPLAY "You don't have that much money left - try again" LINE 24 GO TO GET-PBET-AMT. IF ANS = "O" ADD BO-AMT(IDX-USR) TO WS-FUNDS-AVAIL MOVE BET-AMT TO BO-AMT(IDX-USR) DISPLAY BO-AMT(IDX-USR) WITH CONVERSION LINE LINE-NO COLUMN 111 ELSE ADD BU-AMT(IDX-USR) TO WS-FUNDS-AVAIL MOVE BET-AMT TO BU-AMT(IDX-USR) DISPLAY BU-AMT(IDX-USR) WITH CONVERSION LINE LINE-NO COLUMN 101. IF BO-AMT(IDX-USR) NOT = 0 AND BU-AMT(IDX-USR) NOT = 0 DISPLAY "%Warning - you have bet both ways in this game!" LINE 24 BELL. GO TO PB-RECORD. * PB-DONE. DISPLAY "Do you want to place/revise Parlay/Teaser Bets?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END STOP RUN. IF ANS = "Y" OR "y" GO TO PLACE-PARLAY. CLOSE GAMES-FILE. GO TO GET-OPTION. * SHOW-RECORD-BEGIN. DISPLAY "Season year to use:<" LINE 22 ERASE LINE YEAR-NUMBER OF GAMES-FILE-ID COLUMN PLUS 0 ">" COLUMN PLUS 0. ACCEPT YEAR-NUMBER OF GAMES-FILE-ID COLUMN PLUS DEFAULT CURRENT VALUE. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF YEAR-NUMBER OF GAMES-FILE-ID IS NOT NUMERIC DISPLAY "%Bad value - re-enter" LINE 23 GO TO SHOW-RECORD-BEGIN. SHOW-RECORD-TEAM. PERFORM DISPLAY-TEAMS-SCREEN. DISPLAY "Team number to display:" LINE 22 ERASE LINE. ACCEPT IDX-TM WITH CONVERSION COLUMN PLUS. IF IDX-TM < 1 OR IDX-TM > 28 GO TO GET-OPTION. DISPLAY "DISPLAYING RECORD FOR " LINE 1 ERASE SCREEN IDX-TM WITH CONVERSION COLUMN PLUS TEAM-NAME(IDX-TM) COLUMN PLUS. MOVE 0 TO WEEK-NUMBER OF GAMES-FILE-ID. INITIALIZE WIN-ARRAY(1). SR-FILE-LOOP. ADD 1 TO WEEK-NUMBER OF GAMES-FILE-ID. OPEN INPUT GAMES-FILE. IF FILE-NOT-FOUND GO TO SHOW-RECORD-DONE. ADD 1 WEEK-NUMBER OF GAMES-FILE-ID GIVING LINE-NO. SR-WEEK-LOOP. READ GAMES-FILE NEXT RECORD AT END DISPLAY " ** OFF **" LINE LINE-NO GO TO SR-WK-DONE. IF VTEAM = IDX-TM OR HTEAM = IDX-TM PERFORM SHOW-THIS-GAME ELSE GO TO SR-WEEK-LOOP. SR-WK-DONE. CLOSE GAMES-FILE. GO TO SR-FILE-LOOP. SHOW-THIS-GAME. MOVE SCV TO SCV-OUT. MOVE SCH TO SCH-OUT. ADD SCV SCH GIVING SCT-OUT. IF VTEAM = IDX-TM ADD SCV TO W-OWCT(1) ADD SCH TO W-OLCT(1) DISPLAY TEAM-NAME(VTEAM) LINE LINE-NO SCV-OUT COLUMN PLUS "at" COLUMN PLUS TEAM-NAME(HTEAM) COLUMN PLUS SCH-OUT COLUMN PLUS ELSE ADD SCV TO W-OLCT(1) ADD SCH TO W-OWCT(1) DISPLAY TEAM-NAME(HTEAM) LINE LINE-NO SCH-OUT COLUMN PLUS "HM" COLUMN PLUS TEAM-NAME(VTEAM) COLUMN PLUS SCV-OUT COLUMN PLUS. DISPLAY "(Total" COLUMN PLUS SCT-OUT COLUMN PLUS ")" COLUMN PLUS 0. IF SCV = SCH DISPLAY "TIED" COLUMN PLUS ADD 1 TO W-WCNT(1) ELSE IF VTEAM = IDX-TM IF SCV > SCH DISPLAY "WON " COLUMN PLUS ADD 1 TO W-WCNT(1) ELSE DISPLAY "LOST" COLUMN PLUS ADD 1 TO W-LCNT(1) ELSE IF SCV < SCH DISPLAY "WON " COLUMN PLUS ADD 1 TO W-WCNT(1) ELSE DISPLAY "LOST" COLUMN PLUS ADD 1 TO W-LCNT(1). MOVE W-WCNT(1) TO O2-WCNT. MOVE "-" TO O2-D1 O2-D2. MOVE W-LCNT(1) TO O2-LCNT. MOVE W-TCNT(1) TO O2-TCNT. COMPUTE O2-WPCT ROUNDED = (W-WCNT(1) + 0.5 * W-TCNT(1)) / (W-WCNT(1) + W-LCNT(1) + W-TCNT(1)) ON SIZE ERROR MOVE 0 TO O2-WPCT. DISPLAY O2-RES COLUMN PLUS. ADD 1 TO W-PWCT(1). ADD SCH SCV W-AMT(1) GIVING W-AMT(1). SHOW-RECORD-DONE. MOVE YEAR-NUMBER OF FUNDS-FILE-ID TO YEAR-NUMBER OF GAMES-FILE-ID. IF W-PWCT(1) = 0 GO TO GET-OPTION. ADD 1 TO LINE-NO. DIVIDE W-OWCT(1) BY W-PWCT(1) GIVING O-PTS-LIN ROUNDED. DIVIDE W-OLCT(1) BY W-PWCT(1) GIVING O1-BET-LINE ROUNDED. DIVIDE W-AMT(1) BY W-PWCT(1) GIVING SBP-OUT ROUNDED. DISPLAY "Average" LINE LINE-NO COLUMN 4 O-PTS-LIN COLUMN 15 O1-BET-LINE COLUMN 35 SBP-OUT COLUMN 45. DISPLAY "Press return to continue" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END STOP RUN. GO TO SHOW-RECORD-TEAM. * ANALYSE-GAME. PERFORM DISPLAY-TEAMS-SCREEN. DISPLAY "Visiting Team:" LINE 22 ERASE LINE. ACCEPT IDX-TM WITH CONVERSION COLUMN PLUS. IF IDX-TM < 1 OR IDX-TM > 28 GO TO GET-OPTION. ANAL-GET-HOME. DISPLAY "Home Team:" LINE 23. ACCEPT IDX-PL WITH CONVERSION COLUMN PLUS. IF IDX-PL < 1 OR IDX-PL > 28 GO TO ANAL-GET-HOME. IF IDX-TM = IDX-PL GO TO ANALYSE-GAME. DISPLAY "ANALYSING HISTORY FOR " LINE 3 ERASE END SCREEN IDX-TM WITH CONVERSION COLUMN PLUS TEAM-NAME(IDX-TM) COLUMN PLUS "at" COLUMN PLUS IDX-PL WITH CONVERSION COLUMN PLUS TEAM-NAME(IDX-PL) COLUMN PLUS. PERFORM DO-ANALYSIS. DISPLAY "VAX PROJECTS" LINE 10 TEAM-NAME(IDX-TM) COLUMN PLUS PTSO(1) WITH CONVERSION COLUMN PLUS " " COLUMN PLUS TEAM-NAME(IDX-PL) COLUMN PLUS PTSO(2) WITH CONVERSION COLUMN PLUS " Total: " COLUMN PLUS PTSD(1) WITH CONVERSION COLUMN PLUS. DISPLAY "Press return to continue" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END STOP RUN. GO TO ANALYSE-GAME. * PB-ANALYSE SECTION. PB-ANAL. DISPLAY "Game number to analyse:" LINE 22 ERASE LINE. ACCEPT IDX-GM WITH CONVERSION COLUMN PLUS. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF IDX-GM = 0 GO TO PB-ANAL-DONE. MOVE IDX-GM TO GAME-NUMBER. PB-RET-RG. READ GAMES-FILE INVALID KEY DISPLAY "%Invalid game number" LINE 23 MOVE 0 TO IDX-GM. IF RECORD-LOCKED GO TO PB-RET-RG. MOVE VTEAM TO IDX-TM. MOVE HTEAM TO IDX-PL. CLOSE GAMES-FILE. PERFORM DO-ANALYSIS. DISPLAY "VAX PROJECTS" LINE 23 TEAM-NAME(IDX-TM) COLUMN PLUS PTSO(1) WITH CONVERSION COLUMN PLUS " " COLUMN PLUS TEAM-NAME(IDX-PL) COLUMN PLUS PTSO(2) WITH CONVERSION COLUMN PLUS " Total: " COLUMN PLUS PTSD(1) WITH CONVERSION COLUMN PLUS. PERFORM GET-WEEK-NUMBER. MOVE IDX-WK TO WEEK-NUMBER OF GAMES-FILE-ID. OPEN I-O GAMES-FILE ALLOWING ALL. GO TO PB-ANAL. PB-ANAL-DONE. EXIT. * DO-ANALYSIS SECTION. AN-START. MOVE 0 TO WEEK-NUMBER OF GAMES-FILE-ID. INITIALIZE ANAL-ARRAY. AN-FILE-LOOP. ADD 1 TO WEEK-NUMBER OF GAMES-FILE-ID. IF WEEK-NUMBER OF GAMES-FILE-ID = IDX-WK GO TO ANAL-DONE. OPEN INPUT GAMES-FILE ALLOWING ALL. AN-WEEK-LOOP. READ GAMES-FILE NEXT RECORD AT END GO TO AN-WK-DONE. IF RECORD-LOCKED GO TO AN-WEEK-LOOP. IF VTEAM = IDX-TM ADD SCV SCV PTSO(1) GIVING PTSO(1) ADD SCH SCH PTSD(1) GIVING PTSD(1) ADD 2 TO GMCT(1) ELSE IF HTEAM = IDX-TM ADD SCV TO PTSD(1) ADD SCH TO PTSO(1) ADD 1 TO GMCT(1) ELSE IF VTEAM = IDX-PL ADD SCV TO PTSO(2) ADD SCH TO PTSD(2) ADD 1 TO GMCT(2) ELSE IF HTEAM = IDX-PL ADD SCV SCV PTSD(2) GIVING PTSD(2) ADD SCH SCH PTSO(2) GIVING PTSO(2) ADD 2 TO GMCT(2). GO TO AN-WEEK-LOOP. AN-WK-DONE. CLOSE GAMES-FILE. GO TO AN-FILE-LOOP. ANAL-DONE. DIVIDE PTSO(1) BY GMCT(1) GIVING PTSO(3) ROUNDED. DIVIDE PTSD(1) BY GMCT(1) GIVING PTSD(3) ROUNDED. DIVIDE PTSO(2) BY GMCT(2) GIVING PTSO(4) ROUNDED. DIVIDE PTSD(2) BY GMCT(2) GIVING PTSD(4) ROUNDED. COMPUTE PTSO(1) ROUNDED = (PTSO(3) + PTSD(4)) / 2. COMPUTE PTSO(2) ROUNDED = (PTSD(3) + PTSO(4)) / 2. ADD PTSO(1) PTSO(2) GIVING PTSD(1). ANAL-EXIT. EXIT. * LOCATE-USER-TO-BET SECTION. LOCATE-USER-BET. MOVE 1 TO IDX-USR. IF NUMBER-OF-BETTORS = 0 GO TO NEW-BET. WHAT-BETTOR. IF WS-USERNAME = BETTOR(IDX-USR) GO TO LOCATE-USER-EXIT. ADD 1 TO IDX-USR. IF IDX-USR > NUMBER-OF-BETTORS GO TO NEW-BET. GO TO WHAT-BETTOR. NEW-BET. MOVE IDX-USR TO NUMBER-OF-BETTORS. MOVE WS-USERNAME TO BETTOR(IDX-USR). MOVE 0 TO BV-AMT(IDX-USR) BH-AMT(IDX-USR) BU-AMT(IDX-USR) BO-AMT(IDX-USR) WL-AMT(IDX-USR). LOCATE-USER-EXIT. EXIT. * GET-WEEK-NUMBER SECTION. GWN1. ACCEPT TODAYS-DATE FROM DATE. MOVE 1 TO IDX-WK. GWN2. IF TODAYS-DATE > CLOS-DATE(IDX-WK) ADD 1 TO IDX-WK IF IDX-WK < 21 GO TO GWN2. GP17. IF IDX-WK > 17 MOVE PLUS-17(IDX-WK - 17) TO PLUS-17-ITEM ELSE MOVE "REGULAR SEASON" TO PLUS-17-ITEM. GWN-EXIT. EXIT. * DISPLAY-GAMES-SCREEN SECTION. DGS1. MOVE IDX-WK TO WEEK-NUMBER OF GAMES-FILE-ID WEEK-NUMBER OF OUTPUT-FILE-ID. IF WS-USERNAME = MASTER-USER OPEN I-O GAMES-FILE ELSE OPEN I-O GAMES-FILE ALLOWING ALL. DISPLAY LOW-VALUES LINE 2 ERASE END SCREEN "VISITOR" COLUMN 10 "GAME DATE" COLUMN 33 "HOME" COLUMN 54 "GAME POINTS TOTAL" COLUMN 76 "UNDER(v)" COLUMN 102 "OVER(^)" COLUMN 113. DISPLAY LOW-VALUES LINE 3. MOVE 2 TO LINE-NO. INITIALIZE WHERE-AT-ARRAY. INITIALIZE WIN-ARRAY(1). DGS-LOOP. READ GAMES-FILE NEXT AT END GO TO DGS-DONE. IF RECORD-LOCKED GO TO DGS-LOOP. ADD 1 TO LINE-NO. MULTIPLY -1 BY LINE-NO GIVING WHAT-LINE(VTEAM). MOVE LINE-NO TO WHAT-LINE(HTEAM). PERFORM DISPLAY-GAME-LINE. PERFORM LOCATE-USR-BET. IF IDX-USR = 0 GO TO DGS-LOOP. GO TO DGS-SH-BETS. * DISPLAY-GAME-LINE. MOVE SB-VLINE TO SBV-OUT. MULTIPLY SB-VLINE BY -1 GIVING SBH-OUT. MOVE SB-OUPTS TO SBP-OUT. CALL "M$DATCNV" USING DATE-PLAYED DISP-DATE. IF DATE-PLAYED < TODAYS-DATE MOVE SCV TO SCV-OUT MOVE SCH TO SCH-OUT ADD SCV SCH GIVING PTS-INP MOVE PTS-INP TO SCT-OUT IF PTS-INP > SB-OUPTS MOVE "^" TO SCT-RES ELSE IF PTS-INP < SB-OUPTS MOVE "v" TO SCT-RES ELSE MOVE "-" TO SCT-RES ELSE MOVE SPACES TO SCORE-OUT. DISPLAY VTEAM LINE LINE-NO TEAM-NAME(VTEAM) COLUMN PLUS SCV-OUT COLUMN PLUS SBV-OUT COLUMN PLUS GAME-NUMBER WITH CONVERSION COLUMN 33 DISP-DATE COLUMN PLUS HTEAM COLUMN PLUS TEAM-NAME(HTEAM) COLUMN PLUS SCH-OUT COLUMN PLUS SBH-OUT COLUMN PLUS GAME-NUMBER WITH CONVERSION COLUMN 78 SBP-OUT COLUMN PLUS SCT-OUT COLUMN 90 SCT-RES COLUMN PLUS. * LOCATE-USR-BET. IF NUMBER-OF-BETTORS = 0 MOVE 0 TO IDX-USR ELSE MOVE 1 TO IDX-USR PERFORM LOC-USR-BET-2. LOC-USR-BET-2. IF WS-USERNAME NOT = BETTOR(IDX-USR) ADD 1 TO IDX-USR IF IDX-USR > NUMBER-OF-BETTORS MOVE 0 TO IDX-USR ELSE GO TO LOC-USR-BET-2. * DGS-SH-BETS. IF BV-AMT(IDX-USR) NOT = 0 SUBTRACT BV-AMT(IDX-USR) FROM WS-FUNDS-AVAIL DISPLAY BV-AMT(IDX-USR) WITH CONVERSION COLUMN 26 IF OPTION = "R" AND DATE-PLAYED < TODAYS-DATE ADD SCV SB-VLINE GIVING PTS-INP IF PTS-INP < SCH DISPLAY "L" COLUMN 31 ADD 1 TO W-LCNT(1) SUBTRACT BV-AMT(IDX-USR) FROM W-AMT(1) ELSE IF PTS-INP = SCH DISPLAY "T" COLUMN 31 ADD 1 TO W-TCNT(1) ELSE ADD 1 TO W-WCNT(1) ADD BV-AMT(IDX-USR) TO W-AMT(1) DISPLAY "W" COLUMN 31. IF BH-AMT(IDX-USR) NOT = 0 SUBTRACT BH-AMT(IDX-USR) FROM WS-FUNDS-AVAIL DISPLAY BH-AMT(IDX-USR) WITH CONVERSION COLUMN 70 IF OPTION = "R" AND DATE-PLAYED < TODAYS-DATE SUBTRACT SB-VLINE FROM SCH GIVING PTS-INP IF PTS-INP < SCV DISPLAY "L" COLUMN 75 SUBTRACT BH-AMT(IDX-USR) FROM W-AMT(1) ADD 1 TO W-LCNT(1) ELSE IF PTS-INP = SCV DISPLAY "T" COLUMN 75 ADD 1 TO W-TCNT(1) ELSE ADD BH-AMT(IDX-USR) TO W-AMT(1) ADD 1 TO W-WCNT(1) DISPLAY "W" COLUMN 75. IF BU-AMT(IDX-USR) NOT = 0 SUBTRACT BU-AMT(IDX-USR) FROM WS-FUNDS-AVAIL DISPLAY BU-AMT(IDX-USR) WITH CONVERSION COLUMN 101 IF OPTION = "R" AND DATE-PLAYED < TODAYS-DATE ADD SCV SCH GIVING PTS-INP IF PTS-INP > SB-OUPTS DISPLAY "L" COLUMN 108 ADD 1 TO W-OLCT(1) SUBTRACT BU-AMT(IDX-USR) FROM W-AMT(1) ELSE IF PTS-INP = SB-OUPTS DISPLAY "T" COLUMN 108 ADD 1 TO W-OTCT(1) ELSE ADD 1 TO W-OWCT(1) ADD BU-AMT(IDX-USR) TO W-AMT(1) DISPLAY "W" COLUMN 108. IF BO-AMT(IDX-USR) NOT = 0 SUBTRACT BO-AMT(IDX-USR) FROM WS-FUNDS-AVAIL DISPLAY BO-AMT(IDX-USR) WITH CONVERSION COLUMN 111 IF OPTION = "R" AND DATE-PLAYED < TODAYS-DATE ADD SCV SCH GIVING PTS-INP IF PTS-INP < SB-OUPTS DISPLAY "L" COLUMN 118 ADD 1 TO W-OLCT(1) SUBTRACT BO-AMT(IDX-USR) FROM W-AMT(1) ELSE IF PTS-INP = SB-OUPTS DISPLAY "T" COLUMN 118 ADD 1 TO W-OTCT(1) ELSE ADD 1 TO W-OWCT(1) ADD BO-AMT(IDX-USR) TO W-AMT(1) DISPLAY "W" COLUMN 118. GO TO DGS-LOOP. DGS-DONE. MOVE LINE-NO TO FIXED-PARLAY-OFFSET. IF WS-USERNAME = MASTER-USER GO TO DGS-EXIT. IF W-AMT(1) NOT = 0 DISPLAY W-AMT(1) WITH CONVERSION LINE LINE-NO COLUMN 111. MOVE WS-FUNDS-AVAIL TO WS-FUNDS-CHECK. PERFORM GET-PARLAY. PERFORM DISPLAY-PARLAYS-BET. DGS-EXIT. EXIT. * MASTER-CONTROL-PROGRAM SECTION. MASTER-CONTROL. DISPLAY "MASTER CONTROL INVOKED" LINE 3. PERFORM GET-WEEK-NUMBER. MC-GET-OPTION. DISPLAY "(C)reate new week, (E)nter Results, or (U)pdate: " LINE 22 ERASE LINE. ACCEPT OPTION COLUMN PLUS AT END STOP RUN. IF OPTION = "C" OR "c" GO TO MC-NEW-WEEK. IF OPTION = "E" OR "e" GO TO ME-ENTER-RESULTS. IF OPTION = "U" OR "u" GO TO MUP-INIT-UPDATE. GO TO MC-GET-OPTION. MUP-INIT-UPDATE. IF IDX-WK > 1 SUBTRACT 1 FROM IDX-WK. DISPLAY "Enter week number to UPDATE:<" LINE 22 ERASE LINE IDX-WK WITH CONVERSION ">" COLUMN PLUS 0. ACCEPT IDX-WK WITH CONVERSION COLUMN PLUS DEFAULT CURRENT VALUE AT END STOP RUN. IF IDX-WK = 0 OR IDX-WK > 21 GO TO MUP-INIT-UPDATE. MOVE IDX-WK TO WEEK-NUMBER OF GAMES-FILE-ID WEEK-NUMBER OF OUTPUT-FILE-ID. OPEN I-O GAMES-FILE. READ GAMES-FILE NEXT AT END DISPLAY "No data available for that week" LINE 23 GO TO MC-GET-OPTION. CLOSE GAMES-FILE. DISPLAY "ENTER DATA - WEEK " LINE 5 ERASE END SCREEN IDX-WK WITH CONVERSION COLUMN PLUS. PERFORM DISPLAY-GAMES-SCREEN. CLOSE GAMES-FILE. GO TO MR-DO-FUNDS-UPDATE. * MC-NEW-WEEK. DISPLAY "Enter week number to create:<" LINE 22 ERASE LINE IDX-WK WITH CONVERSION ">" COLUMN PLUS 0. ACCEPT IDX-WK WITH CONVERSION COLUMN PLUS DEFAULT CURRENT VALUE AT END STOP RUN. IF IDX-WK = 0 OR IDX-WK > 21 GO TO MC-NEW-WEEK. MOVE CLOS-DATE(IDX-WK) TO TEST-DATE. CALL "M$DATCNV" USING TEST-DATE DISP-DATE. DISPLAY "Enter data for week" LINE 23 IDX-WK WITH CONVERSION COLUMN PLUS DISP-DATE COLUMN PLUS "?" COLUMN PLUS 0. ACCEPT ANS COLUMN PLUS DEFAULT "Y" AT END STOP RUN. IF ANS = "N" OR "n" GO TO MC-NEW-WEEK. MOVE IDX-WK TO WEEK-NUMBER OF GAMES-FILE-ID. OPEN INPUT GAMES-FILE. IF FILE-NOT-FOUND DISPLAY "Creating new file via NFL$LOC:BETS.FDL" LINE 23 CALL "LIB$SPAWN" USING BY DESCRIPTOR CREATE-GAMES-FILE-CMD ELSE CLOSE GAMES-FILE. MC-CONT. OPEN I-O GAMES-FILE. READ GAMES-FILE NEXT AT END GO TO MC-OK-NEW. CLOSE GAMES-FILE. PERFORM DISPLAY-GAMES-SCREEN. DISPLAY "Is this the data you want to change?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS DEFAULT "Y" AT END STOP RUN. IF ANS = "N" OR "n" CLOSE GAMES-FILE GO TO MC-NEW-WEEK. GO TO MC-CHANGE-MODE. DISPLAY-TEAMS-SCREEN. DISPLAY LOW-VALUES LINE 3 ERASE END SCREEN. MOVE 1 TO IDX-TM. MOVE 15 TO IDX-USR. MOVE 3 TO LINE-NO. PERFORM MC-DT-LOOP. MC-DT-LOOP. DISPLAY IDX-TM WITH CONVERSION LINE LINE-NO TEAM-NAME(IDX-TM) COLUMN 4 IDX-USR WITH CONVERSION COLUMN 41 TEAM-NAME(IDX-USR) COLUMN 44. ADD 1 TO LINE-NO IDX-TM IDX-USR. IF IDX-TM < 15 GO TO MC-DT-LOOP. * MC-OK-NEW. PERFORM DISPLAY-TEAMS-SCREEN. MOVE 1 TO GAME-NUMBER. MOVE "Y" TO OPTION. INITIALIZE WHERE-AT-ARRAY. MC-ADD-LOOP. DISPLAY "Enter Visitor Team #:" LINE 22 ERASE LINE. ACCEPT IDX-TM WITH CONVERSION COLUMN PLUS. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF IDX-TM = 0 GO TO MC-CHECK-DONE. IF IDX-TM < 1 OR IDX-TM > 28 DISPLAY "%Bad team number - re-enter" LINE 23 GO TO MC-ADD-LOOP. IF WHAT-LINE(IDX-TM) NOT = 0 DISPLAY "%This team already entered" LINE 23 GO TO MC-ADD-LOOP. GO TO MC-GET-HOME. MC-CHECK-DONE. DISPLAY "All done?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS DEFAULT "Y" AT END STOP RUN. IF ANS = "Y" OR "y" GO TO MC-ADD-DONE. GO TO MC-ADD-LOOP. MC-GET-HOME. DISPLAY "Enter Home Team #: " LINE 22 ERASE LINE. ACCEPT IDX-USR WITH CONVERSION COLUMN PLUS. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF IDX-USR = IDX-TM DISPLAY "%Can't play themselves" LINE 23 GO TO MC-GET-HOME. IF IDX-USR < 1 OR IDX-USR > 28 DISPLAY "%Bad team number - re-enter" LINE 23 GO TO MC-GET-HOME. IF WHAT-LINE(IDX-USR) NOT = 0 DISPLAY "%This team already entered" LINE 23 GO TO MC-GET-HOME. * DISPLAY IDX-TM WITH CONVERSION LINE 21 ERASE END SCREEN TEAM-NAME(IDX-TM) COLUMN PLUS "at" COLUMN PLUS IDX-USR WITH CONVERSION COLUMN PLUS TEAM-NAME(IDX-USR) COLUMN PLUS DISPLAY "OK?" LINE 22. ACCEPT ANS COLUMN PLUS DEFAULT "Y" AT END STOP RUN. IF ANS = "N" OR "n" DISPLAY LOW-VALUES LINE 21 ERASE END SCREEN GO TO MC-ADD-LOOP. * MOVE IDX-TM TO VTEAM. MOVE IDX-USR TO HTEAM. MOVE 0 TO SCV SCH SB-VLINE SB-OUPTS NUMBER-OF-BETTORS. MC-DATE-PLAYED. DISPLAY "Date played?<" LINE 22 ERASE LINE DISP-DATE COLUMN PLUS 0 ">" COLUMN PLUS 0. ACCEPT DISP-DATE COLUMN PLUS DEFAULT CURRENT VALUE AT END GO TO MC-DATE-PLAYED. CALL "M$DATCHK" USING ERROR-CODE DISP-DATE DATE-PLAYED DISP-DATE MIN-DATE MAX-DATE. IF ERROR-CODE NOT = 0 DISPLAY "%Invalid date - re-enter" LINE 23 GO TO MC-DATE-PLAYED. DISPLAY "Point spread available?<" LINE 23 ERASE LINE OPTION COLUMN PLUS 0 ">" COLUMN PLUS 0. ACCEPT OPTION COLUMN PLUS DEFAULT CURRENT VALUE AT END GO TO MC-DATE-PLAYED. IF OPTION = "N" OR "n" ADD 1 TO IDX-WK GO TO MC-WRITE-GAME. MOVE "Y" TO OPTION. DISPLAY "Visitor points: " LINE 23 ERASE LINE. ACCEPT PTS-INP WITH CONVERSION COLUMN PLUS. MOVE PTS-INP TO SB-VLINE SBV-OUT. DISPLAY "OVER/UNDER points:" LINE 24. ACCEPT PTS-INP WITH CONVERSION COLUMN PLUS DEFAULT CURRENT VALUE. MOVE PTS-INP TO SB-OUPTS SBP-OUT. DISPLAY LOW-VALUES LINE 22 ERASE END SCREEN SBV-OUT COLUMN 4 SBP-OUT COLUMN 44. MC-WRITE-GAME. DISPLAY "ALL OK?" LINE 23 ERASE END SCREEN. ACCEPT ANS COLUMN PLUS AT END GO TO MC-WRITE-GAME. IF ANS = "N" OR "n" GO TO MC-ADD-LOOP. MOVE GAME-NUMBER TO WHAT-LINE(IDX-TM) WHAT-LINE(IDX-USR). WRITE GAME-RECORD. ADD 1 TO GAME-NUMBER. IF GAME-NUMBER NOT > 14 GO TO MC-ADD-LOOP. MC-ADD-DONE. CLOSE GAMES-FILE. DISPLAY "ENTER DATA - WEEK " LINE 5 ERASE END SCREEN IDX-WK WITH CONVERSION COLUMN PLUS. PERFORM DISPLAY-GAMES-SCREEN. MC-CHANGE-MODE. DISPLAY "Game number to change?" LINE 22 ERASE LINE. ACCEPT SCR-INP WITH CONVERSION COLUMN PLUS AT END MOVE 0 TO SCR-INP. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF SCR-INP = 0 GO TO MC-ALL-DONE. IF SCR-INP < 1 OR SCR-INP > 14 DISPLAY "%Invalid game number - re-enter" LINE 23 GO TO MC-CHANGE-MODE. MOVE SCR-INP TO GAME-NUMBER. READ GAMES-FILE INVALID KEY GO TO MC-MAYBE-ADD. GO TO MC-GET-LIN-NO. MC-MAYBE-ADD. DISPLAY "Game number not in file - add?" LINE 23. ACCEPT ANS COLUMN PLUS AT END STOP RUN. IF ANS = "N" OR "n" GO TO MC-CHANGE-MODE. MOVE "Y" TO OPTION. GO TO MC-ADD-LOOP. MC-GET-LIN-NO. ADD 2 GAME-NUMBER GIVING LINE-NO. MC-GET-FTC. PERFORM DISPLAY-GAME-LINE. DISPLAY "Change: Visitor(V), Home(H), V-LINE(1), Points(2), Date(D):" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END GO TO MC-CHANGE-MODE. IF ANS = " " REWRITE GAME-RECORD GO TO MC-CHANGE-MODE. IF ANS = "V" OR "v" GO TO MC1-CHG-VIS. IF ANS = "H" OR "h" GO TO MC1-CHG-HOM. IF ANS = "D" OR "d" CALL "M$DATCNV" USING DATE-PLAYED DISP-DATE GO TO MC1-CHG-DAT. IF ANS = "1" GO TO MC1-CHG-VL. IF ANS = "2" MOVE SB-OUPTS TO PTS-INP GO TO MC1-CHG-HL. GO TO MC-GET-FTC. MC1-CHG-VIS. DISPLAY "Visitors team: " LINE 22 ERASE LINE. ACCEPT SCR-INP WITH CONVERSION COLUMN PLUS. PERFORM MC2-VFY-INP. IF SCR-INP = 0 GO TO MC1-CHG-VIS. MOVE 0 TO WHAT-LINE(VTEAM). MOVE SCR-INP TO VTEAM. MULTIPLY -1 BY LINE-NO GIVING WHAT-LINE(VTEAM). GO TO MC-GET-FTC. MC2-VFY-INP. DISPLAY LOW-VALUES LINE 23 ERASE LINE. IF SCR-INP < 1 OR SCR-INP > 28 MOVE 0 TO SCR-INP DISPLAY "%Bad value for team" LINE 23 ELSE IF WHAT-LINE(SCR-INP) NOT = 0 MOVE 0 TO SCR-INP DISPLAY "%Team already listed for another game" LINE 23. MC1-CHG-HOM. DISPLAY "Home team: " LINE 22 ERASE LINE. ACCEPT SCR-INP WITH CONVERSION COLUMN PLUS. PERFORM MC2-VFY-INP. IF SCR-INP = 0 GO TO MC1-CHG-VIS. MOVE 0 TO WHAT-LINE(HTEAM). MOVE SCR-INP TO HTEAM. MOVE LINE-NO TO WHAT-LINE(HTEAM). GO TO MC-GET-FTC. MC1-CHG-VL. DISPLAY "Visitors Line: " LINE 22 ERASE LINE. ACCEPT PTS-INP WITH CONVERSION COLUMN PLUS. MOVE PTS-INP TO SB-VLINE. GO TO MC-GET-FTC. MC1-CHG-HL. DISPLAY "OVER/UNDER Points:" LINE 22 ERASE LINE. ACCEPT PTS-INP WITH CONVERSION COLUMN PLUS. MOVE PTS-INP TO SB-OUPTS. GO TO MC-GET-FTC. MC1-CHG-DAT. DISPLAY "Date played?<" LINE 22 ERASE LINE DISP-DATE COLUMN PLUS 0 ">" COLUMN PLUS 0. ACCEPT DISP-DATE COLUMN PLUS DEFAULT CURRENT VALUE AT END GO TO MC-GET-FTC. CALL "M$DATCHK" USING ERROR-CODE DISP-DATE DATE-PLAYED DISP-DATE MIN-DATE MAX-DATE. IF ERROR-CODE NOT = 0 DISPLAY "%Invalid date - re-enter" LINE 23 GO TO MC1-CHG-DAT. GO TO MC-GET-FTC. MC-ALL-DONE. CLOSE GAMES-FILE. GO TO END-JOB. * ME-ENTER-RESULTS. IF IDX-WK > 1 SUBTRACT 1 FROM IDX-WK. ME-NEW-WEEK. DISPLAY "Enter week number to UPDATE:<" LINE 22 ERASE LINE IDX-WK WITH CONVERSION ">" COLUMN PLUS 0. ACCEPT IDX-WK WITH CONVERSION COLUMN PLUS DEFAULT CURRENT VALUE AT END STOP RUN. IF IDX-WK = 0 OR IDX-WK > 21 GO TO ME-NEW-WEEK. MOVE CLOS-DATE(IDX-WK) TO TEST-DATE. CALL "M$DATCNV" USING TEST-DATE DISP-DATE. DISPLAY "Enter data for week" LINE 23 ERASE LINE IDX-WK WITH CONVERSION COLUMN PLUS DISP-DATE COLUMN PLUS "?" COLUMN PLUS 0. ACCEPT ANS COLUMN PLUS DEFAULT "Y" AT END STOP RUN. IF ANS = "N" OR "n" GO TO ME-NEW-WEEK. MOVE IDX-WK TO WEEK-NUMBER OF GAMES-FILE-ID. OPEN I-O GAMES-FILE. READ GAMES-FILE NEXT AT END DISPLAY "No data available for that week" LINE 23 GO TO MC-GET-OPTION. CLOSE GAMES-FILE. DISPLAY "ENTER DATA - WEEK " LINE 5 ERASE END SCREEN IDX-WK WITH CONVERSION COLUMN PLUS. PERFORM DISPLAY-GAMES-SCREEN. MOVE 0 TO GAME-NUMBER. MR-LOOP. ADD 1 TO GAME-NUMBER. READ GAMES-FILE INVALID KEY GO TO MR-GET-FTS. ADD GAME-NUMBER 2 GIVING LINE-NO. IF OUTCOME NOT = "0000" GO TO MR-GET-FTS. PERFORM MR-UPDATE-SCORE-FOR-GAME. GO TO MR-LOOP. MR-GET-FTS. DISPLAY "UPDATE COMPLETE - ALL OK?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END MOVE "N" TO ANS. IF ANS = "N" OR "n" GO TO MR-GET-GAM. CLOSE GAMES-FILE. DISPLAY "DO YOU WANT NOW TO UPDATE THE FUNDS FILE?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END MOVE "N" TO ANS. IF ANS = "N" OR "n" STOP RUN. MR-DO-FUNDS-UPDATE. DISPLAY "Reporting results to output file for week " LINE 23 IDX-WK WITH CONVERSION. OPEN OUTPUT OUTPUT-FILE. PERFORM MU-REPORT-FINALS. PERFORM COMPUTE-YTD-STAND. CLOSE OUTPUT-FILE GAMES-FILE PARLAYS-FILE FUNDS-FILE. CALL "LIB$SPAWN" USING BY DESCRIPTOR PRINT-OUT-CMD. GO TO END-JOB. MR-GET-GAM. DISPLAY "Enter game number to change: " LINE 22 ERASE LINE. ACCEPT SCR-INP WITH CONVERSION COLUMN PLUS DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF SCR-INP = 0 GO TO MR-GET-FTS. IF SCR-INP < 1 OR SCR-INP > 14 DISPLAY "%Invalid game number - re-enter" LINE 23 GO TO MR-GET-GAM. MOVE SCR-INP TO GAME-NUMBER. READ GAMES-FILE INVALID KEY DISPLAY "%Invalid game number - re-enter" LINE 23 GO TO MR-GET-GAM. PERFORM MR-UPDATE-SCORE-FOR-GAME. GO TO MR-GET-FTS. * MR-UPDATE-SCORE-FOR-GAME SECTION. MR-GET-SCV. DISPLAY "SCORE FOR" LINE 22 ERASE LINE TEAM-NAME(VTEAM) COLUMN PLUS ":" COLUMN PLUS. ACCEPT SCR-INP WITH CONVERSION COLUMN PLUS. MOVE SCR-INP TO SCV. MR-GET-SCH. DISPLAY "SCORE FOR" LINE 23 ERASE LINE TEAM-NAME(HTEAM) COLUMN PLUS ":" COLUMN PLUS. ACCEPT SCR-INP WITH CONVERSION COLUMN PLUS. MOVE SCR-INP TO SCH. MR-UPDATE-GAME. PERFORM DISPLAY-GAME-LINE. DISPLAY "OK?" LINE 24 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END MOVE "N" TO ANS. IF ANS = "N" OR "n" GO TO MR-GET-SCV. MOVE 1 TO IDX-USR. MU-LOOP. IF IDX-USR > NUMBER-OF-BETTORS GO TO MU-DONE. MOVE 0 TO WL-AMT(IDX-USR). IF BV-AMT(IDX-USR) NOT = 0 ADD SCV SB-VLINE GIVING PTS-INP IF PTS-INP > SCH ADD BV-AMT(IDX-USR) TO WL-AMT(IDX-USR) ELSE IF PTS-INP < SCH SUBTRACT BV-AMT(IDX-USR) FROM WL-AMT(IDX-USR). IF BH-AMT(IDX-USR) NOT = 0 SUBTRACT SB-VLINE FROM SCH GIVING PTS-INP IF PTS-INP > SCV ADD BH-AMT(IDX-USR) TO WL-AMT(IDX-USR) ELSE IF PTS-INP < SCV SUBTRACT BH-AMT(IDX-USR) FROM WL-AMT(IDX-USR). IF BU-AMT(IDX-USR) NOT = 0 ADD SCV SCH GIVING PTS-INP IF PTS-INP < SB-OUPTS ADD BU-AMT(IDX-USR) TO WL-AMT(IDX-USR) ELSE IF PTS-INP > SB-OUPTS SUBTRACT BU-AMT(IDX-USR) FROM WL-AMT(IDX-USR). IF BO-AMT(IDX-USR) NOT = 0 ADD SCV SCH GIVING PTS-INP IF PTS-INP > SB-OUPTS ADD BO-AMT(IDX-USR) TO WL-AMT(IDX-USR) ELSE IF PTS-INP < SB-OUPTS SUBTRACT BO-AMT(IDX-USR) FROM WL-AMT(IDX-USR). ADD 1 TO IDX-USR. GO TO MU-LOOP. MU-DONE. REWRITE GAME-RECORD. DISPLAY LOW-VALUES LINE 22 ERASE END SCREEN. MR-UPDATE-GAME-EXIT. EXIT. * MU-REPORT-FINALS SECTION. MUR-1. PERFORM OUTPUT-FINAL-SCORES. PERFORM NEW-PAGE. MOVE 0 TO L-CNT. OPEN INPUT GAMES-FILE. OPEN I-O FUNDS-FILE PARLAYS-FILE. PERFORM MUP-ALL-PARLAYS. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE WEEK-NUMBER OF GAMES-FILE-ID TO SCV-OUT. STRING "DECUS SPORTSBAR - FINAL RESULTS - NFL WEEK " SCV-OUT DELIMITED SIZE INTO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE " WINNING teams (after point spread) are in CAPITAL LETTERS" TO OUT-LINE. PERFORM WR-OUT. PERFORM SKIP-LINE. MOVE " TOTAL GAME POINTS" TO OUT-LINE. PERFORM WR-OUT. * MOVE 0 TO GAME-NUMBER. MOVE SPACES TO W-USER(1). MUR-LOOP. ADD 1 TO GAME-NUMBER. READ GAMES-FILE INVALID KEY GO TO MUR-DONE. PERFORM MUR-WR-GAME-LINE. PERFORM FINALIZE-INDIV-BETS. GO TO MUR-LOOP. * MUR-WR-GAME-LINE. IF (L-CNT + NUMBER-OF-BETTORS) > 60 PERFORM NEW-PAGE. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE " at " TO O-VS. MOVE GAME-NUMBER TO O-GAME-NUM. MOVE TEAM-NAME(VTEAM) TO O-TEAM-BET. MOVE SB-VLINE TO O-BET-LINE. MOVE TEAM-NAME(HTEAM) TO O-TEAM-PLAYING. SUBTRACT SB-VLINE FROM SCH GIVING PTS-INP. MOVE 13 TO STR-LEN. IF PTS-INP > SCV CALL "M$CVTUPC" USING STR-LEN O-TEAM-PLAYING ELSE IF PTS-INP < SCV CALL "M$CVTUPC" USING STR-LEN O-TEAM-BET. MOVE SB-OUPTS TO O-PTS-LIN. MOVE SCV TO O-SCORE-TEAM. MOVE "-" TO O-DASH. MOVE SCH TO O-SCORE-OTHER. ADD SCV SCH GIVING PTS-INP. MOVE PTS-INP TO O-PTS-TOT. IF SB-OUPTS > PTS-INP MOVE "UNDER" TO O-RESULT ELSE IF SB-OUPTS < PTS-INP MOVE "OVER" TO O-RESULT ELSE MOVE "PUSH" TO O-RESULT. PERFORM WR-OUT. * MUR-DONE. MOVE 0 TO IDX-USR. MUR-LOOP2. ADD 1 TO IDX-USR. IF W-USER(IDX-USR) = SPACES GO TO MUR-DONE-2. MOVE W-USER(IDX-USR) TO PL-USERNAME. MOVE IDX-WK TO PL-WK. READ PARLAYS-FILE INVALID KEY DISPLAY "%MISSING PARLAY ON " PARLAY-KEY STOP RUN. ADD PL-TOT-AMT TO W-AMT(IDX-USR). MOVE 1 TO IDX-PL. MUR-LOOP3. IF IDX-PL > PL-NUM-PARLAYS GO TO MUR-LOOP2. IF PL-WL(IDX-PL) = "W" ADD 1 TO W-PWCT(IDX-USR) ELSE ADD 1 TO W-PLCT(IDX-USR). ADD 1 TO IDX-PL. GO TO MUR-LOOP3. MUR-DONE-2. PERFORM OUTPUT-ALL-PARLAYS. MOVE 20 TO IDX-MAX. INITIALIZE WIN-ARRAY(IDX-MAX). PERFORM NEW-PAGE. MOVE "SUMMARY TOTALS FOR THIS WEEK" TO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE W-AMT(1) TO WS-FUNDS-CHECK. MOVE 1 TO IDX-USR IDX-TM. MUS-LOOP. ADD 1 TO IDX-TM. IF W-USER(IDX-TM) = SPACES GO TO MUS-DONE-1. IF W-USER(IDX-TM) = "Z>" GO TO MUS-LOOP. IF W-AMT(IDX-TM) > WS-FUNDS-CHECK MOVE W-AMT(IDX-TM) TO WS-FUNDS-CHECK MOVE IDX-TM TO IDX-USR. GO TO MUS-LOOP. MUS-DONE-1. IF WS-FUNDS-CHECK = -9999999 GO TO MUS-ALL-DONE. PERFORM MUS-DONE-2. MOVE W-USER(IDX-USR) TO FUNDS-USERNAME. READ FUNDS-FILE. MOVE TODAYS-DATE TO FUNDS-DATE. INITIALIZE FUNDS-ARRAY(IDX-WK). PERFORM RECOMPUTE-YTD-TOTALS. * ADD W-AMT(IDX-USR) TO W-AMT(IDX-MAX) FUNDS-YTD-WON. MOVE W-AMT(IDX-USR) TO FUNDS-WK-WON(IDX-WK). ADD W-WCNT(IDX-USR) TO W-WCNT(IDX-MAX) FUNDS-YTD-WCNT. MOVE W-WCNT(IDX-USR) TO FUNDS-WK-WCNT(IDX-WK). ADD W-LCNT(IDX-USR) TO W-LCNT(IDX-MAX) FUNDS-YTD-LCNT. MOVE W-LCNT(IDX-USR) TO FUNDS-WK-LCNT(IDX-WK). ADD W-TCNT(IDX-USR) TO W-TCNT(IDX-MAX) FUNDS-YTD-TCNT. MOVE W-TCNT(IDX-USR) TO FUNDS-WK-TCNT(IDX-WK). * ADD W-OWCT(IDX-USR) TO W-OWCT(IDX-MAX) FUNDS-YTD-OWCT. MOVE W-OWCT(IDX-USR) TO FUNDS-WK-OWCT(IDX-WK). ADD W-OLCT(IDX-USR) TO W-OLCT(IDX-MAX) FUNDS-YTD-OLCT. MOVE W-OLCT(IDX-USR) TO FUNDS-WK-OLCT(IDX-WK). ADD W-OTCT(IDX-USR) TO W-OTCT(IDX-MAX) FUNDS-YTD-OTCT. MOVE W-OTCT(IDX-USR) TO FUNDS-WK-OTCT(IDX-WK). * ADD W-PWCT(IDX-USR) TO W-PWCT(IDX-MAX) FUNDS-YTD-PWCT. MOVE W-PWCT(IDX-USR) TO FUNDS-WK-PWCT(IDX-WK). ADD W-PLCT(IDX-USR) TO W-PLCT(IDX-MAX) FUNDS-YTD-PLCT. MOVE W-PLCT(IDX-USR) TO FUNDS-WK-PLCT(IDX-WK). * REWRITE FUNDS-RECORD. * MOVE "Z>" TO W-USER(IDX-USR). MOVE -9999999 TO WS-FUNDS-CHECK. MOVE 0 TO IDX-TM. GO TO MUS-LOOP. MUS-DONE-2. MOVE SPACES TO OUT-LINE. MOVE W-USER(IDX-USR) TO O2-USER. IF W-AMT(IDX-USR) NOT < 0 MOVE "WON" TO O2-DID MOVE W-AMT(IDX-USR) TO O2-AMT ELSE MOVE "LOST" TO O2-DID MULTIPLY -1 BY W-AMT(IDX-USR) GIVING O2-AMT. MOVE W-WCNT(IDX-USR) TO O2-WCNT. MOVE "-" TO O2-D1 O2-D2. MOVE W-LCNT(IDX-USR) TO O2-LCNT. MOVE W-TCNT(IDX-USR) TO O2-TCNT. COMPUTE O2-WPCT ROUNDED = (W-WCNT(IDX-USR) + .5 * W-TCNT(IDX-USR)) / (W-WCNT(IDX-USR) + W-LCNT(IDX-USR) + W-TCNT(IDX-USR)) ON SIZE ERROR MOVE 0 TO O2-WPCT. MOVE W-OWCT(IDX-USR) TO O21-OWCT. MOVE W-OLCT(IDX-USR) TO O21-OLCT. MOVE W-OTCT(IDX-USR) TO O21-OTCT. MOVE "(" TO O22-P1. MOVE ")" TO O22-P2. MOVE "-" TO O21-D1 O21-D2 O22-D1. MOVE W-PWCT(IDX-USR) TO O22-PWCT. MOVE W-PLCT(IDX-USR) TO O22-PLCT. PERFORM WR-OUT. MUS-ALL-DONE. PERFORM SKIP-LINE. MOVE IDX-MAX TO IDX-USR. MOVE " THIS GROUP" TO W-USER(IDX-USR). PERFORM MUS-DONE-2. MUS-EXIT. EXIT. * OUTPUT-FINAL-SCORES SECTION. OR4-START. MOVE SPACES TO OUT-LINE. MOVE WEEK-NUMBER OF GAMES-FILE-ID TO SCV-OUT. STRING "NFL FOOTBALL - FINAL RESULTS - WEEK " SCV-OUT DELIMITED SIZE INTO OUT-LINE. PERFORM WR-OUT. PERFORM SKIP-LINE. OPEN INPUT GAMES-FILE. OR4-LOOP. MOVE SPACES TO OUT-LINE. MOVE " over" TO O4-OVER. MOVE "-" TO O4-DASH. READ GAMES-FILE NEXT AT END CLOSE GAMES-FILE GO TO OR4-DONE. IF SCH > SCV MOVE TEAM-NAME(HTEAM) TO O4-WINNER MOVE TEAM-NAME(VTEAM) TO O4-LOSER MOVE 13 TO STR-LEN CALL "M$CVTUPC" USING STR-LEN O4-WINNER MOVE SCH TO O4-SCW MOVE SCV TO O4-SCL ELSE MOVE TEAM-NAME(VTEAM) TO O4-WINNER MOVE TEAM-NAME(HTEAM) TO O4-LOSER MOVE 13 TO STR-LEN CALL "M$CVTUPC" USING STR-LEN O4-LOSER MOVE SCV TO O4-SCW MOVE SCH TO O4-SCL. IF SCV = SCH MOVE " tied" TO O4-OVER. PERFORM WR-OUT. GO TO OR4-LOOP. OR4-DONE. EXIT. * FINALIZE-INDIV-BETS SECTION. FIB-1. MOVE 1 TO IDX-USR IDX-TM IDX-GM. FIB-LOOP1. IF IDX-USR > NUMBER-OF-BETTORS GO TO FIB-DONE1. IF BETTOR(IDX-USR) = W-USER(IDX-TM) GO TO FIB-PROCESS1. IF W-USER(IDX-TM) = SPACES INITIALIZE WIN-ARRAY(IDX-TM) MOVE BETTOR(IDX-USR) TO W-USER(IDX-TM) ADD IDX-TM 1 GIVING IDX-MAX MOVE SPACES TO W-USER(IDX-MAX) GO TO FIB-PROCESS1. ADD 1 TO IDX-TM. GO TO FIB-LOOP1. * FIB-PROCESS1. IF BV-AMT(IDX-USR) = 0 AND BH-AMT(IDX-USR) = 0 AND BU-AMT(IDX-USR) = 0 AND BO-AMT(IDX-USR) = 0 GO TO FIB-RELOOP2. INITIALIZE GAR-ENTRY(IDX-GM). MOVE W-USER(IDX-TM) TO G-USER(IDX-GM). IF BV-AMT(IDX-USR) = BH-AMT(IDX-USR) IF BV-AMT(IDX-USR) NOT = 0 ADD 1 TO W-TCNT(IDX-TM) END-IF GO TO FIB-PTS. IF BV-AMT(IDX-USR) > BH-AMT(IDX-USR) SUBTRACT BH-AMT(IDX-USR) FROM BV-AMT(IDX-USR) MOVE 0 TO BH-AMT(IDX-USR) ADD SCV SB-VLINE GIVING PTS-INP IF PTS-INP > SCH ADD 1 TO W-WCNT(IDX-TM) ADD BV-AMT(IDX-USR) TO W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT1(IDX-TM) ELSE IF PTS-INP < SCH ADD 1 TO W-LCNT(IDX-TM) SUBTRACT BV-AMT(IDX-USR) FROM W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT1(IDX-TM) ELSE ADD 1 TO W-TCNT(IDX-TM). IF BH-AMT(IDX-USR) NOT = 0 SUBTRACT BV-AMT(IDX-USR) FROM BH-AMT(IDX-USR) MOVE 0 TO BV-AMT(IDX-USR) SUBTRACT SB-VLINE FROM SCH GIVING PTS-INP IF PTS-INP > SCV ADD 1 TO W-WCNT(IDX-TM) ADD BH-AMT(IDX-USR) TO W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT1(IDX-TM) ELSE IF PTS-INP < SCV ADD 1 TO W-LCNT(IDX-TM) SUBTRACT BH-AMT(IDX-USR) FROM W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT1(IDX-TM) ELSE ADD 1 TO W-TCNT(IDX-TM). FIB-PTS. IF BO-AMT(IDX-USR) = 0 AND BU-AMT(IDX-USR) = 0 GO TO FIB-RELOOP. IF BU-AMT(IDX-USR) = BO-AMT(IDX-USR) ADD 1 TO W-OTCT(IDX-TM) GO TO FIB-RELOOP. IF BU-AMT(IDX-USR) > BO-AMT(IDX-USR) SUBTRACT BO-AMT(IDX-USR) FROM BU-AMT(IDX-USR) MOVE 0 TO BO-AMT(IDX-USR) ADD SCV SCH GIVING PTS-INP IF PTS-INP < SB-OUPTS ADD 1 TO W-OWCT(IDX-TM) ADD BU-AMT(IDX-USR) TO W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT2(IDX-TM) ELSE IF PTS-INP > SB-OUPTS ADD 1 TO W-OLCT(IDX-TM) SUBTRACT BU-AMT(IDX-USR) FROM W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT2(IDX-TM) ELSE ADD 1 TO W-OTCT(IDX-TM). IF BO-AMT(IDX-USR) NOT = 0 SUBTRACT BU-AMT(IDX-USR) FROM BO-AMT(IDX-USR) MOVE 0 TO BU-AMT(IDX-USR) ADD SCV SCH GIVING PTS-INP IF PTS-INP > SB-OUPTS ADD 1 TO W-OWCT(IDX-TM) ADD BO-AMT(IDX-USR) TO W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT2(IDX-TM) ELSE IF PTS-INP < SB-OUPTS ADD 1 TO W-OLCT(IDX-TM) SUBTRACT BO-AMT(IDX-USR) FROM W-AMT(IDX-TM) G-AMT(IDX-GM) G-AMT2(IDX-TM) ELSE ADD 1 TO W-OTCT(IDX-TM). FIB-RELOOP. ADD 1 TO IDX-GM. FIB-RELOOP2. MOVE 1 TO IDX-TM. ADD 1 TO IDX-USR. GO TO FIB-LOOP1. * FIB-DONE1. MOVE SPACES TO G-USER(IDX-GM). FIB-LOOP2. MOVE 1 TO IDX-GM. MOVE 0 TO IDX-GI. MOVE -9999999 TO WS-FUNDS-CHECK. FIB-LOOP2A. IF G-USER(IDX-GM) = SPACES GO TO FIB-PROCESS2. IF G-USER(IDX-GM) NOT = "Z>" AND G-AMT(IDX-GM) > WS-FUNDS-CHECK MOVE IDX-GM TO IDX-GI MOVE G-AMT(IDX-GM) TO WS-FUNDS-CHECK. ADD 1 TO IDX-GM. GO TO FIB-LOOP2A. FIB-PROCESS2. IF IDX-GI = 0 GO TO FIB-DONE2. PERFORM FIB-OUT-LINE. MOVE "Z>" TO G-USER(IDX-GI). GO TO FIB-LOOP2. * FIB-OUT-LINE. MOVE SPACES TO OUT-LINE. MOVE G-USER(IDX-GI) TO O2-USER. IF G-AMT(IDX-GI) > 0 MOVE "WON" TO O2-DID MOVE G-AMT(IDX-GI) TO O2-AMT ELSE IF G-AMT(IDX-GI) < 0 MOVE "LOST" TO O2-DID MULTIPLY -1 BY G-AMT(IDX-GI) GIVING O2-AMT ELSE MOVE "PUSH" TO O2-DID MOVE 0 TO O2-AMT. MOVE G-AMT1(IDX-GI) TO O2-AMT1. MOVE G-AMT2(IDX-GI) TO O2-AMT2. PERFORM WR-OUT. * FIB-DONE2. EXIT. * COMPUTE-YTD-STAND SECTION. CYS1. MOVE 20 TO IDX-MAX. INITIALIZE WIN-ARRAY(IDX-MAX). PERFORM SKIP-LINE. PERFORM SKIP-LINE. MOVE "YEAR TO DATE TOTALS" TO OUT-LINE. PERFORM WR-OUT. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. CLOSE FUNDS-FILE. OPEN INPUT FUNDS-FILE. MOVE 1 TO IDX-USR. CYS-FLOOP. READ FUNDS-FILE NEXT AT END GO TO CYS-PROC. MOVE FUNDS-USERNAME TO W-USER(IDX-USR). MOVE FUNDS-YTD-WON TO W-AMT(IDX-USR). MOVE FUNDS-YTD-WCNT TO W-WCNT(IDX-USR). MOVE FUNDS-YTD-LCNT TO W-LCNT(IDX-USR). MOVE FUNDS-YTD-TCNT TO W-TCNT(IDX-USR). MOVE FUNDS-YTD-OWCT TO W-OWCT(IDX-USR). MOVE FUNDS-YTD-OLCT TO W-OLCT(IDX-USR). MOVE FUNDS-YTD-OTCT TO W-OTCT(IDX-USR). MOVE FUNDS-YTD-PWCT TO W-PWCT(IDX-USR). MOVE FUNDS-YTD-PLCT TO W-PLCT(IDX-USR). ADD FUNDS-YTD-WON TO W-AMT(IDX-MAX). ADD FUNDS-YTD-WCNT TO W-WCNT(IDX-MAX). ADD FUNDS-YTD-LCNT TO W-LCNT(IDX-MAX). ADD FUNDS-YTD-TCNT TO W-TCNT(IDX-MAX). ADD FUNDS-YTD-OWCT TO W-OWCT(IDX-MAX). ADD FUNDS-YTD-OLCT TO W-OLCT(IDX-MAX). ADD FUNDS-YTD-OTCT TO W-OTCT(IDX-MAX). ADD FUNDS-YTD-PWCT TO W-PWCT(IDX-MAX). ADD FUNDS-YTD-PLCT TO W-PLCT(IDX-MAX). ADD 1 TO IDX-USR. GO TO CYS-FLOOP. CYS-PROC. MOVE SPACES TO W-USER(IDX-USR). MOVE W-AMT(1) TO WS-FUNDS-CHECK. MOVE 1 TO IDX-USR IDX-TM. CYS-LOOP. ADD 1 TO IDX-TM. IF W-USER(IDX-TM) = SPACES GO TO CYS-DONE-1. IF W-USER(IDX-TM) = "Z>" GO TO CYS-LOOP. IF W-AMT(IDX-TM) > WS-FUNDS-CHECK MOVE W-AMT(IDX-TM) TO WS-FUNDS-CHECK MOVE IDX-TM TO IDX-USR. GO TO CYS-LOOP. CYS-DONE-1. IF WS-FUNDS-CHECK = -9999999 GO TO CYS-ALL-DONE. PERFORM CYS-DONE-2. MOVE "Z>" TO W-USER(IDX-USR). MOVE -9999999 TO WS-FUNDS-CHECK. MOVE 0 TO IDX-TM. GO TO CYS-LOOP. CYS-DONE-2. MOVE SPACES TO OUT-LINE. MOVE W-USER(IDX-USR) TO O2-USER IF W-AMT(IDX-USR) NOT < 0 MOVE "WON" TO O2-DID MOVE W-AMT(IDX-USR) TO O2-AMT ELSE MOVE "LOST" TO O2-DID MULTIPLY -1 BY W-AMT(IDX-USR) GIVING O2-AMT. MOVE W-WCNT(IDX-USR) TO O2-WCNT. MOVE "-" TO O2-D1 O2-D2. MOVE W-LCNT(IDX-USR) TO O2-LCNT. MOVE W-TCNT(IDX-USR) TO O2-TCNT. COMPUTE O2-WPCT ROUNDED = (W-WCNT(IDX-USR) + .5 * W-TCNT(IDX-USR)) / (W-WCNT(IDX-USR) + W-LCNT(IDX-USR) + W-TCNT(IDX-USR)) ON SIZE ERROR MOVE 0 TO O2-WPCT. MOVE W-OWCT(IDX-USR) TO O21-OWCT. MOVE W-OLCT(IDX-USR) TO O21-OLCT. MOVE W-OTCT(IDX-USR) TO O21-OTCT. MOVE "(" TO O22-P1. MOVE ")" TO O22-P2. MOVE "-" TO O21-D1 O21-D2 O22-D1. MOVE W-PWCT(IDX-USR) TO O22-PWCT. MOVE W-PLCT(IDX-USR) TO O22-PLCT. PERFORM WR-OUT. * CYS-ALL-DONE. PERFORM SKIP-LINE. MOVE IDX-MAX TO IDX-USR. MOVE " THIS GROUP" TO W-USER(IDX-USR). PERFORM CYS-DONE-2. CYS-EXIT. EXIT. * HANDLE-PARLAYS SECTION. PLACE-PARLAY. DISPLAY "New Parlay, Change Existing, or Exit (N/C/E)?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END STOP RUN. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF ANS = "C" OR "c" GO TO CHANGE-PARLAY. IF ANS = "N" OR "n" GO TO NEW-PARLAY. PERFORM REWRITE-PARLAY. CLOSE GAMES-FILE. GO TO GET-OPTION. CHANGE-PARLAY. DISPLAY "Enter Parlay number to change:" LINE 22 ERASE LINE. ACCEPT IDX-PL WITH CONVERSION COLUMN PLUS. IF IDX-PL = 0 GO TO PLACE-PARLAY. IF IDX-PL > FWK-NUM-PARLAYS GO TO NEW-PARLAY. DISPLAY "Change Amount Bet?" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS. IF ANS = "Y" OR "y" GO TO GET-PARLAY-AMT. GO TO GET-TEAM-LOOP. NEW-PARLAY. IF FWK-NUM-PARLAYS = 9 DISPLAY "%Maximum number of parlays already bet" LINE 23 GO TO PLACE-PARLAY. ADD 1 TO FWK-NUM-PARLAYS. MOVE FWK-NUM-PARLAYS TO IDX-PL. MOVE 0 TO FWK-PL-AMT(IDX-PL) FWK-PL-NUM-TEAMS(IDX-PL). INITIALIZE FWK-WK-PARLAY(IDX-PL). GET-PARLAY-TYPE. DISPLAY "Type of Bet: (P)arlay or (T)easer:" LINE 22 ERASE LINE. ACCEPT FWK-PL-TYPE(IDX-PL) COLUMN PLUS AT END STOP RUN. MOVE 1 TO ERROR-CODE. CALL "M$CVTUPC" USING ERROR-CODE FWK-PL-TYPE(IDX-PL). IF FWK-PL-TYPE(IDX-PL) = "P" OR "T" NEXT SENTENCE ELSE GO TO GET-PARLAY-TYPE. GET-PARLAY-AMT. ADD FWK-PL-AMT(IDX-PL) TO WS-FUNDS-AVAIL. DISPLAY "Amount to Bet:" LINE 22 ERASE LINE. ACCEPT FWK-PL-AMT(IDX-PL) WITH CONVERSION COLUMN PLUS AT END STOP RUN. IF FWK-PL-AMT(IDX-PL) NOT > 0 DISPLAY "Cancel bet?" LINE 23 ACCEPT ANS COLUMN PLUS IF ANS = "N" OR "n" MOVE 0 TO FWK-PL-AMT(IDX-PL) GO TO GET-PARLAY-AMT ELSE PERFORM DOWNSHIFT-ONE-PARLAY GO TO PLACE-PARLAY. IF FWK-PL-AMT(IDX-PL) > WS-FUNDS-AVAIL DISPLAY "You don't have that much money left - try again" LINE 24 MOVE 0 TO FWK-PL-AMT(IDX-PL) GO TO GET-PARLAY-AMT. SUBTRACT FWK-PL-AMT(IDX-PL) FROM WS-FUNDS-AVAIL. PERFORM DISPLAY-BALANCE. PERFORM DISPLAY-THIS-PARLAY. GO TO GET-TEAM-LOOP. * DOWNSHIFT-ONE-PARLAY. IF IDX-PL NOT < FWK-NUM-PARLAYS SUBTRACT 1 FROM FWK-NUM-PARLAYS ELSE MOVE FWK-WK-PARLAY(IDX-PL + 1) TO FWK-WK-PARLAY(IDX-PL) ADD 1 TO IDX-PL GO TO DOWNSHIFT-ONE-PARLAY. PERFORM DISPLAY-PARLAYS-BET. PERFORM DISPLAY-BALANCE. * VALIDATE-PARLAY. IF FWK-PL-NUM-TEAMS(IDX-PL) = 0 OR (FWK-PL-TYPE(IDX-PL) = "T" AND TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) = 0) OR (FWK-PL-TYPE(IDX-PL) = "P" AND PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) = 0) NEXT SENTENCE ELSE GO TO PLACE-PARLAY. DISPLAY "Your bet is invalid - add more items(Y) or delete bet(N):" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END MOVE SPACES TO ANS. IF ANS = "N" OR "n" PERFORM DOWNSHIFT-ONE-PARLAY GO TO PLACE-PARLAY. GET-TEAM-LOOP. DISPLAY "Team OR Points:(T/P)" LINE 22 ERASE LINE. ACCEPT ANS COLUMN PLUS AT END MOVE SPACES TO ANS. IF ANS = SPACES GO TO VALIDATE-PARLAY. IF ANS = "T" OR "t" GO TO GET-TEAM-NUMBER. IF ANS = "P" OR "p" GO TO GET-POINTS-GAME. GO TO GET-TEAM-LOOP. GET-POINTS-GAME. DISPLAY "Game Number:" LINE 22 ERASE LINE. ACCEPT GAME-NUMBER WITH CONVERSION COLUMN PLUS AT END MOVE 0 TO GAME-NUMBER. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. READ GAMES-FILE INVALID KEY DISPLAY "%Invalid game number" LINE 23 MOVE 0 TO GAME-NUMBER. IF GAME-NUMBER = 0 GO TO GET-POINTS-GAME. DISPLAY TEAM-NAME(VTEAM) LINE 23 ERASE LINE "at" COLUMN PLUS TEAM-NAME(HTEAM) COLUMN PLUS. * DISPLAY "Over or Under:" LINE 22 ERASE LINE ACCEPT ANS COLUMN PLUS AT END MOVE SPACES TO ANS. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF ANS = "O" OR "o" ADD GAME-NUMBER 28 GIVING IDX-CK ELSE IF ANS = "U" OR "u" MULTIPLY -1 BY GAME-NUMBER GIVING IDX-CK ELSE GO TO GET-POINTS-GAME. GO TO MODIFY-PARLAY. GET-TEAM-NUMBER. DISPLAY "Enter Team Number to Add or Remove from Parlay: " LINE 22 ERASE LINE. ACCEPT IDX-TM WITH CONVERSION COLUMN PLUS AT END MOVE 0 TO IDX-TM. DISPLAY LOW-VALUES LINE 23 ERASE END SCREEN. IF IDX-TM NOT > 0 GO TO VALIDATE-PARLAY. IF IDX-TM > 28 OR WHAT-LINE(IDX-TM) = 0 DISPLAY "THAT TEAM IS OFF THIS WEEK" LINE 23 GO TO GET-TEAM-LOOP. MOVE IDX-TM TO IDX-CK. MODIFY-PARLAY. MOVE 1 TO IDX-PLI. PERFORM POKE-A-TEAM. PERFORM DISPLAY-THIS-PARLAY. GO TO GET-TEAM-LOOP. POKE-A-TEAM. IF FWK-PL-TEAM(IDX-PL,IDX-PLI) = 0 MOVE IDX-CK TO FWK-PL-TEAM(IDX-PL,IDX-PLI) ELSE IF FWK-PL-TEAM(IDX-PL,IDX-PLI) < IDX-CK ADD 1 TO IDX-PLI IF IDX-PLI > 15 MOVE 0 TO IDX-PLI ELSE GO TO POKE-A-TEAM END-IF ELSE IF FWK-PL-TEAM(IDX-PL,IDX-PLI) = IDX-CK PERFORM REMOVE-A-TEAM ELSE MOVE 15 TO IDX-GI PERFORM INSERT-A-TEAM END-IF. REMOVE-A-TEAM. IF IDX-PLI < 15 MOVE FWK-PL-TEAM(IDX-PL,IDX-PLI + 1) TO FWK-PL-TEAM(IDX-PL,IDX-PLI) ADD 1 TO IDX-PLI GO TO REMOVE-A-TEAM. MOVE 0 TO FWK-PL-TEAM(IDX-PL,IDX-PLI). INSERT-A-TEAM. IF IDX-GI > IDX-PLI MOVE FWK-PL-TEAM(IDX-PL,IDX-GI - 1) TO FWK-PL-TEAM(IDX-PL,IDX-GI) SUBTRACT 1 FROM IDX-GI GO TO INSERT-A-TEAM. MOVE IDX-CK TO FWK-PL-TEAM(IDX-PL,IDX-PLI). * DISPLAY-PARLAYS-BET SECTION. DPB1. DISPLAY LOW-VALUES LINE FIXED-PARLAY-OFFSET PLUS 1 ERASE END SCREEN. MOVE 0 TO IDX-PL. MOVE WS-FUNDS-CHECK TO WS-FUNDS-AVAIL. DPB-LOOP. ADD 1 TO IDX-PL. IF IDX-PL > FWK-NUM-PARLAYS GO TO DPB-EXIT. DISPLAY-THIS-PARLAY. ADD IDX-PL FIXED-PARLAY-OFFSET GIVING LINE-NO. DISPLAY FWK-PL-WL(IDX-PL) LINE LINE-NO ERASE LINE IDX-PL WITH CONVERSION COLUMN PLUS FWK-PL-TYPE(IDX-PL) COLUMN PLUS "$" COLUMN PLUS FWK-PL-AMT(IDX-PL) WITH CONVERSION COLUMN PLUS "ITEMS:" COLUMN PLUS. MOVE 1 TO IDX-PLI. PERFORM UNTIL IDX-PLI = 15 OR FWK-PL-TEAM(IDX-PL,IDX-PLI) = 0 PERFORM DISPLAY-PARLAY-ITEM MOVE IDX-PLI TO FWK-PL-NUM-TEAMS(IDX-PL) ADD 1 TO IDX-PLI END-PERFORM. IF FWK-PL-TYPE(IDX-PL) = "P" IF FWK-PL-NUM-TEAMS(IDX-PL) > MAX-PARLAY DISPLAY "%Maximum teams allowed on Parlay is" LINE 23 MAX-PARLAY WITH CONVERSION COLUMN PLUS MOVE MAX-PARLAY TO FWK-PL-NUM-TEAMS(IDX-PL) ELSE IF FWK-PL-NUM-TEAMS(IDX-PL) = 0 OR PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) = 0 DISPLAY "%More teams required for valid Parlay bet" LINE 23 ELSE IF FWK-PL-WL(IDX-PL) = " " MULTIPLY PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY FWK-PL-AMT(IDX-PL) GIVING BET-AMT ON SIZE ERROR MOVE 0 TO BET-AMT END-MULTIPLY DISPLAY "PAYS:" COLUMN PLUS IF BET-AMT > 0 DISPLAY BET-AMT WITH CONVERSION COLUMN PLUS ELSE DISPLAY PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) WITH CONVERSION COLUMN PLUS "TO 1" COLUMN PLUS COMPUTE BET-AMT = 9999 / PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) ADD FWK-PL-AMT(IDX-PL) TO WS-FUNDS-AVAIL MOVE BET-AMT TO FWK-PL-AMT(IDX-PL) SUBTRACT FWK-PL-AMT(IDX-PL) FROM WS-FUNDS-AVAIL DISPLAY "%Amount bet reduced to limit on this bet of " LINE 23 BET-AMT WITH CONVERSION COLUMN PLUS. IF FWK-PL-TYPE(IDX-PL) = "T" IF FWK-PL-NUM-TEAMS(IDX-PL) > MAX-TEASER DISPLAY "%Maximum teams allowed on Teaser is" LINE 23 MAX-TEASER WITH CONVERSION COLUMN PLUS MOVE MAX-TEASER TO FWK-PL-NUM-TEAMS(IDX-PL) ELSE IF FWK-PL-NUM-TEAMS(IDX-PL) = 0 OR TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) = 0 DISPLAY "%More teams required for valid Teaser bet" LINE 23 ELSE IF FWK-PL-WL(IDX-PL) = " " MULTIPLY TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY FWK-PL-AMT(IDX-PL) GIVING BET-AMT ON SIZE ERROR MOVE 0 TO BET-AMT END-MULTIPLY DISPLAY "PAYS:" COLUMN PLUS IF BET-AMT > 0 DISPLAY BET-AMT WITH CONVERSION COLUMN PLUS ELSE DISPLAY TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) WITH CONVERSION COLUMN PLUS "TO 1" COLUMN PLUS COMPUTE BET-AMT = 9999 / TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) ADD FWK-PL-AMT(IDX-PL) TO WS-FUNDS-AVAIL MOVE BET-AMT TO FWK-PL-AMT(IDX-PL) SUBTRACT FWK-PL-AMT(IDX-PL) FROM WS-FUNDS-AVAIL DISPLAY "%Amount bet reduced to limit on this bet of " LINE 23 BET-AMT WITH CONVERSION COLUMN PLUS. IF OPTION = "R" IF FWK-PL-WL(IDX-PL) = "L" SUBTRACT FWK-PL-AMT(IDX-PL) FROM W-AMT(1) ADD 1 TO W-PLCT(1) MULTIPLY FWK-PL-AMT(IDX-PL) BY -1 GIVING BET-AMT DISPLAY BET-AMT WITH CONVERSION COLUMN 111 ELSE IF FWK-PL-WL(IDX-PL) = "W" ADD 1 TO W-PWCT(1) DISPLAY "+" COLUMN 110 IF FWK-PL-TYPE(IDX-PL) = "T" MULTIPLY TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY FWK-PL-AMT(IDX-PL) GIVING BET-AMT ON SIZE ERROR MOVE FWK-PL-AMT(IDX-PL) TO BET-AMT END-MULTIPLY ELSE MULTIPLY PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY FWK-PL-AMT(IDX-PL) GIVING BET-AMT ON SIZE ERROR MOVE FWK-PL-AMT(IDX-PL) TO BET-AMT END-MULTIPLY END-IF SUBTRACT FWK-PL-AMT(IDX-PL) FROM BET-AMT DISPLAY BET-AMT WITH CONVERSION COLUMN PLUS 0 ADD BET-AMT TO W-AMT(1). DPB-CONT. SUBTRACT FWK-PL-AMT(IDX-PL) FROM WS-FUNDS-AVAIL. GO TO DPB-LOOP. DISPLAY-PARLAY-ITEM. IF FWK-PL-TEAM(IDX-PL,IDX-PLI) > 0 AND FWK-PL-TEAM(IDX-PL,IDX-PLI) < 29 MOVE TEAM-NAME(FWK-PL-TEAM(IDX-PL,IDX-PLI)) TO WS-STRING ELSE MOVE SPACES TO WS-STRING IF FWK-PL-TEAM(IDX-PL,IDX-PLI) < 0 MULTIPLY FWK-PL-TEAM(IDX-PL,IDX-PLI) BY -1 GIVING SCV-OUT STRING "G#" SCV-OUT "-Under" DELIMITED SIZE INTO WS-STRING ELSE SUBTRACT 28 FROM FWK-PL-TEAM(IDX-PL,IDX-PLI) GIVING SCV-OUT STRING "G#" SCV-OUT "-Over" DELIMITED SIZE INTO WS-STRING. MOVE 14 TO STR-LEN. CALL "M$STRLEN" USING STR-LEN WS-STRING. IF IDX-PLI > 1 DISPLAY "," COLUMN PLUS 0. DISPLAY WS-STRING(1:STR-LEN) COLUMN PLUS. DPB-EXIT. EXIT. * MUP-ALL-PARLAYS SECTION. MUPA1. CLOSE PARLAYS-FILE. OPEN I-O PARLAYS-FILE. MUPA-LOOP. READ PARLAYS-FILE NEXT RECORD AT END GO TO MUPA-DONE. IF PL-WK NOT = IDX-WK GO TO MUPA-LOOP. IF PL-UPD-FLG = "Y" GO TO MUPA-LOOP. MOVE PARLAY-RECORD TO FWK-PARLAY-RECORD. MOVE PL-USERNAME TO FUNDS-USERNAME. PERFORM READ-FUNDS-FILE. PERFORM UPDATE-USER-PARLAY. GO TO MUPA-LOOP. MUPA-DONE. EXIT. * OUTPUT-ALL-PARLAYS SECTION. OAP1. PERFORM NEW-PAGE. MOVE 0 TO L-CNT. CLOSE PARLAYS-FILE. OPEN I-O PARLAYS-FILE. OAP-LOOP. READ PARLAYS-FILE NEXT RECORD AT END GO TO OAP-DONE. IF PL-WK NOT = IDX-WK GO TO OAP-LOOP. IF PL-NUM-PARLAYS = 0 GO TO OAP-LOOP. MOVE PARLAY-RECORD TO FWK-PARLAY-RECORD. MOVE PL-USERNAME TO FUNDS-USERNAME. PERFORM READ-FUNDS-FILE. MOVE 0 TO WS-FUNDS-AVAIL WS-FUNDS-CHECK. PERFORM HARDCOPY-PARLAYS. GO TO OAP-LOOP. OAP-DONE. EXIT. * HARDCOPY-PARLAYS SECTION. HCP1. IF FWK-NUM-PARLAYS = 0 GO TO HCP-FINISH. IF L-CNT > 55 PERFORM NEW-PAGE. MOVE "PARLAYS & TEASERS FOR " TO OUT-LINE. MOVE PL-USERNAME TO OUT-LINE(23:). PERFORM WR-OUT. MOVE 1 TO IDX-PL. MOVE 0 TO IDX-USR. HCP-PAR-LOOP. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE SPACES TO OUT-LINE-3. IF (L-CNT + FWK-PL-NUM-TEAMS(IDX-PL) ) > 60 PERFORM NEW-PAGE. HCP-PAR-LINE. MOVE "ITEMS" TO O3-DESC1. IF FWK-PL-TYPE(IDX-PL) = "T" MOVE "TEASER" TO O3-TYPE ELSE MOVE "PARLAY" TO O3-TYPE. MOVE FWK-PL-AMT(IDX-PL) TO O3-AMT-BET. ADD FWK-PL-AMT(IDX-PL) TO WS-FUNDS-CHECK. MOVE FWK-PL-NUM-TEAMS(IDX-PL) TO O3-NUM-TMS. IF FWK-PL-WL(IDX-PL) = "L" MOVE "LOST" TO O3-WON-LOST SUBTRACT FWK-PL-AMT(IDX-PL) FROM WS-FUNDS-AVAIL MULTIPLY FWK-PL-AMT(IDX-PL) BY -1 GIVING O-WON ELSE MOVE "ITEMS: PAYS" TO O3-DESC1 MOVE " TO 1 =" TO O3-DESC2 IF FWK-PL-TYPE(IDX-PL) = "T" MOVE TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) TO O3-PTPAY MULTIPLY TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY FWK-PL-AMT(IDX-PL) GIVING BET-AMT ELSE MOVE PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) TO O3-PTPAY MULTIPLY PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY FWK-PL-AMT(IDX-PL) GIVING BET-AMT END-IF MOVE BET-AMT TO O3-WLPAY SUBTRACT FWK-PL-AMT(IDX-PL) FROM BET-AMT IF FWK-PL-WL(IDX-PL) = "W" MOVE "WON" TO O3-WON-LOST MOVE BET-AMT TO O-WON ADD BET-AMT TO WS-FUNDS-AVAIL. PERFORM WR-OUT. HCP-PLI. MOVE 1 TO IDX-PLI. HCP-PLP. IF IDX-PLI = 15 OR FWK-PL-TEAM(IDX-PL,IDX-PLI) = 0 GO TO HCP-PLP-DONE. IF FWK-PL-TEAM(IDX-PL,IDX-PLI) < 0 GO TO HCP-PL-UNDER. IF FWK-PL-TEAM(IDX-PL,IDX-PLI) > 28 GO TO HCP-PL-OVER. MOVE FWK-PL-TEAM(IDX-PL,IDX-PLI) TO IDX-TM. IF WHAT-LINE(IDX-TM) < 0 MULTIPLY -1 BY WHAT-LINE(IDX-TM) GIVING LINE-NO ELSE MOVE WHAT-LINE(IDX-TM) TO LINE-NO. SUBTRACT 2 FROM LINE-NO GIVING GAME-NUMBER. READ GAMES-FILE. IF WHAT-LINE(IDX-TM) < 0 IF FWK-PL-TYPE(IDX-PL) = "T" ADD 6 TO SB-VLINE END-IF PERFORM HC-BET-VIS ELSE IF FWK-PL-TYPE(IDX-PL) = "T" SUBTRACT 6 FROM SB-VLINE END-IF PERFORM HC-BET-HOM. ADD 1 TO IDX-PLI. GO TO HCP-PLP. HCP-PL-UNDER. MULTIPLY -1 BY FWK-PL-TEAM(IDX-PL,IDX-PLI) GIVING GAME-NUMBER. READ GAMES-FILE. IF FWK-PL-TYPE(IDX-PL) = "T" ADD 6 TO SB-OUPTS. PERFORM HC-BET-UNDER. ADD 1 TO IDX-PLI. GO TO HCP-PLP. HCP-PL-OVER. SUBTRACT 28 FROM FWK-PL-TEAM(IDX-PL,IDX-PLI) GIVING GAME-NUMBER. READ GAMES-FILE. IF FWK-PL-TYPE(IDX-PL) = "T" SUBTRACT 6 FROM SB-OUPTS. PERFORM HC-BET-OVER. ADD 1 TO IDX-PLI. GO TO HCP-PLP. * HCP-PLP-DONE. ADD 1 TO IDX-PL. IF IDX-PL NOT > FWK-NUM-PARLAYS GO TO HCP-PAR-LOOP. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. MOVE " TOTAL" TO O-TEAM-PLAYING. MOVE WS-FUNDS-CHECK TO O-BET-AMT. IF WS-FUNDS-AVAIL NOT = 0 MOVE WS-FUNDS-AVAIL TO O-WON. PERFORM WR-OUT. HCP-FINISH. MOVE SPACES TO OUT-LINE. PERFORM SKIP-LINE. HCP-EXIT. EXIT. * UPDATE-USER-PARLAY SECTION. UPDP-1. MOVE 0 TO FUNDS-WK-PLCT(IDX-WK) FUNDS-WK-PWCT(IDX-WK). MOVE 0 TO FWK-PL-TOT-AMT. MOVE "Y" TO FWK-UPD-FLG. MOVE 0 TO IDX-PL. UPDP-LOOP. ADD 1 TO IDX-PL. IF IDX-PL > FWK-NUM-PARLAYS GO TO UPDP-DONE. IF FWK-PL-NUM-TEAMS(IDX-PL) = 0 GO TO UPDP-INV-BET. IF FWK-PL-TYPE(IDX-PL) = "P" AND PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) = 0 GO TO UPDP-INV-BET. IF FWK-PL-TYPE(IDX-PL) = "T" AND TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) = 0 GO TO UPDP-INV-BET. IF FWK-PL-AMT(IDX-PL) = 0 DISPLAY "%Fatal program error in UPDP-LOOP" LINE 23 STOP RUN. IF FWK-PL-AMT(IDX-PL) < 0 MULTIPLY -1 BY FWK-PL-AMT(IDX-PL). MOVE FWK-PL-AMT(IDX-PL) TO BET-AMT. MOVE 0 TO IDX-PLI. UPDP-LOOP2. ADD 1 TO IDX-PLI. IF IDX-PLI > FWK-PL-NUM-TEAMS(IDX-PL) GO TO UPDP-WON. IF FWK-PL-TEAM(IDX-PL,IDX-PLI) < 0 GO TO UPDP-LOOP2U. IF FWK-PL-TEAM(IDX-PL,IDX-PLI) > 28 GO TO UPDP-LOOP2O. MOVE FWK-PL-TEAM(IDX-PL,IDX-PLI) TO IDX-TM. IF WHAT-LINE(IDX-TM) = 0 DISPLAY "%Fatal program error in UPDP-LOOP2" LINE 23 STOP RUN. IF WHAT-LINE(IDX-TM) < 0 MULTIPLY -1 BY WHAT-LINE(IDX-TM) GIVING LINE-NO ELSE MOVE WHAT-LINE(IDX-TM) TO LINE-NO. SUBTRACT 2 FROM LINE-NO GIVING GAME-NUMBER. UPDP-RETRY-READ-GAMES. READ GAMES-FILE. IF RECORD-LOCKED GO TO UPDP-RETRY-READ-GAMES. IF WHAT-LINE(IDX-TM) < 0 COMPUTE PTS-INP = SCV + SB-VLINE - SCH ELSE COMPUTE PTS-INP = SCH - SB-VLINE - SCV. IF FWK-PL-TYPE(IDX-PL) = "T" ADD 6 TO PTS-INP. IF PTS-INP NOT < 0 GO TO UPDP-LOOP2. UPDP-LOST. MULTIPLY -1 BY BET-AMT. ADD BET-AMT TO FWK-PL-TOT-AMT. MOVE "L" TO FWK-PL-WL(IDX-PL). ADD 1 TO FUNDS-WK-PLCT(IDX-WK). GO TO UPDP-LOOP. UPDP-WON. IF FWK-PL-TYPE(IDX-PL) = "T" MULTIPLY TEASER-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY BET-AMT ELSE MULTIPLY PARLAY-PAYS(FWK-PL-NUM-TEAMS(IDX-PL)) BY BET-AMT. ADD BET-AMT TO FWK-PL-TOT-AMT. MOVE "W" TO FWK-PL-WL(IDX-PL). ADD 1 TO FUNDS-WK-PWCT(IDX-WK). GO TO UPDP-LOOP. UPDP-LOOP2U. MULTIPLY FWK-PL-TEAM(IDX-PL,IDX-PLI) BY -1 GIVING GAME-NUMBER. READ GAMES-FILE INVALID KEY DISPLAY "%PROG_ERR in Parlay_Under" STOP RUN. ADD SCV SCH GIVING PTS-INP. IF FWK-PL-TYPE(IDX-PL) = "T" SUBTRACT 6 FROM PTS-INP. IF PTS-INP > SB-OUPTS GO TO UPDP-LOST. GO TO UPDP-LOOP2. UPDP-LOOP2O. SUBTRACT 28 FROM FWK-PL-TEAM(IDX-PL,IDX-PLI) GIVING GAME-NUMBER. READ GAMES-FILE INVALID KEY DISPLAY "%PROG_ERR in Parlay_Over" STOP RUN. ADD SCV SCH GIVING PTS-INP. IF FWK-PL-TYPE(IDX-PL) = "T" ADD 6 TO PTS-INP. IF PTS-INP < SB-OUPTS GO TO UPDP-LOST. GO TO UPDP-LOOP2. UPDP-INV-BET. IF IDX-PL NOT < FWK-NUM-PARLAYS SUBTRACT 1 FROM FWK-NUM-PARLAYS ELSE MOVE FWK-WK-PARLAY(IDX-PL + 1) TO FWK-WK-PARLAY(IDX-PL) ADD 1 TO IDX-PL GO TO UPDP-INV-BET. GO TO UPDP-LOOP. UPDP-DONE. ADD FWK-PL-TOT-AMT TO FUNDS-WK-WON(IDX-WK). REWRITE FUNDS-RECORD. PERFORM REWRITE-PARLAY. UPDP-EXIT. EXIT.