HP 3000 Manuals

Packed-Decimal Procedures [ Compiler Library/XL Reference Manual ] MPE/iX 5.0 Documentation


Compiler Library/XL Reference Manual

Chapter 4  Packed-Decimal Procedures 

This chapter describes the packed-decimal procedures that perform the
following basic operations:

 *  Arithmetic operations
 *  Comparisons
 *  Left and right shifts
 *  Conversions to and from binary
 *  Conversions to and from external decimal

These procedures facilitate migration to MPE XL of applications that
perform packed-decimal operations using ASSEMBLE statements in the SPL/V
programming language.  Packed-decimal operations on SPL/V are typically
performed by pushing several parameters onto the stack and then
executing, via an ASSEMBLE statement, the appropriate decimal
instruction.

Programs written in SPL/V can be run on 900 Series HP 3000 computer
systems in Compatibility Mode.  However, it is often desirable to convert
them to languages for which Native Mode programs can be generated.

The procedures described in this chapter provide packed-decimal
operations for programs executing in Native Mode.  There is a procedure
corresponding to each of the 11 packed-decimal instructions in the HP
3000 Series V instruction set.  In addition, there is a procedure
corresponding to each of the two packed-decimal division routines
provided in the MPE V/E Compiler Library.

The packed-decimal procedures are also suitable for use in new programs
being developed in Native Mode.  Because the sizes of the operands are
passed as parameters, these procedures can be used in applications
where the field sizes are not known at compile-time, for example,
general-purpose database applications and report writers.


NOTE These procedures execute entirely in Native Mode and take advantage of the architecture of the 900 Series HP 3000 computers as much as possible. However, because of their generality and the fact that they are external procedures, they are not as efficient as the code that can be generated by a compiler. Therefore, in applications where the speed of packed-decimal operations is a primary concern, you may wish to consider a language that directly supports the packed-decimal data type, such as HP COBOL II/XL.
Packed-decimal procedures can be declared as intrinsics and can be called from high level languages, such as HP C/XL, HP Pascal/XL and HP FORTRAN 77/XL. Most of the procedures use the packed-decimal format; two procedures (HPPACCVAD and HPPACCVDA) use external-decimal number format; and two procedures (HPPACCVBD and HPPACCVDB) use binary numbers.


MPE/iX 5.0 Documentation