Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mystery (to me) values in new DAT file
#1
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.
alk about your plenties, talk about your ills,
One man gathers what another man spills.
Reply
#2
All random-access files I've ever made have started out with blank records. The only time I've ever had "mystery data" in a random access file is when I changed up the record length (usually by adding or removing an element from the TYPE statement) and didn't erase the old file.

Not sure what else to say.

*peace*

Meg.
Reply
#3
Thank you for your reply. Smile

Nothing in the program was changed on his end. I searched his computer to make sure there was no P.DAT file, installed the program, and ran it 'til line 4313, the "unnecessary" line that revealed the problem. I closed the program, deleted P.DAT, ran the program again, and got a similar result- stopped at 4313, but different "stuff" in the file. The stuff consists of letters, numbers, punctuation marks, and some other symbols listed on the ASCII chart. Generally, sets of three, like

777\\\^^^"""

Any idea why or what this is? Could overwriting it cause a problem??

P.N, where the stuff is, is the only string saved in the file. The only PUT statement before the 4200 subroutine assigns an integer value to P.D in record# 601; no value is assigned to any P.N until immediately after the problem line.

It's a bit reassuring to know I'm not the only one puzzled. Thanks!
alk about your plenties, talk about your ills,
One man gathers what another man spills.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)