× 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 Robert,

Like Glenn pointed out, you don't return anything. It appears you are
trying to return a value by modifying an additional parameter, but you are
using PARAMETER STYLE GENERAL, so you have to return the result as result
of the procedure.


Joep Beckeringh
Software architect
Pantheon Automatisering B.V.
Heerenveen


"RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxx> wrote on 11-01-2018 15:37:32:

Robert Rogerson <rogersonra@xxxxxxxxx>

11-01-2018 15:38

Pointer error when calling external function

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 ...

Replies:

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.