04-15-2003, 05:08 AM
I wrote a program (rather crude, I'm afraid) for a friend to help him keep baseball pitching stats from the past twenty days. The program works on my computer, but not on his because records in his newly-created DAT file already have "values". (He's on a second-hand computer running WIN98) Why are there entries in his DAT file? These strings look meaningless to me, but I don't know enough about what's important to confidently overwrite them.
[code]
REM Searches for name
4200 AVAIL = 0
FOR SRC = BSRC TO ESRC STEP INCR
GET #1, SRC, P
IF P.N = NA$ THEN ' Name is on file
FF = SRC
LF = FF + INCR - 1
K = 1
RETURN
END IF
4216 IF ASC(P.N) < 65 AND AVAIL = 0 THEN AVAIL = SRC
4218 IF EOF(1) THEN 4230
NEXT SRC
4230 PRINT "No match for"; RTRIM$(NA$); "found. OK? (n)"
INPUT "", OK$
IF UCASE$(OK$) = "N" THEN 900
REM Allot spaces for new name
4300 FF = AVAIL: LF = FF + INCR - 1
FOR INDEX = FF TO LF
GET #1, INDEX, P
4313 IF ASC(P.N) > 64 THEN STOP
P.N = NA$: P.D = 0: P.O = 0: P.H = 0
IF N$ = "BP" THEN P.D = TODAY + FF - INDEX
PUT #1, INDEX, P
NEXT INDEX
RETURN
A starting pitcher has four records in the file- four starts is the most he'll have in twenty days. Each bullpen has twenty records for twenty days. The first 600 records of the file are reserved for the thirty 'pens; because bullpen stats will be updated every day that the program is run, I wanted to be able to locate them quickly by looking at every 20th record in the bullpen section rather than every 4th record in the entire file. Line 4216 was meant to locate "empty" records (the first symbol in an "occupied" record is always a letter) but this isn't reliable on his computer due to the initial values in his DAT file. If an empty starter spot is skipped it will only waste memory (ESRC for the unknown number of starters is quite large), but I can't afford to overlook an empty bullpen record.
Soooo... Can I create a DAT file that starts "empty", like on my computer? Alternatively, is the "garbage" in the new DAT file really garbage so I can just overwrite it?
Line 4313 shouldn't be necessary. It was protection against overwriting misplaced data within a block of records while the program was being developed.
"Thank you" in advance to anyone who can shed some light on this.
[code]
REM Searches for name
4200 AVAIL = 0
FOR SRC = BSRC TO ESRC STEP INCR
GET #1, SRC, P
IF P.N = NA$ THEN ' Name is on file
FF = SRC
LF = FF + INCR - 1
K = 1
RETURN
END IF
4216 IF ASC(P.N) < 65 AND AVAIL = 0 THEN AVAIL = SRC
4218 IF EOF(1) THEN 4230
NEXT SRC
4230 PRINT "No match for"; RTRIM$(NA$); "found. OK? (n)"
INPUT "", OK$
IF UCASE$(OK$) = "N" THEN 900
REM Allot spaces for new name
4300 FF = AVAIL: LF = FF + INCR - 1
FOR INDEX = FF TO LF
GET #1, INDEX, P
4313 IF ASC(P.N) > 64 THEN STOP
P.N = NA$: P.D = 0: P.O = 0: P.H = 0
IF N$ = "BP" THEN P.D = TODAY + FF - INDEX
PUT #1, INDEX, P
NEXT INDEX
RETURN
A starting pitcher has four records in the file- four starts is the most he'll have in twenty days. Each bullpen has twenty records for twenty days. The first 600 records of the file are reserved for the thirty 'pens; because bullpen stats will be updated every day that the program is run, I wanted to be able to locate them quickly by looking at every 20th record in the bullpen section rather than every 4th record in the entire file. Line 4216 was meant to locate "empty" records (the first symbol in an "occupied" record is always a letter) but this isn't reliable on his computer due to the initial values in his DAT file. If an empty starter spot is skipped it will only waste memory (ESRC for the unknown number of starters is quite large), but I can't afford to overlook an empty bullpen record.
Soooo... Can I create a DAT file that starts "empty", like on my computer? Alternatively, is the "garbage" in the new DAT file really garbage so I can just overwrite it?
Line 4313 shouldn't be necessary. It was protection against overwriting misplaced data within a block of records while the program was being developed.
"Thank you" in advance to anyone who can shed some light on this.
alk about your plenties, talk about your ills,
One man gathers what another man spills.
One man gathers what another man spills.