lmayer@elgin.edu

Week 11

7 - Data Files & Control Breaks

File - Group of related records

    • Used by different programs
    • Updated
    • many file processed by single program
    • can process different files

Sequential Files:

OPEN - allocates memory of data

  • identifies the file to be processed
  • indicates whether READ or WRITE
  • assigns a file number
  • set pointer to beginning (or end) of file

OPEN   filespec   FOR  mode   AS #filenumber

Mode: 

  • append - pointer positioned to EOF
  • input - pointer positioned to beginning
  • output - pointer positioned to beginning

Filenumber between 1 and 255

CLOSE - closes an open file (can't close a file that is not open - Duh!)

*note: END statement closes all open files

PRINT #n - writes to a file (report)

WRITE #n - writes data to a file (file creation)

INPUT #n - reads data from a file

EOF is automatically added after the last record when the file is closed