HPlogo DATA TYPES CONVERSION Programmer's Guide: HP 3000 MPE/iX Computer Systems > Chapter 3 Converting Data Types

Passing Data

» 

Technical documentation

Complete book in PDF
» Feedback

 » Table of Contents

 » Index

To pass data between routines in different languages, you may need to convert it to make it readable and to maintain its integrity. Data created in one routine is formatted according to the language type conventions of that routine; if the receiving routine divides the input bit stream in different places, it will not read the same values. If the receiving and sending routines do not have the same definitions of data types, any data that one routine passes to the other will be meaningless, and any operation on that data will be unpredictable.

Often the programming language has commands or compiler directives the convert or coerce data to the required type. You can sometimes convert input and output data with a command line in a program. Often an assignment statement, like xtype := yvalue or xtype=yvalue is sufficient.

Sometimes a more indirect conversion is necessary. Since all data types in all MPE languages are either primitive data types or are built from them, you can translate data from one language into a primitive data type. If necessary, you can then translate the resulting primitive type into the type you need.

High-level languages can access and use most system intrinsics and compiler routines.

MPE V had system-level support of applications written in SPL/V language that perform packed-decimal operations; CM emulates these operations on MPE XL. In NM, compiler library routines can be used to manipulate decimals. Because the sizes of the operands are passed as parameters, these routines are useful in applications where the field sizes are not known at compile-time, such as general-purpose database applications and report writers.

Packed-decimal procedures must be declared as intrinsics to be called from within high-level NM languages. If speed is a primary concern, consider doing packed-decimal operations within HP COBOL II/XL or HP RPG/XL.

For more information see MPE XL Intrinsics Reference Manual (32650-90028) and Compiler Library/XL Reference Manual (32650-90029)

Feedback to webmaster