on 4/29/03 11:57 PM, Jay Reeve at jayreeve@... wrote: > Barrie, > > One more small change. I just realized that there may be a problem > with a LEN of 256 for your WRITE# 1,gLocation$. Try this instead: > > _dataBytes = ((_maxAnswers+1) * (_maxQuestions+1)) * SIZEOF(INT) > _timeBytes = SIZEOF(INT) * 6 > _locationBytes = SIZEOF(gLocation$) > _recordSize = _dataBytes + _timeBytes + _locationBytes > > LOCAL FN SaveDataRecord > FN getDateAndTime > DEF OPEN ="DataCHMK" > OPEN "A", 1, gSurveyDataFile$,_recordSize, 0 > WRITE FILE #1, @gLocation$, _locationBytes} > WRITE FILE #1, @gTimeStamp%(0), _timeBytes > WRITE FILE #1, @gData%(0,0), _dataBytes > CLOSE #1 > def blockfill(@gData(0,0), _dataBytes, 0) > END FN > > LOCAL FN ReadDataRecord(recordNum,positionInRecord) //Should remove pos var > DEF OPEN ="Data" > gSurveyDataFile$ = FILES$ (_fOpen,"Data","Open Data file",gFileVol) > IF gSurveyDataFile$ = "" THEN exit fn > OPEN "I", 1, gSurveyDataFile$, _recordSize, gFileVol > gNumberOfRecords = LOF(1) > RECORD #1, recordNum//, positionInRecord > read FILE #1, @gLocation$, _locationBytes > READ FILE #1, @gTimeStamp%(0), _timeBytes > READ FILE #1, @gData%(0,0), _dataBytes > CLOSE #1 > END FN > > Barrie, > > One more small change. I just realized that there may be a problem > with a LEN of 256 for your WRITE# 1,gLocation$. Try this instead: > > _dataBytes = ((_maxAnswers+1) * (_maxQuestions+1)) * SIZEOF(INT) > _timeBytes = SIZEOF(INT) * 6 > _locationBytes = SIZEOF(gLocation$) > _recordSize = _dataBytes + _timeBytes + _locationBytes > > LOCAL FN SaveDataRecord > FN getDateAndTime > DEF OPEN ="DataCHMK" > OPEN "A", 1, gSurveyDataFile$,_recordSize, 0 > WRITE FILE #1, @gLocation$, _locationBytes} > WRITE FILE #1, @gTimeStamp%(0), _timeBytes > WRITE FILE #1, @gData%(0,0), _dataBytes > CLOSE #1 > def blockfill(@gData(0,0), _dataBytes, 0) > END FN > Jay Things got worse. I tried many variations on your example. The _locationBytes = SIZEOF(gLocation$) did not work, kept getting errors. Location$ is a 20 length string. Sorry I should have included the DIM's. My earlier example worked fine except for the gData%(0,0) array. Perhaps WRITE FILE does not work with 2D arrays. OR maybe the 2D array needs another method of address. I'll have to continue tomorrow. I'm ready for a long sleep. Many thanks Barrie