
Chapter 8 PAC Language Syntax
8-25
8.16 Calling with a Value and with Reference
It may be desired to pass data to a program when another program is called
from the current program. In this case the data can be passed by adding an
argument list after by the program name to be called. “Calling with a value”
directly passes a value while “calling with reference” passes variables using an
argument passing method.
The commands to call a program are CALL and RUN. For the CALL
command, both calling methods can be used, however, for the RUN command,
only “calling with a value” can be used.
The type of argument passed to a program must match that of the argument
described in the program to be called. Therefore, if a constant is passed, a
type declaration character must be added. And in the program to be called, a
type declaration character must be added to the argument name because the
argument is declared as a local variable.
8.16.1 Calling with a Value
When constants are passed, expressions and character strings always use
values. If a variable is enclosed in parenthesis, it is regarded as an
expression. Thus, even a variable can be passed with a value.
Example: Method of calling a program PROGRAM SUB1 (AA#).
• If a variable is passed as a value CALL SUB1 ( (D1) )
• If a constant is passed CALL SUB1 (10#)
• If an expression is passed CALL SUB1 (D1 + D2)
Note 1: When a variable is passed as a value, calling with a value of
the entire array is impossible. If you write such a calling, it
will be processed as "calling with reference."
Note 2: When an expression is passed, note the type of the result of
the expression. It must be the same as the type of the
argument of the program to be called.
Kommentare zu diesen Handbüchern