3 - 48 3 - 48
MELSEC-Q
3 LET'S CREATE AND EXECUTE A PROGRAM
(2) When the contents have to be transferred
The CHAIN instruction is used when the variable used in the program currently
being executed must be transferred to the next program. When all of the used
variables are to be transferred, the ALL option of the CHAIN instruction is used.
The COMMON instruction is used when certain variable contents are to be
transferred.
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 CHAIN " 0:PRO-B" , 10, ALL
SAVE " PRO-A"
OK
RU N
Program A executed!!
A=100
Program B executed!!
A=100
OK
This is an example of all variables being
transferred.
The contents of the
variable have been
transferred.
…………
……
B
All variables
being used.
A
When the ALL option is specified
in the CHAIN instruction
Take them all, OK?
B
Variables
specified
in COMMON.
COMMON
A, B$, C% (1)
A
Just take the variables
specified in COMMON.
When the COMMON instruction is used.
Variables not specified in COMMON.
Variable
contents