Arnold,
With below code, don't you expect that the last *REC statement will overwrite the values previously stored in NNNN. Let's say first *REC writes a value 200 in NNNN, then when second *REC calculates the value as 300, Ideally you would have wanted a value of 500 to be written, but it will overwrite200 by 300. Isn't it?
*WHEN ACCOUNT
*IS JJJ
*REC(first version)
*ENDWHEN
*COMMIT
*WHEN ACCOUNT
*IS JJJ
*REC(second version)
*ENDWHEN
*COMMIT
Can I suggest below (I am not very sure if it will work, but you may want to try this once) -
*WHEN ACCOUNT
*IS "JJJJ"
*REC(EXPRESSION = %VALUE% + GET(ACCOUNT = "XXX") + GET(ACCOUNT = "YYY").. ,
ACCOUNT= "NNN")
*ENDWHEN
*COMMIT
--Scoping again--
*WHEN ACCOUNT
*IS "NNNN"
*REC(EXPRESSION = %VALUE% - GET(ACCOUNT = "PPP") - GET(ACCOUNT = "MMM"))
*ENDWHEN
*COMMIT
--Scoping again--
*WHEN ACCOUNT
*IS "NNNN"
*REC(EXPRESSION = %VALUE% - GET(ACCOUNT ="LLLL") - GET(ACCOUNT = "SSS"))
*ENDWHEN
*COMMIT