In case the initialization part of a processor is bulky
it may be convenient to split it off from the processor proper
into a separate subroutine to be called just once from the root,
so as to have it executed and then out of the way.
Suppose we have the processor BB,
and we split the initialization off into subroutine BBIN
.
This might then look as follows:
SUBROUTINE BBIN +CDE, Q. CALL JZIN ('BB ',0,36,0) IF (IQUEST(1)) 11, 17, 99 C-- Initialize constants if and only if not set from title 11 Q(LQAN+1) = .0025 Q(LQAN+2) = .3 C-- Complete initialization calculating derived constants 17 Q(LQAN+3) = .5 * SIN (Q(LQAN+2)) IQ(LQSV+2) = 0 to reset the entry count from 1 to zero 99 CALL JZOUT ('BB ') RETURN END C===================================================== SUBROUTINE BB +CDE, Q. CALL JZIN ('BB ',0,0,0) IF (IQUEST(1).LE.0) CALL ZFATAM ('BB, NOT INITIALIZED.') CALL MZWORK (...) processor body CALL JZOUT ('BB ') RETURN END C=====================================================
Note that in subroutine BB
it is still wise to check on IQUEST(1)
in case the explicit CALL BBIN
from the main program has been lost.