3 - 6 3 - 6
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.2.3 Editing a program
If there is an error in a created program or if a program requires improvement, the
program must be edited. There are two ways of editing a program.
(1) Line-by-line edition
This is a way of re-entering one line of a program at a time.
This is also used to add new lines and delete single lines.
• In order to edit a line, re-enter the entire line, starting with the line number and
finishing at the end of the instruction; then press Enter .
• If an already existing line number is entered, the new contents will overwrite the
old without any confirmation.
• In order to add a new line, enter a line number that is greater than the very last
line of the program as the line number, enter the instruction, and press Enter .
to
120 PRINT "END"
To add a line, choose a line number
greater than 120.
Example
130 PRINT “BYE!!” Enter
• In order to insert a line, enter a line number that lies between line numbers of
the current program, enter the instruction, and press Enter .
to
10 INPUT "Production Target" ; A
20 IF A=0 GOTO 120
to
To insert a line between lines 10 and
20, choose a line number between 10
and 20.
Example
15 IF A<0 GOTO 10 Enter
• In order to delete a line, simply enter the line number and press Enter .
to
30 PRINT "Time" ; TIME$
to
Inputting 30 Enter will delete line 30.
• To delete all lines within a certain range at one go, use the DELETE instruction.
Example
DELETE 600 • • • • • • • • • Deletes only line 600.
DELETE 300-400 • • • • • • Deletes the lines in between lines 300 and 400.
DELETE -500 • • • • • • • • • Deletes all the lines from the first line to line 500.
The changes made to the program as shown above can be verified by using the
LIST instruction. The program displayed using the LIST instruction will be sorted
by line number.
• To pause the list display, press the Ctrl + S keys.
• To continue the list display, press any key other than the Ctrl + C keys.
• To stop the list display, press the Ctrl + C keys.