Avoiding Pitfalls in Multi-Language Programming

Subranges
0..255 ~BYTE NA unsigned char NA NA
0..65535 ~INTEGER*2 ~COMP 9(4) unsigned short ~SHORT INTEGER K(4) #3
NOTES:
#3 Integers may hold unsigned integer values
with the first bit being interpreted as a sign rather than
the larger unsigned magnitudes. Transact has 12-byte integer types
with no equivalents in other
languages.
#4 COMPLEX storage equivalent is two real numbers in a record/structure or two-element array. Only
Fortran supports COMPLEX arithmetic.
#5 C enum is always 4 bytes in size, Pascal enum can be 1,2,or 4 bytes.
#6 Basic uses PACK and UNPACK to create and
decompose structures/records to and from string
variables.
#7 Packed decimal data type is common to
Cobol, RPG, and Transact. Basic's DECIMAL data type is
not compatible with other languages. Zoned decimal data type is
also common to Cobol and
Transact.
Procedure Invocations
Pitfalls:
Procedure name case should be considered
carefully as some languages upshift, downshift, or are
case sensitive.
Procedure names which contain special characters (like underscore, hyphen, apostrophe) will
frequently require ALIASing to allow access from other languages.
Parameters may be passed by value, by
reference, or by descriptor, and the mode of parameter
passing differs by language.
Parameters other than the simple data types
may be difficult to construct and/or process in the
various languages.
Data alignment can be a problem; use SYNC in Cobol, avoid CRUNCHED in Pascal.
Hidden parameters can cause interfacing problems unless they are properly accounted for in the
procedure call.
Global and Common data may not be visible to routines written in other languages.
Recommendations:
Procedure names should be less than fifteen
characters in length, lowercase, with no special
characters.
Use simple data types whenever possible.
Avoid passing structures and arrays. Single dimension arrays of simple data types may be passed by
reference.
Page
4
of
14
Avoiding Pitfalls in Multi
-
7/18/2008
http://www.hp.com/cgi
-
bin/pf
-
new.cgi?IN=http://jazz.external.hp.com/papers/lang/pgm_pi
...