Omron SYSMAC CV500-BSC11 Operation Manual page 101

Basic units
Table of Contents

Advertisement

File Operations
90
270 *WRT
. . . . . . . . . . . . . . . . . . . .
280 INPUT "Record no. (1–999):";REC%
290 IF REC%>999 THEN ERROR 1
300 IF REC%<1 THEN ERROR 2 Sets error generation number (ERR =
310 LINE INPUT "DATA:";C$
320 PRINT "Writes data (Y/[ELSE])"
330 D$=INKEY$
. . . . . . . . . . . . . .
340 IF D$="" THEN GOTO 330
350 IF D$=< >"Y" AND D$< >"y" THEN RETURN
360 LSET A$=C$
. . . . . . . . . . . . .
370 PUT #1, REC%
. . . . . . . . . . .
380 RETURN
. . . . . . . . . . . . . . . . . .
390 '
400 *RD
. . . . . . . . . . . . . . . . . . . . . .
410 INPUT "Record no. (1–999):";REC%
420 IF REC%>999 THEN ERROR 1
430 IF REC%<1 THEN ERROR 2
440 GET #1, REC%
. . . . . . . . . . .
450 PRINT A$
460 RETURN
. . . . . . . . . . . . . . . . . .
470 '
480 *ERPTCS
. . . . . . . . . . . . . . . . .
490 IF ERR=1 THEN PRINT "Record no. is too large."
500 IF ERR=2 THEN PRINT "Record no. is too small."
510 IF ERL=440 THEN PRINT "The record no. has NO data."
520 '
530 RESUME 140
540 END PARACT
Result of execution
Input [W] to write file.
Input [R] to read file.
Input [E] to end.
Record No. (1–999):? 3
Data: 3
Writes data (Y/[ELSE])
Input [W] to write file.
Input [R] to read file.
Input [E] to end.
Record No. (1–999):? 4
Data: 4
Writes data (Y/[ELSE])
Input [W] to write file.
Input [R] to read file.
Input [E] to end.
Record No. (1–999):? 3
3
Input [W] to write file.
Input [R] to read file.
Input [E] to end.
Data file size is 4.
Write subroutine
Sets error generation number (ERR =
1)
2)
Inputs 1 character from keyboard
Sets data in buffer
Writes buffer data
End of write subroutine
Read subroutine
Reads data to buffer
End of read subroutine
Error processing routine
When reading data fails
Section 5-2

Advertisement

Table of Contents
loading

Table of Contents