6 - 8 6 - 8
MELSEC-Q
6 I/O Processing of Data Files
• When reading data from a random file, the data block from a desired <record
number> is placed in the "file buffer" by the GET instruction. The data stored in the
"file buffer" is read into general variables using instructions such as the LET
instruction.
• Do not use character variables defined by the FIELD instruction with input instructions such as
INPUT or in the left side of the LET instructions. If it is used, it can no longer be used as a file buffer.
• Data from random files will not be erased from the record such as memory cards and FD even if the
files are opened to create a new file.
Be careful to handle data that isn't yet written because it is not defined.
• Once numeric data are converted to character data and written into a file, use
functions such as VAL function to read the data and convert them into numeric data.
However, character data converted using MKI$, MKS$, or MKD$ function must be
converted into numeric data using the CVI, CVS, or CVD functions.
Character data is placed directly into the file buffer using the LSET or RSET
instruction, and then written into a file using the PUT instruction.
• The following useful functions can be used when using random files.
• LOC (File number)
• • • • • • • • • Provides the record number that has been
accessed (read or written) by GET or PUT
instruction immediately before the specified
random file is used.
• LOF (File number)
• • • • • • • • • Provides the last record number for the
specified random file.
See an Example for practical use.
Random files have no mode separation between reading and writing. Both reading
and writing can be performed once the OPEN or FIELD instruction is executed.
REMARK
• A maximum of 32767 records can be used for one random file.
• If data is written to a record that already contains data, the previous contents will
be overwritten by the new data.
Содержание A1SD51S
Страница 183: ...11 13 11 13 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS RUN Before swap A 0 H924 A 1 H1159 After swap A 0 H1159 A 1 H924 OK...
Страница 331: ...11 161 11 161 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CON ON OFF STOP and ZOPEN functions and Section 7 4...
Страница 557: ...11 387 11 387 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the CHR SPACE and SPC functions...
Страница 629: ...11 459 11 459 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZOPEN ZSEND and ZCNTL instructions and Section 7 3 4...
Страница 645: ...11 475 11 475 MELSEC Q 11 INSTRUCTIONS AND FUNCTIONS REMARK See the ZEVENT ZSIGNAL and DEF ZEVENT instructions...