11 - 362 11 - 362
MELSEC-Q
11 INSTRUCTIONS AND FUNCTIONS
RESTORE
Instruction
RESTORE
• Specifies a line number in such a way that a subsequent READ instruction reads values of
the DATA instruction, starting from the first data in the DATA instruction in the specified
line number.
RESTORE [<line number>]
Syntax
line number
• • • •
Specify the line number of the next DATA instruction
to be read.
Examples
RESTORE 60
• • • •
Starts reading data in the DATA instruction in line 60.
Description
• The RESTORE instruction specifies a line number in such a way that a subsequent READ
instruction reads values of the DATA instruction, starting from the first data in the DATA
instruction in the specified line number.
• If <line number> is omitted, the READ instruction after the execution of the RESTORE
instruction reads values from the first DATA instruction in the program.
• If <line number> is specified, the READ instruction after the execution of the RESTORE
instruction starts reading from the first value of the DATA instruction in the specified line
number.
• <line number> can also be specified using a label name.
Program Example
10 ' This program specifies the position of data read by the READ instruction, using the RESTORE
instruction
20 RESTORE 200
:
' Reads data in line 200
40 READ A$,B$,C$:PRINT A$,B$,C$
:
' Reads and display the data
60 RESTORE 100
:
' Reads data in line 100
80 READ A$,B$,C$:PRINT A$,B$,C$
:
' Reads and displays the data
90 END
100 DATA Tokyo, Osaka, Nagoya
200 DATA Sapporo, Sendai, Kanazawa
RUN
Sapporo
Sendai
Kanazawa
Tokyo
Osaka
Nagoya
OK
REMARK
See the READ and DATA instructions, and Section 3.5.2.