6 - 12 6 - 12
MELSEC-Q
6 I/O Processing of Data Files
6.4 Caution on Handling Data Files
6.4.1 Handling data files during multitask processing
When data is input or output to the same data file simultaneously by multiple programs
during multitask processing, it is processed as follows.
• Random files can be opened by multiple programs simultaneously.
In such cases, the OS of the communication module will perform exclusive control for
each data I/O instruction, so the user does not have to perform any exclusive control.
• Sequential files can be opened by multiple programs simultaneously only during input
processing (INPUT mode) or during append processing (APPEND mode). In such
cases, the OS of the communication module will perform exclusive control for each
data I/O instruction, so the user does not have to perform any exclusive control.
Example
When two programs are concurrently running and sequential file ABC.DAT in drive 0
is to be read.
A
A
Program
A
MELSEC
AD51H
BASIC
<EOF>
ABC.DAT file
in Drive
0
When data is read in order of 1), 2) and 3):
"MELSEC" is stored in A$ of Program A "AD51H" is stored in B$ of Program B
"BASIC" is stored in C$ of Program A
OPEN "0 : ABC. DAT" FOR INPUT
INPUT#1, A$
INPUT#1, C$
OPEN"0:ABC.DAT"FOR INPUT
A$ #1
A$ #2
INPUT #2, B$
Program
B
1)
2)
3)
Perform exclusive control using the ZRESERVE/ZRELEASE functions when all the
data is to be read by program A or program B. For details on exclusive control, see
Section 8.2.
• Always perform exclusive control using ZRESERVE/ZRELEASE functions when output
processing (OUTPUT mode) is to be used by one of the programs.
If the exclusive control is not used, an error may be generated in the program that opened
the file simultaneously. For details on exclusive control, see Section 8.2.