[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [open-cobol-list] About the Overflow(Underflow)
From: |
Alain Lucari |
Subject: |
Re: [open-cobol-list] About the Overflow(Underflow) |
Date: |
Wed Jun 1 06:24:43 2005 |
Hello Peg,
There is no more problem with compute or subtract
than with add.
The problem is :
- no "on size error" in your samples,
- your pic 9(2) is UNSIGNED :
1 - 3 = -2
unsigned, the result is 2
There is no overflow in this case !
Le Wed, 01 Jun 2005 20:08:41 +0900
Peg <address@hidden> a écrit:
> Hello Alain Lucari,
> Thank you for the reply.
>
> > Try something like :
> > WORKING-STORAGE SECTION.
> > 77 wz1 pic 99 value 97.
> > PROCEDURE DIVISION.
> > DEBUT.
> > add 1 to wz1 on size error display "too much " wz1 "+1" go to
> > finpro.
> > go to debut.
> > finpro.
> > stop run.
> >
> > this works perfectly as expected.
> Yes, this works perfectly.
>
> One of the problems that I say
> The result is different because of
> "COMPUTE" and "SUBTRACT" why.
>
> WORKING-STORAGE SECTION.
> 01 DATA1 PIC 9(2) VALUE 5.
> 01 DATA2 PIC 9(2) VALUE 5.
> PROCEDURE DIVISION.
> COMPUTE DATA1 = DATA1 - 1.
> SUBTRACT 1 FROM DATA2.
> DISPLAY DATA1 DATA2.
> $ cobc TESTFLOW.COB -free -std=mf
>
regards
--
Alain Lucari (Eurlix)