Data Files And Access Methods; Stream I/O Data Files; Record I/O Files - IBM 5110 Basic Reference Manual

Hide thumbs Also See for 5110:
Table of Contents

Advertisement

74
DATA FILES AND ACCESS METHODS
The IBM 5110 is capable of processing two distinct types of data files: stream
I/O and record I/O. Each of these files is described below.
Stream I/O Data Files
Stream I/O data files are useful for collecting streams of variable-length data
items and storing them in sequential order as records in a tape or diskette file.
Stream I/O files must be opened (see OPEN statement) before they can be
accessed, using the PUT statement to store data items in the file and using the
GET statement to retrieve data items from the file. These files are organized
for sequential access (one record after another in the order the records were
entered). These files must also be closed after being used (see CLOSE
statement).
The data items within each logical record of a stream I/O file must be
separated by a comma. When numeric data items are read from the file, the
system retrieves them in succession and converts them into internal numeric
format. When character data items are read from the file, the system locates
the next non blank character, ignoring the comma separators. If the retrieved
character is a single quotation mark, the data item following must be a valid
character constant. The end of the character constant is indicated by its
closing single quotation mark. If the first character retrieved by the system is
not a single quotation mark, the end of the character data item is indicated by
the next comma. Thus, to have a comma in the character string, the entire
character string must be enclosed in single quotation marks.
Record I/O Files
Record I/O files are useful for collecting related numeric and character data
items and storing them as a unit in a fixed-length logical record. These files
must be opened before you can access them using the WRITE FI LE statement
to store data items in the file and the READ FILE statement to retrieve data
items from the file. Record I/O files can be accessed sequentially, directly, or
key indexed.
Sequential Access
A record I/O file can be accessed in the order in which the records were
placed in the file. This is called sequential access. Sequentially accessed files
allow you to:
• Read records using READFILE
• Read and update records using READFILE followed by REWRITEFILE
• Add records to the end of a data file using WRITEFILE
,/-~.-"
/~.-"-.
\
"-_
..
'
/'
'
(

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents