How do I access variable values from previous iteration in a subroutine (other than USDFLD)?

I am trying to do something like this:
 
SUBROUTINE HETVAL

real (kind=8) :: inputVariable

real (kind=8) :: resultVariable

*calculation of inputVariable*

resultVariable = inputVariable (current) - inputVaraible(from previous iteration)

END SUBROUTINE HETVAL


STATEVs are only updated every new iteration in USDFLD and not in other subroutines. Any update in STATEV in HETVAL is saved at the end of an increment and not the end of an iteration. I have confirmed this. Thus, using State Defined Variables does not serve my purpose here. 

I want a way to use the value of a variable defined in HETVAL to use it in the next iteration.

Any help would be appreciated :)