Rounding problems

Knox, Dave (Dallas, TX) knoxda01@unisourcelink.com
Wed, 13 Dec 2000 16:44:41 -0500


This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_001_01C0654D.EC82B4D0
Content-Type: text/plain

Your first define is rounding to one decimal, not zero (but is rounded to an
integer when reported). Change your output of D-C-SLSMN-BOOK-COST to "OUTPUT
SCALE 1" and you should see what's happening. It should be ROUND(xxx,0,NEAR)

The subsequent defines are treating the input as an integer and truncating
the hidden decimal...

Regards
Dave


> -----Original Message-----
> From:	Boris Kortiak [SMTP:BKortiak@genlyte.com]
> Sent:	Wednesday, December 13, 2000 3:03 PM
> To:	powerh-l@sphere.swau.edu
> Subject:	Rounding problems
> 
> I'm using Quiz on an HP e3000 MPE/ix 6.0 and I'm having a problem with
> formatting some data.
> 
> I am using the following defines:
> ======
>  DEFINE D-C-SLSMN-BOOK-COST     NUM*10                  =    &
>          ROUND((D-SLSMN-BOOK-COST*100), 1, NEAR)
>  DEFINE D-C-SLSMN-BK-CST-I      CHA*10                  =    &
>          RJ(TRUNCATE(ASCII(D-C-SLSMN-BOOK-COST,10)))
>  DEFINE D-C-SLSMN-BK-CST        CHA*11                  =    &
>          LJ(D-C-SLSMN-BK-CST-I[1:8]             +            &
>             "."                                 +            &
>             D-C-SLSMN-BK-CST-I[9:2])
> ======
> 
> Through a show items, I see that the origin data item is defined thus:
> ======
>                                              INPUT OUTPUT
> BKG31MSE                                TYPE SCALE SCALE  DEC PICTURE
>   D-SLSMN-BOOK-COST                     NUM     0     2    0  ^,^^^,^^^.^^
> ======
> 
> My report output contains the following:
> ======
> 006   THORNE                          -0002240.00          -137829
> -000137828      -0001378.28       -861.71     38.5
>            .00       -861.71     38.5
> ======
> 
> You will note that the second numeric column is properly rounded and ends
> in a '9'.  The formatted versions of this number end in an '8'.
> 
> What am I overlooking?
> 
> -- 
> The opinions expressed are my own, especially if I'm right.
> COBOL the choice of a GNU generation
> http://www.gnu.org/software/cobol/index.html 
> Make money while you surf the web
> http://users.erols.com/bpkprsnl/GetPaid.html
> See my web page at http://users.erols.com/bpkprsnl/
> 
> 
> = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
> =
> Subscribe: "subscribe powerh-l" in message body to
> majordomo@lists.swau.edu
> Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu
> This list is closed, thus to post to the list, you must be a subscriber.

------_=_NextPart_001_01C0654D.EC82B4D0
Content-Type: text/html
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">



RE: Rounding problems



Your first define is = rounding to one decimal, not zero (but is rounded to an integer when = reported). Change your output of D-C-SLSMN-BOOK-COST to "OUTPUT = SCALE 1" and you should see what's happening. It should be = ROUND(xxx,0,NEAR)

The subsequent = defines are treating the input as an integer and truncating the hidden = decimal...

Regards
Dave


------_=_NextPart_001_01C0654D.EC82B4D0-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Subscribe: "subscribe powerh-l" in message body to majordomo@lists.swau.edu Unsubscribe: "unsubscribe powerh-l" in message to majordomo@lists.swau.edu This list is closed, thus to post to the list, you must be a subscriber.