Chapter 9. Data Files; Activating And Deactivating Files - IBM 5110 Basic Introduction

Table of Contents

Advertisement

( "
"' , ' 1 ,,
.--,/lr
c
c
Chapter 9. Data Files
A file is a collection of related data items that are stored together.
Your system can process both stream-oriented files and
record-oriented files. In a stream-oriented file, all the data items are
stored as a sequential stream of data, in the order in which they are
entered. Data items in a record-oriented file can also be stored
sequentially in the order they are entered, but they can be retrieved
according to an identification field called a key or logical record
number.
For a complete description of stream/record-oriented files, see the
IBM 5110 BASIC User's Guide, SA21-9307.
ACTIVATING AND DEACTIVATING FILES
Files must be activated or opened before they can be used within a
program. A stream-oriented file must be opened by an OPEN
statement in a program. A record-oriented file must be opened by an
OPEN FILE statement. The following example shows the format of an
OPEN statement:
0050 OPEN FL1,'E80',2'INVTY',OUT
FL 1 is the file reference, which can be from FLO to FL9, but must be
the same as the file reference in the GET or PUT statement. 'E80' is
the device address of the tape unit built into the 5110 Model 1. The
number 2 specifies which physical file on tape is going to be used.
This number can be specified as a variable. The word OUT indicates
that the file is to be used for storing data items (with PUT statements)
in the file for use in the program.
If you are opening a file on diskette, replace 'E80' in the sample
statements with '080' (device address of diskette drive 1) and enter
the name of the file on diskette. The file name is required when you
create a file on diskette.
If a record-oriented file were to be created with WRITE FILE
statements, it could be opened as an output file with this statement:
0100 OPEN FILE FL1,'D80',2,'INVTY',OUT,RECL=128
Note: See the IBM 5110 BASIC Reference Manual, SA21-9308, for a
complete description of the OPEN statement.
Data Files
89
( "
"' , ' 1 ,,
.--,/lr
c
c
Chapter 9. Data Files
A file is a collection of related data items that are stored together.
Your system can process both stream-oriented files and
record-oriented files. In a stream-oriented file, all the data items are
stored as a sequential stream of data, in the order in which they are
entered. Data items in a record-oriented file can also be stored
sequentially in the order they are entered, but they can be retrieved
according to an identification field called a key or logical record
number.
For a complete description of stream/record-oriented files, see the
IBM 5110 BASIC User's Guide, SA21-9307.
ACTIVATING AND DEACTIVATING FILES
Files must be activated or opened before they can be used within a
program. A stream-oriented file must be opened by an OPEN
statement in a program. A record-oriented file must be opened by an
OPEN FILE statement. The following example shows the format of an
OPEN statement:
0050 OPEN FL1,'E80',2'INVTY',OUT
FL 1 is the file reference, which can be from FLO to FL9, but must be
the same as the file reference in the GET or PUT statement. 'E80' is
the device address of the tape unit built into the 5110 Model 1. The
number 2 specifies which physical file on tape is going to be used.
This number can be specified as a variable. The word OUT indicates
that the file is to be used for storing data items (with PUT statements)
in the file for use in the program.
If you are opening a file on diskette, replace 'E80' in the sample
statements with '080' (device address of diskette drive 1) and enter
the name of the file on diskette. The file name is required when you
create a file on diskette.
If a record-oriented file were to be created with WRITE FILE
statements, it could be opened as an output file with this statement:
0100 OPEN FILE FL1,'D80',2,'INVTY',OUT,RECL=128
Note: See the IBM 5110 BASIC Reference Manual, SA21-9308, for a
complete description of the OPEN statement.
Data Files
89

Advertisement

Table of Contents
loading

Table of Contents