Classic Computer Magazine Archive COMPUTE! ISSUE 95 / APRIL 1988 / PAGE 43

Sequential File Overwrite

Is it possible to write over a sequential file with another sequential file of the same name? I have a 64.

D. J. Bumbarger

You can overwrite a sequential file using the DOS save-with-replace command. For this file type, you would use the format OPEN 2,8,2,"@x:SEQ FILE,S,W", where x is the drive number (usually 0) and SEQ FILE is the filename of the sequential file you wish to replace.

However, because of a bug in older 1541 and 1571 drives (which may destroy some data on your disk), a better approach is to simply scratch the old file before saving the new one. The short program below uses this technique.

10 OPEN 15, 8, 15, "S0:SEQ FILE":CLOSE 15
20 OPEN 2, 8, 2, "0:SEQ FILE, S, W"
30 PRINT #2, "DATA"
40 CLOSE 2