Calling ILE procedures
You can follow these steps to prepare and call ILE procedures from your PASE for i programs.
When you call ILE procedures from your PASE for i programs, you should first prepare the procedure by enabling it for teraspace, converting text to the appropriate CCSID, and setting up variables and structures.
- Enable ILE procedures for teraspace
All ILE modules that you call from PASE for i must be compiled with the teraspace option set to *YES. If your ILE modules are not compiled in this way, you will receive the MCH4433 error message (Invalid storage model for target program &2) in the job log for your PASE for i application.
- Convert text to appropriate CCSID
Text being passed between ILE and PASE for i might need to be converted to the appropriate CCSIDs before being passed. Not doing such conversions causes your character variables to contain undecipherable values.
- Set up variables and structuresTo make calls to ILE from your PASE for i programs, you need to set up variables and structures. You must ensure that the required header files are copied to your AIX® system, and you must set up a signature, a result type, and an argument list variable:
- Header files: Your PASE for i program should include the header files as400_types.h and as400_protos.h to make calls to ILE. The as400_type.h header file contains the definition of the types used for i5/OS system-unique interfaces.
- Signature: The signature structure contains a description
of the sequence and types of arguments passed between PASE for i and ILE. The
encoding for the types mandated by the ILE procedure that you are
calling can be found in the as400_types.h header file. If a signature
contains fixed-point arguments shorter than 4 bytes or floating point
arguments shorter than 8 bytes, your ILE C code needs to be compiled
with the following pragma:
#pragma argument(ileProcedureName, nowiden)
Without this pragma, standard C linking for ILE requires 1- and 2-byte integer arguments to be widened to 4 bytes and requires 4-byte floating-point arguments to be widened to 8 bytes.
- Result type: The result type is straightforward and works much like a return type in C.
- Argument list: The argument list must be a structure with the correct sequence of fields with types specified by entries in the signature array. You can use the size_ILEarglist() and build_ILEarglist() APIs to dynamically build the argument list based on the signature.