The call statement allows a procedure to call a separate procedure within the current database as a subroutine.


This statement has two parameters:

procedure – is the name of the procedure to call. If the procedure name does not have any spaces or punctuation, no quotes are required. You can also use a formula to calculate the procedure name “on the fly.”

parameters – is a list of parameters to be passed to the subroutine. This list is optional, you don’t have to pass any parameters if you don’t need to. See parameter( and setparameter for more information on accessing parameters within a subroutine.


This statement allows a procedure programmer to execute a second procedure as a subroutine to the first procedure. Subroutines become important when you wish to use the same code at different times within the same procedure or from within multiple procedures. Creating a subroutine allows you to write the code once and use it again and again rather than duplicating the same code over and over again.

Subroutines normally finish when the end of the procedure is reached. To stop the subroutine before the end of the procedure, use the return statement. The return statement makes Panorama return control to the original procedure.

This simple example shows how to call a procedure called Summarize.

call Summarize

This example calls a subroutine named Calculate %. The subroutine’s name is more than one word and contains symbol characters.

call "Calculate %"


When you call a subroutine you can supply one or more parameters to be passed to the subroutine (each parameter must be separated by a comma). When using the call statement the parameters are listed after the procedure name, like this:

call procedure,parameter1,parameter2,parameter3, ... parameterN

Within the procedure’s source code you can access the parameters with the parameter( function, or change the value of a parameter with the setparameter statement. This is especially useful for accessing the main program’s local variables within the subroutine procedure. Normally the local variables in the calling procedure cannot be accessed within the subroutine, but parameters provide a way to do this. For example, you could create a procedure called AddMultipleRecords to add several records at once:

for i,1,parameter(1)

In any other procedure in the main database you can call this procedure to add multiple records. Here’s how you would add a dozen records:

call AddMultipleRecords,12

You can also use the setparameter statement to modify the value of a parameter passed to the subroutine.

Keeping track of the active database

The call statement works only within the currently active database. That isn’t necessarily the database that contains the call statement. If you use a statement that changes the active database, the call statement will be trying to call a procedure in the database that is associated with the currently active window, not the database that contains the call statement. A similar situation occurs if the calling procedure is itself the subject of a farcall from another database, as described below.

Consider the case where database A issues a farcall to procedure X in database B and procedure X then issues a call to procedure Y, also in database B. Throughout the whole of this process, database A remains the active database and a call from procedure X to procedure Y will fail. In this case, the call to procedure Y must be a farcall.

See Also


10.0No ChangeCarried over from Panorama 6.0