April 19, 2006, 04:50 PM
wdtrumboROW-TOTAL RECAPS IN FRL(EMR)
For 10+ years we've provided standard income statements and balance sheets using FRL, computing rounded values as follows:
SUM COMPUTE ROUND/P9C=AMOUNT/1000; ROW-TOTAL
ACROSS TYPE
FOR ACCOUNT XXX ,etc.
RECAP TOTAL= LABEL1+LABEL2 etc.
We're migrating from VMS to UNIX 69.2 and the RECAP Row-total isn't working -- it's picking up the row-total of the next account line instead.
If I remove the COMPUTE, it works fine. I tried Computing a total = C1+C2, etc. but the total was off. If I round the data records in advance, the rounded totals aren't accurate enough for financial statements.
This seems a significant bug but the HOTLINE hasn't been able to provide a solution. Help!
April 20, 2006, 03:53 AM
Tony Awdtrumbo,
When ever you are coding for financial reports, stick with the double precision format over the packed decimal (in this case use D9C instead of P9C). This is because of the way the data is held internally and the effect it has over any calculations being performed.
Another possibility (that I would not suggest you follow
) is using the ROUND/D9C in a DEFINE instead. The downside is that you will perform the define against every single data item being read in rather than just for each output row. This not only increases I/O but could degrade the accuracy further.
Try these samples and see the difference in the row totals of the first two reports, and then compare what it should be against the third report. You will see that the second report (using D9C) is more accurate.
TABLE FILE GGSALES
SUM COMPUTE ROUND/P9C = DOLLARS / 1000; AS 'Rounded' ROW-TOTAL
ACROSS REGION
WHERE ST LE 'FL'
FOR PRODUCT
'Biscotti' LABEL LAB01 OVER
'Capuccino' LABEL LAB02 OVER
'Coffee Grinder' LABEL LAB03 OVER
'Coffee Pot' LABEL LAB04 OVER
'Croissant' LABEL LAB05 OVER
'Espresso' LABEL LAB06 OVER
'Latte' LABEL LAB07 OVER
'Mug' LABEL LAB08 OVER
'Scone' LABEL LAB09 OVER
'Thermos' LABEL LAB10
END
TABLE FILE GGSALES
SUM COMPUTE ROUND/D9C = DOLLARS / 1000; AS 'Rounded' ROW-TOTAL
ACROSS REGION
WHERE ST LE 'FL'
FOR PRODUCT
'Biscotti' LABEL LAB01 OVER
'Capuccino' LABEL LAB02 OVER
'Coffee Grinder' LABEL LAB03 OVER
'Coffee Pot' LABEL LAB04 OVER
'Croissant' LABEL LAB05 OVER
'Espresso' LABEL LAB06 OVER
'Latte' LABEL LAB07 OVER
'Mug' LABEL LAB08 OVER
'Scone' LABEL LAB09 OVER
'Thermos' LABEL LAB10
END
TABLE FILE GGSALES
SUM DOLLARS AS 'Rounded' ROW-TOTAL
ACROSS REGION
WHERE ST LE 'FL'
FOR PRODUCT
'Biscotti' LABEL LAB01 OVER
'Capuccino' LABEL LAB02 OVER
'Coffee Grinder' LABEL LAB03 OVER
'Coffee Pot' LABEL LAB04 OVER
'Croissant' LABEL LAB05 OVER
'Espresso' LABEL LAB06 OVER
'Latte' LABEL LAB07 OVER
'Mug' LABEL LAB08 OVER
'Scone' LABEL LAB09 OVER
'Thermos' LABEL LAB10
END
Enjoy
T
April 20, 2006, 02:44 PM
wdtrumboThanks Tony. I've tried defines in every format but it's not accurate. This is a Balance Sheet and the sum of Assets must equal the sum of Liabilities & Equity. When you round and then sum, it doesn't work.
HOTLINE just advised that this is a BUG in UNIX FOCUS so hopefully can be fixed.
Bill Trumbo
April 21, 2006, 03:30 AM
Tony AHi Bill,
A workaround could be to preprocess the data so that you summate AMOUNT BY TYPE and then HOLD. When you produce the FML report from your HOLD file you can then divide by 1000 to get your 'thousands' values to display. This
should lessen the inaccuracy for you, although the extra processing pass might not be preferable depending upon the amount of data you have.
T