CALL Verb - BBj

For this topic's original documentation, see the CALL Verb.

BBj-Specific Information

Syntax

CALL fileid{::label}{,ERR=lineref}{,expr...}

Description

In BBj, expr… can include object variables, object arrays and object expressions.

A simple object variable, like X!, must be passed to a simple object variable in the ENTER list.

A BBj object array created with the DIM Verb must be passed to an object array reference in the ENTER list.

A Java array created with the new operator must be passed to a simple object variable in the ENTER list.

An object expression can be passed to any variable type for which assignment is valid.

The original BBx CALL Verb documentation says, "The same call-by-reference argument can only appear once in the argument list." Prior to BBj 16, BBj inadvertently did not enforce this rule. This oversight was corrected in BBj 16, but some applications may include code that violates this rule. If updating the application is impractical, the ALLOW_DUPLICATE_CALL_VARS !COMPAT setting can be set to TRUE in BBj 17 and higher to allow the original more lenient BBj behavior.

See ENTER for additional information.

Example 1

An object variable must be passed to an object variable:

CALL "subprog",X!
...
ENTER Y!

Example 2

A BBj object array must be passed to an object array:

DIM X![10]
CALL "subprog",X![ALL]
...
ENTER Y![ALL]

Example 3

Any expression involving objects can be passed to any variable type for which a corresponding assignment would be legal:

X!=23
CALL "subprog",(X!); REM ' parentheses make it an expression
...
ENTER Y!; REM ' OK - object variable can accept any expression
ENTER N; REM ' OK – LET N=X! is legal for X!=23
ENTER I%; REM ' OK - LET I%=X! is legal for X!=23
ENTER S$; REM ' !ERROR=36 because S$=23 isn't allowed.

Example 4

An object expression that does not evaluate to a number or string must be passed to an object variable.

CALL "subprog",new java.lang.ArrayList()
...
ENTER myList!

Example 5

A Java array created with the new operator must be passed to a simple object variable (array!, not array![]).

restore 0
dim x![3]
dread x![]
print "Call with BBx array: ",x![]
call pgm(-2)+"::array",x![]
restore 0
y! = new int[4]
dread y![]
print "Call with Java array object: ",y![]
call pgm(-2)+"::object",y!
stop
data 0,1,2,3
array:
enter array![]
print array![]
exit
object:
enter object!
print object![]
exit

See Also

Verbs - Alphabetical Listing