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



Doh....Couldn't see the forest for the trees.  I have to change my coffee.

Thanks Glenn,

Rob


On 1/11/2018 9:57 AM, Glenn Gundermann wrote:
Hi Robert,

The RPG doesn't return anything and has 3 variables.
The SQL code shows one return and 2 variables.


Yours truly,

Glenn Gundermann
Email: glenn.gundermann@xxxxxxxxx
Work: (905) 486-1162 x 239
Cell: (416) 317-3144


On 11 January 2018 at 09:37, Robert Rogerson <rogersonra@xxxxxxxxx> wrote:

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


--
This is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L)
mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/rpg400-l.

Please contact support@xxxxxxxxxxxx for any subscription related
questions.

Help support midrange.com by shopping at amazon.com with our affiliate
link: http://amzn.to/2dEadiD


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.