Random File I/O Procedures - Mitsubishi QD51 Programming Manual

Logic controller
Hide thumbs Also See for QD51:
Table of Contents

Advertisement

6 I/O Processing of Data Files

6.3 Random File I/O Procedures

Data
6 - 7
Random files can be used to perform input and output once they are opened. The
following explains how to input and output the random file data:
LSET/RSET instructions
LET instruction
• A random file manages data by separating each record. Numbers are assigned to
each of the records. When data is read or written, the record number is designated
and the data input/output are performed with the file buffer. The numbers placed on
the blocks are referred to as "Record numbers."
• "File buffer" acts as a window when performing I/O with random files. The character
variables defined by the FIELD instruction are used during I/O for the "file buffer."
Therefore, data written into the file buffer must all be character data.
For example, when numeric data is being written, the STR$ function is used to
convert them into character data or they are converted using the following functions
below. Then, they are placed in the file buffer by the LSET or RSET instruction and
written into the file by the PUT instruction.
Integer Data
MKI$(I)
Single-precision Data
Double-precision Data
• When writing data into a random file, the data that is to be written is stored in the "file
buffer" using the LSET and RSET instructions. Then, it is written in an arbitrary
record <record number> by the PUT instruction.
File buffer
$
$
Variable name and size
are defined with
the FIELD instruction
GET/PUT instructions
(Becomes 2 bytes of character data)
MKS$(R)
(Becomes 4 bytes of character data)
MKD$(D)
(Becomes 8 bytes of character data)
MELSEC-Q
MEMORY CARD
A6MEM-512KA-W
Record number 1
Record number 2
Record number 3
Random file
6 - 7

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ad51h-s3Qd51-r24A1sd51s

Table of Contents