PV-WAVE Foundation > Programmer Guide > Statement Types > Procedure Call Statement
Procedure Call Statement
PROCEDURE_NAME, p1, p2, ..., pn 
The Procedure Call statement invokes a system, user-written, or externally defined procedure. The parameters which follow the procedure’s name are passed to the procedure. Control resumes at the statement following the Procedure Call statement when the called procedure finishes.
Procedures may come from the following sources:
*System procedures built into the PV-WAVE executable file.
*User-written procedures compiled with the .RUN command.
*User-written procedures that are compiled automatically. See
"Automatic Compilation of Functions and Procedures".
*Standard Library procedures that are installed with PV-WAVE.
Examples
ERASE
This is a procedure call to a subroutine to erase the current window. There are no explicit inputs or outputs. Other procedures have one or more parameters. For example:
PLOT, Circle
calls the PLOT procedure with the parameter Circle.
Positional Parameters and Keyword Parameters
Parameters passed to procedures and functions are identified by their position or by a keyword.
The position of positional parameters establishes the correspondence of parameters in the call and those in the procedure or function’s definition.
A keyword parameter is a parameter preceded by a keyword and an equal sign (=) that identifies the parameter.
For example, the PLOT procedure can be instructed to not erase the screen and to draw using color index 12 by either of the calls:
PLOT, X, Y, Noerase = 1, Color = 12
or:
PLOT, X, Y, Color = 12, /Noerase
The two calls produce identical results. Keywords may be abbreviated to the shortest non-ambiguous string. The /Keyword construct is equivalent to setting the value 1. For example, /Noerase is equivalent to Noerase=1.
 
note
When shortening a keyword, you should always use at least three characters to ensure that PV-WAVE correctly identifies the keyword. Otherwise, as new keywords are added to routines, it is possible for PV-WAVE to misidentify a new keyword as an older keyword.
In the previous examples, X is the first positional parameter, because it is not preceded by a keyword. Y is the second positional parameter.
Calls may mix arguments with and without keywords. The interpretation of keyword arguments is independent of their order. The placement of keyword arguments does not affect the interpretation of positional parameters—keyword parameters may appear before, after, or in the middle of the positional parameters.
Keyword parameters offer the following advantages:
*Procedures and functions may have a large number of arguments, any of which may be optional. Only those arguments that are actually used need be present in the call.
*It is much easier to remember the names of keyword arguments, rather than their order.
*Additional features can be added to existing procedures and functions without changing the meaning or interpretation of other arguments.
More On Parameters
Parameters may be of any type or structure, although some system procedures, as well as user-defined procedures, may require a particular type of parameter for a specific argument.
Parameters may also be expressions which are evaluated, used in the call, and then discarded. For example:
PLOT, SIN(Circle)
The sine of the array Circle is computed and plotted, then the result of the computation is discarded.
Parameters are passed by value or by reference. Parameters that consist of only a variable name are passed by reference. Expressions, constants, and system variables are passed by value. The two passing mechanisms are fundamentally different. The called procedure or function may not return a value in a parameter that is passed by value, as the value of the parameter is evaluated and passed into the called procedure, but is not copied back to the caller. Changes made by the called procedure are passed back to the caller if the parameter is passed by reference. For more details, see "Parameter Passing Mechanism".