IN-LINE ILE PROCEDURES


There are several application program interfaces (APIs) that are supported in RPG IV. Several of these APIs are provided through the ILE that runs on the IBM AS/400 system. Specifically, there are two APIs that provide a way to access the Operand Descriptions (OPDESC) that are passed to subprocedures.

These APIs are known as in-line procedures. These are considered "in-line" because the RPG IV compiler actually copies the code for these procedures into the host RPG IV program. In other words, there isn't actually a CALL to the APIs at runtime, and the instructions performed by these APIs are embedded in the program calling the APIs.

The two APIs used in this book, CEEGSI and CEEDOD are prototyped in Figures D.7 and D.8. They are prototyped for documentation purposes and to simply provide access to the APIs themselves.

start figure

       /**************************************************************/       /* Cozzi RPGIV Includes |  (c) 1996 by Robert Cozzi, Jr.       |       /* ———————————      All rights reserved.            |       /* ——————————————————————————————-       /* PC Filename(zINLINE.RG4) AS/400 Filename(ZSYSINLINE) TYPE(RPGLE)       /* This source file contains example source code for the RPGIV       /* language for your consideration.       /*       /* These examples are provided "as is" without warranty of       /* any kind. If you choose to use these examples, you do so       /* at your own risk. Further, you agree to hold the author of       /* these examples, the copyright holder, its agents and suppliers       /* harmless for any results from the use or misuse of these       /* examples. No warranty is expressed or implied and       /* none is given.       /***************************************************************/       ************************************************       **   ILE In-line Procedure                    **       **   CEEGSI - Get String Information          **       ************************************************ .....DName+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++++++++++      D GetStgInfo      PR                  ExtProc('CEEGSI')      D  ParmPos                      10I 0      D  s_datatype                   10I 0      D  s_curlen                     10I 0      D  s_maxlen                     10I 0      D  s_errors                     12A   OPTIONS(*OMIT) 

end figure

Figure D.7: Prototype for CEEGSI (Get String Information).

start figure

     /***************************************************************/      ** Procedure interface for the CEEDOD in-line function      **    Format:  GetOpDesc( parm-pos : desc-type : data-type :      **                        desc-inf1 : desc-inf2 : data-length )      **    Input: Relative parameter number      **    Output: desc-type -      **            data-type -      **                       1 = Invalid or unknown data type      **                       2 = Character data      **                       3 = Null terminated character string      **                       4 = Pascal-style character string      **                           Bytes 1 - 2 UINT(2) with data length      **                           Bytes 3 to ... data      **                       5 = Pascal-style chracter string      **                           Bytes 1 - 4 UINT(4) with data length      **                           Bytes 5 to ... data      **                       6 = Bit string      **                       7 = Bit string      **                           Bytes 1 - 2 UINT(2) with number of bits      **                           Bytes 3 to ... bit string      **                       8 = Bit string      **                           Bytes 1 - 4 UINT(4) with number of bits      **                           Bytes 5 to ... bit string      **                       9 = DBCS character data      **                      10 = DBCS character string with null termination      **                      11 = DBCS character data      **                           Bytes 1 - 2 UINT(2) with the data's length      **                           Bytes 3 to ... DBCS data      **                      12 = DBCS character data      **                           Bytes 1 - 4 UINT(4) with the data's length      **                           Bytes 5 to ... DBCS data      **            desc-inf1 -      **            desc-inf2 -      **            data-length =  Number of bytes of data passed to      **                           this parameter. .....DName+++++++++++EUDS.......Length+TDc.Functions++++++++++++++++++++++++++++      D GetOpDesc       PR                  ExtProc('CEEDOD')      D  ParmPos                      10I 0 Const      D  o_desctype                   10I 0      D  o_datatype                   10I 0      D  o_descinf1                   10I 0      D  o_descinf2                   10I 0      D  o_fieldlen                   10I 0      D  o_errors                     12A   OPTIONS(*OMIT) 

end figure

Figure D.8: Prototype for CEEDOD (Get Operation Descriptor).




The Modern RPG IV Language
The Modern RPG IV Language
ISBN: 1583470646
EAN: 2147483647
Year: 2003
Pages: 156
Authors: Robert Cozzi

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net