3 - 47 3 - 47
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
3.15 Executing a Large Program by Dividing it up
A large program that doesn't fit into memory cannot be executed. However, if a large
program can be divided and saved into smaller programs and then executed one by
one, it is possible to yield the same result of running one large program.
It is possible in AD51H-BASIC to execute a program that has been divided up by using
the following procedure.
1. When the variable contents do not
have to be transferred
• • • • • • • • • The LOAD and RUN
instructions are used.
2. When the contents have to be
transferred
• • • • • • • • • The CHAIN instruction is
used.
3. When a portion of the program is
shared
• • • • • • • • • The CHAIN instruction is
used.
(1) When the variable contents do not have to be transferred
When there is no need to transfer the contents of variables that are used in the
current program to the next program, use the RUN "Program Name" instruction
or the R option in the LOAD instruction to execute the new program.
10 PRINT "Program B executed!!"
20 PRINT " A=" ;A
30 END
SAVE " PRO-B"
OK
NEW
OK
10 PRINT "Program A executed!!"
20 A=100
30 PRINT " A=" ;A
40 RUN " 0:PRO-B"
SAVE " PRO-A"
OK
RU N
Program A executed!!
A= 100
Program B executed!!
A= 0
OK
LOAD " 0:PRO- B" Same as LOAD "0:PRO-B",R.
The content of the
variable is not
transferred.
…………
……
Variable
contents
B
A
I'm not going to give you
the variable.