Consider,
PROGRAM CalculatePay IMPLICIT NONE REAL :: Pay, Tax, Delta INTEGER :: NumberCalcsDone = 0 Pay = ...; Tax = ... ; Delta = ... CALL PrintPay(Pay,Tax) Tax = NewTax(Tax,Delta) .... CONTAINS SUBROUTINE PrintPay(Pay,Tax) REAL, INTENT(IN) :: Pay, Tax REAL :: TaxPaid TaxPaid = Pay * Tax PRINT*, TaxPaid NumberCalcsDone = NumberCalcsDone + 1 END SUBROUTINE PrintPay REAL FUNCTION NewTax(Tax,Delta) REAL, INTENT(IN) :: Tax, Delta NewTax = Tax + Delta*Tax NumberCalcsDone = NumberCalcsDone + 1 END FUNCTION NewTax END PROGRAM CalculatePay
Here, NumberCalcsDone is a global variable. It is available in all procedures by host association.
For more information, click here