In Rom 7 Paul is speaking about the effect of the law of Moses on carnal Israel (see Rom 7:14). But the author of Ps 119 (although sinful) is not carnal in the biblical sense, because he had the word of God in his heart. The biblical idea of being carnal or fleshly describes the person whose heart is devoid of the word of God, and therefore not animated by it. But the psalmist had the word of God in his heart, and claimed to have been a keeper of torah.
The verse that proves that the author of Ps 119 had the law in his heart is v. 11:
I have stored up your word in my heart.And there are many verses that prove that the psalmist was a keeper of torah:
I have kept your testimonies (v. 22);
I do not turn away from your law (v .51);
I … keep your law (v. 55);
This blessing has fallen to me, that I have kept your precepts (v. 56);
I hasten and do not delay to keep your commandments (v. 60);
I am a companion of all who fear you, of those who keep your precepts (v. 63);
Before I was afflicted I went astray, but now I keep your word (v. 67);
... with my whole heart I keep your precepts (v. 69);
I have not forgotten your statutes (v. 83);
I have not forsaken your precepts (v .87);
I understand more than the aged, for I keep your precepts (v. 100);
I do not turn aside from your rules, for you have taught me (v. 102);
I do not forget your law (v. 109);
I do not stray from your precepts (v. 110);
I have done what is just and right (v. 121);
Your testimonies are wonderful; therefore my soul keeps them (v. 129);
I do not forget your precepts (v. 141);
I do not swerve from your testimonies (v. 157);
I do your commandments (v. 166);
My soul keeps your testimonies (v. 167);
I keep your precepts and testimonies (v. 168);
I do not forget your commandments (v. 176).We Protestants are so quick to say that no one (apart from Christ) can keep the law, but the author of Ps 119 clearly claimed to have kept God’s law. Either the author of Ps 119 was wrong, or we have to nuance our view of Paul in some way.
But if the psalmist truly kept God’s law, how was this possible? He was able to keep the law because God had taught him (v. 102). The psalmist acknowledged that it was only as God enlarged his heart that he would be able to run in the way of torah (v. 32). He prayed that God would incline his heart more and more to torah (v. 36). In other words, the psalmist kept the law (in the context of covenant grace) because the law had been written in his heart. But how did it get there? The only way that God’s law can ever get into a person’s heart is through the operation of the Holy Spirit writing it there as per the principle reflected in Ezek 36:26-27.
When a person has the word of God in their heart, they will live. This is a basic biblical truth (1 Pet 1:23). The word of God that the psalmist knew was the teaching (i.e., the torah) of Moses and the prophets. The word of God that was in his heart was the law of Moses. Therefore, the law of Moses made him live. This is not just my opinion, but also that of the psalmist:
I will never forget your precepts, for by them you have given me life (v. 93).The psalmist believed that he had received life through the law of Moses. This is why the law was his comfort (v. 52). The law to him was not just command, but also promise and grace; therefore, it was able to give life.
Taking God at his promise that those who (through the grace of God) keep covenant with God will be blessed, the psalmist also prayed that God would be gracious to him and save him on the basis of the fact that he was a keeper of torah (unlike the wicked):
Let your mercy come to me, that I may live; for your law is my delight (v. 77);
I am yours; save me, for I have sought your precepts (v. 94);
Turn to me and be gracious to me, as is your way with those who love your name (v. 132);
Look on my affliction and deliver me, for I do not forget your law (v. 153);
Salvation is far from the wicked, for they do not seek your statutes (v. 155).So I think it is wrong to say that Rom 7 applies to the author of Ps 119 in a straightforward way. Romans 7 only applies to the psalmist in an indirect way, in the sense that the curses of the covenant came down upon everyone in Israel, upon the spiritual as well as the carnal, meaning that the torah of Moses was not able to bring the fullness of blessing and eternal life in a realized sense to anyone.
But the law did give life to the psalmist in some sense. Surely we have to acknowledge that, otherwise we are ignoring the plain content of the psalm. But at the same time, in the bigger picture of Scripture, we have to say that the law of Moses was only able to bring life and blessing to the psalmist in two ways: (1) in a limited way he was blessed to some extent during his lifetime, because he was in a positive covenant relationship with God; but (2) the fullness of life was experienced by the psalmist through the law only in a promissory sense, since the fullness of salvation could only come through Christ and the new covenant (as per Heb 11:39-40).
We need to be able to admit that the law of Moses could bring life, albeit in a limited and promissory sense, during the old covenant age for those who had it written on their hearts. If we can’t admit this, then it seems to me that our understanding of Paul will lack the necessary nuance that reading him in the context of the whole of Scripture provides.