Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
File Access

Types of External Files

Most files that you work with are text files, which means that they can be edited and displayed without any special program. Text files under most host environments have special characters, called carriage-control characters or end-of-line characters, to separate one record from the next.

If your file does not adhere to these conventions, it is called a binary file. Typically, binary files do not have the usual record separators, and they may use any binary codes, including unprintable control characters. If you want to read a binary file, you must specify RECFM=N in the INFILE statement and use the byte operand (<) in the INPUT statement to specify the length of each item you want read. Treating a file as binary enables you to have direct access to a file position by byte-address using the byte operand (>) in the INPUT or PUT statement.

You write data to an external file using the FILE and PUT statements. The output file can be text or binary. If your output file is binary, you must specify RECFM=N in the FILE statement. One difference between binary and text files in output is that the PUT statement does not put the record-separator characters on the end of each record written for binary files.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.