T.R | Title | User | Personal Name | Date | Lines |
---|
3004.1 | | BUSY::SLAB | Exit light ... enter night | Wed Apr 09 1997 18:38 | 10 |
|
I'm not sure why it's not working if the edit string you posted is
the one you're using.
Just make sure to use the exact same edit string wherever you're
trying to round a number.
Failing that, post the procedure here and someone will be able to
figure it out for you.
|
3004.2 | Rounding....does this help? | CSC32::COMULADA | | Thu Apr 10 1997 10:38 | 38 |
| The key to getting DATATRIEVE to round the computed
by variable to two decimal points is to use the
FORMAT statement.
DTR> SHOW ROUNDING_PROC
PROCEDURE ROUNDING_PROC
DECLARE A_NUM PIC 99V999.
DECLARE B_NUM PIC 99V999.
A_NUM = 11.856
B_NUM = 2.1234
DECLARE C_NUM COMPUTED BY FORMAT ( A_NUM * B_NUM )
USING 99.99.
PRINT C_NUM
END_PROCEDURE
DTR> :ROUNDING_PROC
C
NUM
25.18
|
3004.3 | Not sure how to include FORMAT | CONSLT::G_WOLSKI | | Thu Apr 10 1997 14:26 | 20 |
| Hi,
Attached is the portion of the procedure with the problem. How would I
include the FORMAT statement when I'm using the AMT USING and TOTAL AMT
USING?
thanks again..
PRINT BADGE_NUMBER, PERSONS_NAME, PROJECT_NUMBER, PROJECT_DESCRIPTION,
PROJECT_SUB_DESCRIP, DIRECT_HOURS, AMT USING $$,$$$,$$$.99
AT BOTTOM OF BADGE_NUMBER PRINT SKIP, " Subtotal:", TOTAL
DIRECT_HOURS,TOTAL AMT USING $$,$$$,$$$.99
AT BOTTOM OF BADGE_NUMBER SPACE
AT BOTTOM OF PAGE PRINT SKIP 2,COL 28,"- Digital Confidential -"
AT BOTTOM OF REPORT PRINT SKIP, "Grand Total:", TOTAL DIRECT_HOURS,
TOTAL AMT USING $$,$$$,$$$.99
END_REPORT
END_PROCEDURE
|
3004.4 | | BUSY::SLAB | Got into a war with reality ... | Thu Apr 10 1997 14:41 | 4 |
|
If AMT is indeed a "computed by" field, we need to see the DECLARE
statement also.
|
3004.5 | Don't see a DECLARE statement | CONSLT::G_WOLSKI | | Thu Apr 10 1997 15:15 | 27 |
|
This is the entire procedure. I don't see a DECLARE statement.
REDEFINE PROCEDURE SEVENSEVEN
READY TIME SHARED READ
:ACT_DOLLARS
FIND AA IN TIME WITH
(COST_CENTER EQUAL "COP", "REP", "3CJ") AND
(YYMMDD_DATE BT FN$GET_SYMBOL("P1") AND FN$GET_SYMBOL("P2")) AND
PROJECT_NUMBER NE "E098-40274", "E098-40629", "E098-40631"
SORT BY PROJECT_NUMBER, COST_CENTER
REPORT AA ON SYS$LOGIN:REPORT07.RPT
SET COLUMNS_PAGE=132
SET REPORT_NAME = "CARDS Labor Tracking System"/
"TCS Charges for Automatic JV Feed"
PRINT BADGE_NUMBER, PERSONS_NAME, PROJECT_NUMBER, PROJECT_DESCRIPTION,
PROJECT_SUB_DESCRIP, DIRECT_HOURS, AMT USING $$,$$$,$$$.99
AT BOTTOM OF BADGE_NUMBER PRINT SKIP, " Subtotal:", TOTAL
DIRECT_HOURS,TOTAL AMT USING $$,$$$,$$$.99
AT BOTTOM OF BADGE_NUMBER SPACE
AT BOTTOM OF PAGE PRINT SKIP 2,COL 28,"- Digital Confidential -"
AT BOTTOM OF REPORT PRINT SKIP, "Grand Total:", TOTAL DIRECT_HOURS,
TOTAL AMT USING $$,$$$,$$$.99
END_REPORT
END_PROCEDURE
|
3004.6 | | BUSY::SLAB | Great baby! Delicious!! | Thu Apr 10 1997 17:03 | 5 |
|
OK, so it appears that AMT is a field in the TIME domain, yes? If
so, I still see no reason why PRINT AMT USING $$.99 doesn't give
you a 2-decimal output.
|
3004.7 | | BUSY::SLAB | Great baby! Delicious!! | Thu Apr 10 1997 17:04 | 6 |
|
Oops, how about posting procedure ACT_DOLLARS also?
If AMT isn't a field in the TIME domain, it might be a declared
variable in that procedure.
|
3004.8 | Sub Proc | CONSLT::G_WOLSKI | | Fri Apr 11 1997 14:10 | 15 |
| Oh.. is this my problem?
DTR> show act_dollars
PROCEDURE ACT_DOLLARS
DECLARE RATE COMPUTED BY BADGE_NUMBER VIA ACT_RATE_TABLE EDIT_STRING
$$$$$.99.
DECLARE AMT EDIT_STRING IS $$$$,$$$.$$ COMPUTED BY
DIRECT_HOURS * RATE.
DECLARE OHRATE COMPUTED BY BADGE_NUMBER VIA ACT_OH_RATE_TABLE
EDIT_STRING
$$$$$.99.
DECLARE OHAMT EDIT_STRING IS $$$$,$$$.$$ COMPUTED BY
OVER_HEAD_HOURS * OHRATE.
END_PROCEDURE
|
3004.9 | | BUSY::SLAB | Wanted: a life. Will pay top dollar. | Sat Apr 12 1997 13:28 | 12 |
|
So, combining your DECLARE statement with Felix's suggestion, we
now have:
DECLARE AMT COMPUTED BY FORMAT (DIRECT_HOURS * RATE) USING
$$$$,$$$,$$9.99.
So in your PRINT statement[s] that contain[s] AMT, you can remove
the EDIT_STRING qualifier since the DECLARE statement already def-
ines the EDIT_STRING.
|
3004.10 | | WOTVAX::DODD | | Mon Apr 14 1997 08:45 | 10 |
| I'd want to look at some of the data to be sure...
Might this be because some of the fields are table fields accessed VIA.
Are these not character fields? They may contain digits but they will
be truncated rather than rounded. I might suggest that rather than
computed by you use x=y via... where x is a real numeric.
Try printing some intermediate stuff and see what is actually going on.
Andrew
|