So, you have to subout the DH when the pitcher is replaced.
If you're starter goes 7 innings, the starting DH might get 4 ABs. But, if the SP only goes 5 innings, the starting DH might only get 2 ABs.