The call control statement calls a subroutine which must be defined by a previous sub statement.


Call name ( [ paramlist ])



Argument Description
name The name of the subroutine.
paramlist A comma separated list of the actual parameters to be sent to the subroutine. Each item in the list may be a field name, a variable or an arbitrary expression.

The subroutine called by a call statement must be defined by a sub encountered earlier during script execution.

Parameters are copied into the subroutine and, if the parameter in the call statement is a variable and not an expression, copied back out again upon exiting the subroutine.


Since the call statement is a control statement and as such is ended with either a semicolon or end-of-line, it must not cross a line boundary.

Example 1:  

// Example 1

Sub INCR (I,J)

I = I + 1

Exit Sub when I < 10

J = J + 1

End Sub

Call INCR (X,Y)


Example 2:  

// Example 2 - List all QV related files on disk

sub DoDir (Root)

For Each Ext in 'qvw', 'qvo', 'qvs', 'qvt', 'qvd', 'qvc'

For Each File in filelist (Root&'\*.' &Ext)


'$(File)' as Name, FileSize( '$(File)' ) as

Size, FileTime( '$(File)' ) as FileTime

autogenerate 1;

Next File

Next Ext

For Each Dir in dirlist (Root&'\*' )

Call DoDir (Dir)

Next Dir

End Sub

Call DoDir ('C:')