HP Business BASIC/XL Reference Manual - HP 3000 MPE/iX Computer Systems - Edition 1 (32715-90001)

3- 42
An external routine is called with the CALL statement. An external
function can be called with either the CALL statement or the FNCALL
function; the method depends on the function name and whether its result
can be discarded. Table 3-32 tells how to call each type of external
subunit.
Table 3-32. External Subunit Calls
---------------------------------------------------------------------------------------------
|| | |
| External Routine | Dependency | How to Call |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| Subprogram | None. | Use CALL statement. |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| Function | Return value can be thrown away. | Use CALL statement. |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| Function | Internal name is a legal HP | Call as a user-defined function is |
| | Business BASIC/XL function name. | called. |
|| | |
---------------------------------------------------------------------------------------------
|| | |
| Function | Internal name is not a legal HP | Call FNCALL function. |
| | Business BASIC/XL function name. | |
|| | |
---------------------------------------------------------------------------------------------
FNCALL is a predefined function that takes a function call as its
parameter. Executing an FNCALL call is equivalent to executing the
parameter (a function call). An internal function (a predefined function
or function defined by the program) cannot be called with FNCALL. An
external function with an illegal HP Business BASIC/XL function name
must be called with FNCALL. An FNCALL call can appear wherever a user-
defined function call can appear.
Examples
10 INTRINSIC ("Isubs") Sub1 !Declares intrinsic subprogram
15 CALL Sub1 !Calls intrinsic Sub1
20 EXTERNAL Sub2 !Declares external subprogram
25 CALL Sub2 !Calls external Sub2
30 INTRINSIC Irr_result1 !Function with irrelevant result
35 CALL Irr_result1
40 EXTERNAL REAL Irr_result2 !Function with irrelevant result
45 CALL Irr_result2
50 INTRINSIC FNRead !Function with legal name
55 C$=FNRead
60 EXTERNAL REAL FNWrite ALIAS "Write" !Function with legal name
65 Real1=FNWrite
70 EXTERNAL INTEGER Store (REAL X) !Function with illegal name
71 !to show use of FNCALL
75 Int1=FNCALL(Store(Real1))
80 INTRINSIC Getfile ALIAS "Get_file" !Function with illegal name
81 !aliased to legal name
85 IF FNCALL(Getfile("File2")) THEN CALL Sub1
99 END