× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi All,  I created an external function to reuse an existing RPG program.  When I call the function from iNav it runs without error unit it tries to assign a value to 0_ValidFlag which I return to the function.

Here is the function...

CREATE OR REPLACE FUNCTION RROGERSON/IS_SBT_ITEM_AND_UPC_VALID_FUNC (
    VENDNUM DECIMAL(5, 0) ,
    ITEMNUM DECIMAL(6, 0) )
    RETURNS CHAR(10)
    LANGUAGE RPGLE
    SPECIFIC RROGERSON/IS_SBT_ITEM_AND_UPC_VALID_FUNC
    NOT DETERMINISTIC
    MODIFIES SQL DATA
    CALLED ON NULL INPUT
    EXTERNAL NAME 'RROGERSON/UDF0001S(ISSBTITEMANDUPCVALIDFUNC)'
    PARAMETER STYLE GENERAL ;

And here is the module in the service program...

     P IsSBTItemAndUPCValidFunc...
     P                 b export
     d IsSBTItemAndUPCValidFunc...
     d pi
     d i_Vendor                       5p 0 const
     d i_Item                         6p 0 const
     d o_ValidFlag 10a

     d item            s              6p 0
     d upc             s 13a
     d error           s 1a

*----------------------------------------------------
      *  External procedure prototypes
*----------------------------------------------------
     d sb9000          pr extpgm('SB9000')
     d                                5p 0 const
     d                                6p 0
     d 13a
     d 1a
/free

         item = i_Item;
         Clear upc;
         Clear error;

         // Check to see if the item is valid
SB9000(i_Vendor:item:upc:error);
         If error = 'Y';
           o_ValidFlag = 'Item error';                       // **** This is where I get the error *****
           Return ;
Endif;

         Clear item;
         Clear error;

         // Check to see if the item's upc is valid
SB9000(i_Vendor:item:upc:error);
         If error = 'Y';
           o_ValidFlag = 'UPC error';
           Return ;
Endif;

       o_ValidFlag = *blanks;

Return;
/end-free
     P IsSBTItemAndUPCValidFunc...
     P e

When I look at the joblog I see the error "Pointer not set for location referenced." which points to the line indicated above.

I call the function in iNav with the sql statement

values(6079, 529236, IS_SBT_ITEM_AND_UPC_VALID_FUNC(6079, 529236));


I'm sure I'm missing something simple but I can't see it.  Any thoughts would be appreciated.

Thanks,

Rob



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.