1.2.8.1 The CALL statement

The CALL statement is used to invoke a subroutine from another procedure. The called routine must be defined before it can be called.

call-statement.gif

The driver executes all statements of the called procedure and then resumes

Examples

The example below, taken from the Tandberg-Alteia device driver, shows a common application of a subroutine. The subroutine getAck is called every time the driver sent a command to the IRD to check if the unit accepted the command.

    // called after sending a command to the IRD. checks the ACK response which is
    // expected.
    // 
    PROC SUBROUTINE getAck
        INPUT "=" TRM "_" internal.ack
        IF internal.ack = "ACK" GOTO endif
            SET faults.commstat = "ACK expected"
            SET faults.99 = "true"
        :endif