Re: Problem with RPG IV prototype binding - IBM AS400

This is a discussion on Re: Problem with RPG IV prototype binding - IBM AS400 ; gai wrote: > Hi, > > I am trying to call a prototyped procedure located outside the main > program. > I coded as follows: > > FTRANSACT IP E K DISK > FEMPLOYEE IF E K DISK > DPAY ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Re: Problem with RPG IV prototype binding

  1. Re: Problem with RPG IV prototype binding

    gai wrote:
    > Hi,
    >
    > I am trying to call a prototyped procedure located outside the main
    > program.
    > I coded as follows:
    >
    > FTRANSACT IP E K DISK
    > FEMPLOYEE IF E K DISK
    > DPAY S 8P 2
    > DCALCPAY PR 8P 2 EXTPROC('CALCPAY')

    ....
    > /COPY WBRUNO2/QRPGLESRC,CALCPAYPR
    > PCALCPAY B
    > ...
    > Both RPG source code available in same library and I compiled with
    > DFTACTGRP(*NO) but failed. Please suggest where am I going wrong.
    >
    > Regards,


    Gai, if I understand your problem correctly, you have a few changes to make:

    1. Code the EXPORT keyword on the Procedure-Begin for CALCPAY. This
    will make the CALCPAY procedure available to be called from outside its
    module.

    PCALCPAY B EXPORT

    2. Remove the prototype from the first module, and code the /COPY
    instead. You should avoid coding a prototype in more than one source
    file; instead, code the prototype only in the /COPY file, and copy it
    into every module that needs the prototype.

    FTRANSACT IP E K DISK
    FEMPLOYEE IF E K DISK
    DPAY S 8P 2
    /COPY WBRUNO2/QRPGLESRC,CALCPAYPR

    3. Use CRTRPGMOD instead of CRTBNDRPG. Then, use CRTPGM to link the
    programs together.

  2. Re: Problem with RPG IV prototype binding

    On Nov 8, 3:31 am, Barbara Morris wrote:
    > gai wrote:
    > > Hi,

    >
    > > I am trying to call a prototyped procedure located outside the main
    > > program.
    > > I coded as follows:

    >
    > > FTRANSACT IP E K DISK
    > > FEMPLOYEE IF E K DISK
    > > DPAY S 8P 2
    > > DCALCPAY PR 8P 2 EXTPROC('CALCPAY')

    > ...
    > > /COPY WBRUNO2/QRPGLESRC,CALCPAYPR
    > > PCALCPAY B
    > > ...
    > > Both RPG source code available in same library and I compiled with
    > > DFTACTGRP(*NO) but failed. Please suggest where am I going wrong.

    >
    > > Regards,

    >
    > Gai, if I understand your problem correctly, you have a few changes to make:
    >
    > 1. Code the EXPORT keyword on the Procedure-Begin for CALCPAY. This
    > will make the CALCPAY procedure available to be called from outside its
    > module.
    >
    > PCALCPAY B EXPORT
    >
    > 2. Remove the prototype from the first module, and code the /COPY
    > instead. You should avoid coding a prototype in more than one source
    > file; instead, code the prototype only in the /COPY file, and copy it
    > into every module that needs the prototype.
    >
    > FTRANSACT IP E K DISK
    > FEMPLOYEE IF E K DISK
    > DPAY S 8P 2
    > /COPY WBRUNO2/QRPGLESRC,CALCPAYPR
    >
    > 3. Use CRTRPGMOD instead of CRTBNDRPG. Then, use CRTPGM to link the
    > programs together.- Hide quoted text -
    >
    > - Show quoted text -


    Hi,

    Thank you very much.

    A very detailed explanation on what went wrong and what has to be
    done.

    gai.

+ Reply to Thread