Login:
Votes - , Average rating: ( )

User manual HP, model MPE/iX 6.0 Operating System

Manafacture: HP
File size: 82.48 kb
File name:

Language of manual:en

The document is loading, please wait
The document is loading, please wait


Other manuals for this model:

manual abstract


Avoiding Pitfalls in Multi-Language Programming
Page 6 of 14
and other information. Fortran uses hidden parameters for assumed-size arrays and for extensible
parameters lists. Pascal uses hidden parameters for ANYVAR, generic strings, multi-dimensional
arrays, and extensible parameter lists. In Pascal, use of the language specifier FTN77 on the
EXTERNAL directive will automatically provide the hidden array size for Fortran subroutine calls.
RPG programs may not be compiled as subroutines. Therefore, RPG programs cannot be called from
other languages. You may use another language for any external routines. The best language to use
is Cobol, since it supports data types that match those of RPG. If you use other languages, you will
have to do extra work to manipulate numeric data. RPG uses the EXIT operator to call the external
routine. It passes parameters to it with RLABL or PARM items. Items declared as RLABLs are global,
and are not explicitly passed to the routine. All PARM items are passed by reference; i.e. by a pointer
to the item. If you are accessing RLABL items in your routine, you must link it with the RPG program
file. If you use only PARM items (or none at all), you may link with the program or create an XL file
containing your routine(s).
Calling Transact from another language requires the calling program to use an architected call
interface (ACI) to allocate the entire Transact data register. Values placed in the data buffer must be
correct Transact formats and must be double-byte aligned. If the data buffer of the calling program is
not defined exactly as the Transact routine's data register, an error message, such as DATA
MEMORY PROTECTION TRAP, is issued and the program terminates.
The data register space allocated to the Transact routine is determined by the data_length parameter
of the ACI intrinsic call, not the DATA=Data_Length option of the SYSTEM statement in the called
Transact routine. The DATA=Data_Length option of the SYSTEM statement and the ACI data_length
parameter differ in how they are declared. The DATA=Data_Length is declared in 16-bit words; the
data_length parameter is declared in bytes.
When the called Transact routine uses VPLUS forms, it is the responsibility of the calling program to
ensure that the terminal is in character mode prior to the call.
In general, the common data types are properly aligned and so no problems will occur. In Pascal, the
system programming extension CRUNCHED form of PACKing will generally produce non-aligned
data items within a record; this should be avoided. In Cobol, the SYNCHRONIZED clause may be
used to force alignment to standard boundaries, as may the SYNC16 or SYNC32 option. This may be
required, as in Cobol, level-01 and level-77 data items outside the Linkage Section are aligned on
word boundaries, but the default for other items is byte alignment.
In Transact, use the "%" option to pass a given parameter by byte address; The form "%n" (where the
n is either 8, 16, 32, or 64) indicates the bit boundary to align on. When constructing structures,
alignment problems may be avoided by placing the largest sized data types first, followed by
progressively smaller sized data types. This allows the natural alignment of the individual items and
avoids the insertion of padding or filler items.
Calling routines written in other languages from Transact, by default, generates code to make copies
of all reference parameters if they are not preceded by "%", "#", or "&". Data is copied to a temporary
buffer whose alignment is determined from the type and size of the item passed via the PROC call
through which the Transact aligned parameters are passed. However, since this copying is inefficient,
the compiler options PROCALIGNED_16/32/64 should be used whenever possible to bypass the
copy mechanism.
A future version of Basic will include a new built-in function that returns the byte address of a data
item. This will allow the creation of records/structures containing pointers. Until this is available, you
can generate a pointer by passing the parameter by reference. If you need to save the pointer for
further manipulation by Basic (such as to PACK it into a structure), call a helper function that simply
returns the address passed to it, and save this value in an INTEGER variable. You will need to lie to
Basic about the type of the return value, and you may need to link the program with PARMCHECK=0.
This works because short pointers and integers have the same size and alignment, and are passed
the same way in the procedure calling convention.
Fortran COMMON blocks are not shareable with other languages, nor is the Basic COM block
linkable to global data in other languages. To access Fortran COMMON or Basic COM data from
another language, use a reference parameter to pass the first item of the block to the routine in the
http://www.hp.com/cgi-bin/pf-new.cgi?IN=http://jazz.external.hp.com/papers/lang/pgm_pi... 7/18/2008


...

Other models in this manual:
Software - MPE/iX 6.5 Operating System (82.48 kb)
Software - MPE/iX 7.0 Operating System (82.48 kb)
Software - MPE/iX 7.5 Operating System (82.48 kb)

Reviews



Your review
Your name:
Please, enter two numbers from picture:
capcha





Category