Your result is odd...
almost like the opposite of LAST.
Don't you really mean for the COMPUTE to be after the data read?
Is this the result you're looking for?
APP APPENDPATH IBISAMP
TABLE FILE GGSALES
SUM
-*COMPUTE CAT/A8 = FMLFOR('A8');
DOLLARS
COMPUTE CAT/A8 = FMLFOR('A8');
FOR
CATEGORY
'Coffee' AS 'Original Coffee line' LABEL R0 OVER
'Coffee' AS 'Original Coffee line' LABEL R1 OVER
RECAP
CR1 = IF R1 GT 4200000 THEN R1 ELSE 0;
CR1(1) = FMLFOR('A8');
AS 'Recap coffee line' OVER
'Food' AS 'Food' LABEL R2 OVER
RECAP
FR2(1) = FMLFOR('A8'); AS 'Recap food line' OVER
'Gifts' AS 'Gifts' LABEL R3
ON TABLE NOTOTAL
END
The docs give this example......
SET FORMULTIPLE = ON
TABLE FILE LEDGER
SUM AMOUNT
COMPUTE RETURNEDFOR/A8 = FMLFOR('A8');
FOR ACCOUNT
1010 OVER 1020 OVER
1030 OVER
BAR OVER
1030 OR 1020 OR 1010
END
the output is.....
AMOUNT RETURNEDFOR
------ -----------
1010 8,784 1010
1020 4,494 1020
1030 7,961 1030
------ --------
1010 21,239 1030
WebFocus 7x, 8x, Win / Linux, any output format