The CALL Statement

Syntax

Unlike functions, which can be used in expressions, subroutines can only be called with the CALL statement. That means, the call to a subroutine must be on its program line rather than somewhere in an expression. The following is the syntax rules of the CALL statement:
CALL subroutine-name (arg1, arg2, ..., argn)

CALL subroutine-name ()
CALL subroutine-name
If the called subroutine has formal arguments, the CALL statement that calls that subroutine must have actual argument. This is the first form. However, if a subroutine does not have any argument, it can be called with the second form or the third form.

Semantics

When a CALL statement is executed, values of actual arguments are passed to those formal arguments declared with INTENT(IN) or INTENT(INOUT). Then, statements of the called subroutine are executed. When the execution reaches END SUBROUTINE, values stored in those formal arguments declared with INTENT(OUT) and INTENT(INOUT) are passed back to the corresponding actual arguments in the CALL statement. After this, the next statement following the CALL statement is executed.

The number and types of actual arguments in the CALL statement must match the number and types of the corresponding formal arguments

Examples

Here are some simple examples: