The call command is used to call a subroutine to be executed.
When a subroutine is called to begin execution there is a specified order of events that occur. First, if there are any arguments in the argument list that are mathematical expressions, those expressions are evaluated right away. Second, the arguments in the argument list are associated with their corresponding dummy arguments in the subroutine. Remember that the subroutine will have no knowledge of the variable names in the main program. The only thing that the subroutine knows is the location in memory of the argruments contained in the argument list and not the actual names of those arguments or of any other variables in the main program. This means that the dummy arguments in the subroutine can be named anything you like. Finally, control is passed to the subroutine and the subroutine is executed. For more information on the use of subroutines take a look at lecture eight.
The form of the call statement is pretty basic. The call command comes first followed by the name of the subroutine to be executed and the argument list. The argument list (sometimes refered to as the "calling sequence") can contain constants, variables or mathematical expressions. This generally results in a line of code that looks similar to this one:
Please note that the variable forces in this example is an array and the variables low and high are its bounds. The subroutine named "sub1" might begin as follows:
subroutine sub1(delt, ym, F, ilb, iub) integer ilb,iub real delt, ym, F(ilb:iub)
Within the subroutine "delt", "ym", "F", "ilb", and "iub" are called "dummy arguments", because they simply provide local names for variables that are declared elsewhere. Actual varible names and corresponding memory location are obtained by a direct one to one match up with the argument list in the CALL statement. Here "delt" is infact the variable "delta", "ym" is "ymod", etc..
examples: grades1.f and add2.f
Written by Jason Wehr : email@example.com and Maintained by John Mahaffy : firstname.lastname@example.org