Help needed!!!

 BBS: Inland Empire Archive
Date: 03-24-92 (16:08)             Number: 165
From: RICHARD VANNOY               Refer#: NONE
  To: SHAWN BOWLBY                  Recvd: NO  
Subj: Help needed!!!                 Conf: (2) Quik_Bas
SB>  Hello, i am very new to programming and i was wondering if someone on
SB>this net could help me out??  Could someone tell me the easiest way to
SB>"Edit/Delete" a specific record in a sequential file?
SB>  I imagine it involves using the SWAP keyword, but the exact procedure
SB>escapes me.  Any and all help would be greatly appreciated...

SWAP won't work in a sequential file.
Try something like this..

OPEN "GOODSTUF.DAT" FOR INPUT AS #1
OPEN "GOODSTUF.BAK" FOR OUTPUT AS #2
WHILE NOT EOF(1)
   INPUT #1,rec$
   PRINT rec$
   'D=Delete, E=Edit, anything else=store it.
   PRINT "Delete/Edit/Store? (D/E/RETURN) ";
   DO
      k$=INKEY$
   LOOP UNTIL LEN(k$)
   SELECT CASE UCASE$(k$)
      CASE "D"
         'Do nothing (DON'T write it to #2.)
      CASE "E"
         INPUT "Enter new record: ";rec$
         PRINT #2,rec$
      CASE ELSE
         PRINT #2,rec$
   END SELECT
WEND
...
Then just KILL the .DAT and rename the .BAK to .DAT.
!!!  BACK UP YOUR DATA BEFORE TRYING THIS !!! (or any code
that can destroy files!

> MegaMail 2.1b #0:Stamp out, eradicate, and eliminate redundancy!


--- WM v2.01/91-0012
 * Origin: Com-Dat BBS  Hillsboro, OR.  HST (503) 681-0543 (1:105/314)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET