PL/I v2.3 Fixedoverflow 
Author Message
 PL/I v2.3 Fixedoverflow


Quote:

> re FIXEDOVERFLOW:

> The FIXEDOVERFLOW computational condition is raised when the length of the
> result of a fixed-point             arithmetic operation exceeds the maximum
> length allowed by the implementation.

> re SIZE:

> The SIZE computational condition is raised only when high-order (that is,
> leftmost) significant binary or             decimal digits are lost in an
> attempted assignment to a variable or an intermediate result or in
> an             input/output operation. This loss can result from a conversion
> involving different data types, different bases, different scales, or different
> precisions. The size condition is not enabled unless it appears in a condition
> prefix.

> SIZE is raised when the size of the value being assigned to a data item exceeds
> the declared (or default)             size of the data item, even if this is
> not the actual size of the storage that the item occupies. For example, a fixed
> binary item of precision (20) occupies a fullword in storage, but SIZE is
> raised if a value whose size exceeds FIXED BINARY(20) is assigned to it.

> Because checking sizes requires substantial overhead in both storage space and
> run time, the SIZE condition is primarily used for program testing. It can be
> removed from production programs. For more information on test and production
> application programs, refer to the Programming Guide.

> The SIZE condition differs from the FIXEDOVERFLOW condition in that
> FIXEDOVERFLOW is raised when the
> size of a calculated fixed-point value exceeds the maximum allowed by the
> implementation. SIZE can be
> raised on assignment of a value regardless of whether or not FIXEDOVERFLOW was
> raised in the calculation
> of that value.

> If the SIZE condition is raised and it is disabled, the program is in error.

> End of quote.

> Note that FIXEDOVERFLOW can only result from performing an arithmetic
> operation, whereas SIZE results from an attempt to assign a value to a variable
> or an intermediate target.

There may be variations to this, depending on optimization.

Note also that for some operations (such as decimal to binary
conversion and vice versa, where FIXEDOVERFLOW condition
may be raised.

For example, assigning a FIXED DECIMAL variable of 11 digits to
another of 5 digits, of the same scale factor.
For that operation, a ZAP instruction would probably be
used, and I would expect the FIXEDOVERFKOW contition to be
raised in that case.
Has anyone tried that out?



Thu, 12 Sep 2002 03:00:00 GMT  
 PL/I v2.3 Fixedoverflow


Quote:
> For example, assigning a FIXED DECIMAL variable of 11 digits to
> another of 5 digits, of the same scale factor.
> For that operation, a ZAP instruction would probably be
> used, and I would expect the FIXEDOVERFKOW contition to be
> raised in that case.
> Has anyone tried that out?

You obviously did not try it out yourself, at least not a IBM mainframe
compiler.

The implementation on IBM mainframe compilers will not raise a
FIXEDOVERFLOW condition for this example.  The program segment

dcl a fixed dec(11);
dcl b fixed dec(5);
b=a;                

generates the following machine code:

MVC   B(3),A+3

which cannot possibly raise a FIXEDOVERFLOW condition.

This goes for the old PL/I OPTIMIZING COMPILER VERSION 1 RELEASE 5.1 as
well as the latest IBM PL/I for MVS & VM Ver 1 Rel 1 Mod 1.

The reason for this implementation is obvious when you read the definition
of FIXEDOVERFLOW in the manual.  From the PL/I for MVS & VM Language
Reference:

"The FIXEDOVERFLOW computational condition is raised when the length of the
result of a fixed-point arithmetic operation exceeds the maximum length
allowed by the implementation.

The FIXEDOVERFLOW condition differs from the SIZE condition in that SIZE is
raised when a result exceeds the declared size of a variable, while
FIXEDOVERFLOW is raised when a result exceeds the maximum allowed by the
computer."

FIXEDOVERFLOW is enabled by default, while SIZE is disabled by default.

If SIZE is enabled, the implementation changes considerably:

MVI   86(13),X'81'    
ZAP   WKSP.1+48(7),A(6)
OI    2(12),X'80'      
ZAP   B(3),WKSP.1+48(7)
NI    2(12),X'3F'      
MVI   86(13),X'91'    

(The first and last instruction are not generated by the 1.5.1 compiler.)

Here the second ZAP instruction can raise the hardware DECIMAL OVERFLOW
exception (if the value of A is greater then 99999), which PLI will
interpret as SIZE condition.

go.



Thu, 12 Sep 2002 03:00:00 GMT  
 PL/I v2.3 Fixedoverflow

Quote:


> > For example, assigning a FIXED DECIMAL variable of 11 digits to
> > another of 5 digits, of the same scale factor.
> > For that operation, a ZAP instruction would probably be
> > used, and I would expect the FIXEDOVERFKOW contition to be
> > raised in that case.
> > Has anyone tried that out?

> You obviously did not try it out yourself, at least not a IBM mainframe
> compiler.

Thanks. No, I don't have access to a mainframe compiler.
That's why I asked.


Thu, 12 Sep 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. PL/I v2.3 Fixedoverflow

2. PL/I v2.3 Fixedoverflow

3. plixopt values - pl/i v2.3 LE

4. HOWTO: Install VA PL/I V2.1 on NT4 and W2K

5. PL/I V2.3.0, CICS/ESA V4.1 and LE V1.5.0

6. PL/1 v1.5 and V2.3 run-time libraries

7. Dr. Watson and VA PL/I v2.0

8. VisualAge PL/I V2.0 Announced!!

9. pl/I v1 upgrade to v2

10. FIXEDOVERFLOW vs. SIZE

11. VisualAge V2 and DB2/2 V2?

12. ANN: TclDOM v2.2 and TclXSLT v2.2

 

 
Powered by phpBB® Forum Software