Manipulating Data Files - Omron SYSMAC CV500-BSC11 Operation Manual

Basic units
Table of Contents

Advertisement

File Operations
Feature
Sequential access file
Data access
Can only be read from beginning
Data length
Can be changed freely
Changing data
Entire file must be updated
Adding data
Data is written at the end of file
Data type
Numeric data, character data

5-2-2 Manipulating Data Files

File Names
Caution
!
Opening/Closing Files
Opening
The sequential access file and random access file each have their own features,
seen as follows:
Can be read/written starting from any location (in record units)
Fixed
Can be changed in record units
Can be written to any position
Numeric data must be converted into character data
To input/output a file, a memory area called a buffer is used to temporarily store
data. The number assigned to this buffer is called a file number. One buffer cor-
responds to one file, and therefore, one buffer cannot be used by more than one
file. The file numbers that can be used are from #1 through #15. This means that
the maximum number of data files that can be simultaneously used is 15.
Data
With the BASIC Unit, the data file can be read only by the memory card. In this
case, a file name must be given to the file. A file name must consist of eight char-
acters or less and start with an alphabetic character. A device name 0: is pre-
fixed to the file name to access the memory card. In addition, an extension con-
sisting of up to three characters can also be suffixed.
"0:MFILE.DAT"
. . . . . . . . . . . . . .
If the file name consist of 9 or more characters, or if the extension consists of 4 or
more characters, the excess characters are ignored and thus not recognized. A
period (.) must proceed the extension. A file name can also be specified in char-
acter string.
Although file names in the BASIC Unit can consists of any characters except:, .,
and blanks, lowercase letters and the ¥ symbol can cause problems on DOS
machines and should be avoided.
A file is opened by the OPEN command. Once a file has been opened, the file
number assigned to that file must not be used by any other files until closed by
the CLOSE command. The OPEN command specifies a file name, mode, and file
number. The mode does not need to be specified for a random access file.
Opening Sequential Access File
OPEN "0:DATA2" FOR OUTPUT AS #1
Three modes can be specified: INPUT (to read data from a file), OUTPUT (to write
data to the file), and APPEND (to add data to the file).
Opening Random Access File
OPEN "0:SAMPLE" AS #1
If the mode is omitted, the random access file is assumed.
Random access file
Buffer
File
Memory card
#1 - #15
0 is the device (0: memory card),
MFILE is the file name, and DAT (pre-
ceded by ".") is the extension
0:DATA2 is the device and file name,
OUTPUT is the mode setting, and #1 is
the file number.
0:SAMPLE is the directory and file
. . . . .
name, and #1 is the file number.
Section 5-2
85

Advertisement

Table of Contents
loading

Table of Contents