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



Thanks Joep
I thought it was more to do with the function as I had tested the procedure in a small test RPG program with no problems
I dropped the function and created it again with COMMIT - see below
But my test is STILL failing with the same problem (using STRDBG)
You said
And you should be supplying extra parameters for a null map for the input parameters and a null indicator variable for the result.

I didn’t make any changes for this
Is this the problem?
Where would this change need to be?



CREATE FUNCTION PRODPA.EBSCST (
CHAR(4),
CHAR(6),
CHAR(2),
DECIMAL(2, 0),
CHAR(2),
CHAR(1),
CHAR(2) )
RETURNS DECIMAL(21, 6)
LANGUAGE RPGLE
SPECIFIC PRODPA.EBSCST
DETERMINISTIC
NO SQL
RETURNS NULL ON NULL INPUT
NOT FENCED
EXTERNAL NAME 'PRODPA/ITMMSTSP(GETSTDCOST)'
PARAMETER STYLE GENERAL WITH NULLS

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of j.beckeringh@xxxxxxxxxxxxxxxxxxxxxxxxxx
Sent: Thursday, January 11, 2018 10:08 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxx>
Subject: RE: Pointer error when calling external function

Hi Alan,

Definitely not the same problem as Robert is having: you are actually returning a result. But you are using RETURNS NULL ON NULL INPUT, so I think you should be using PARAMETER STYLE GENERAL WITH NULLS. And you should be supplying extra parameters for a null map for the input parameters and a null indicator variable for the result.

Joep Beckeringh
Software architect
Pantheon Automatisering B.V.
Heerenveen

Alan Shore <ashore@xxxxxxxx>

11-01-2018 15:56

RE: Pointer error when calling external function

WOW
I am having the EXACT same problem
Here is my function
CREATE FUNCTION PRODPA.EBSCST (
CHAR(4),
CHAR(6),
CHAR(2),
DECIMAL(2, 0),
CHAR(2),
CHAR(1),
CHAR(2) )
RETURNS DECIMAL(21, 6)
LANGUAGE RPGLE
SPECIFIC PRODPA.EBSCST
DETERMINISTIC
NO SQL
RETURNS NULL ON NULL INPUT
NOT FENCED
EXTERNAL NAME 'PRODPA/ITMMSTSP(GETSTDCOST)'
PARAMETER STYLE GENERAL

As someone pointed out - I forgot to commit after creating this - yet
another Homer Simpson episode

Here is the module in the service program

P GetStdCost b export

D GetStdCost pi 21s 6
D Suffix 4A const
D Skuno 6A const
D LblCode 2A const
D Prefix 2S 0 const
D UOM 2A const
D EnvCode 1A const
D Type 2A const

D RtnEbcostDs...
D ds
D Itemno 20a
D Warehouse 3
D EBSOrgcd 3
D EBSUom 2
D TotalCost 21s 6
D MaterialCst 20s 6
D MatOvrhdCst 20s 6
D ResourceCst 20s 6
D ResOvrhdCst 20s 6
D YieldCost 20s 6

D ds
D Skunofull 6
D Skuno1st 1 overlay(Skunofull)
D Item# 5 0 overlay(Skunofull:*next)

*---------------------------------------------------------------------

* Stand Alone Fields - TOP

*---------------------------------------------------------------------

d Whsnum s 3 0 inz(3)

*---------------------------------------------------------------------

* Stand Alone Fields - BOTTOM

*---------------------------------------------------------------------

/free

if not %open(Suffwhsnbr);
open Suffwhsnbr;
endif;

clear RtnEbcostDs;
Skunofull = Skuno;
chain Suffix Suffwhsnbr;
if %found(Suffwhsnbr);
WhsNum = WhsNbr;
RtnEbcostDs = FnRtEbsCst(Item#:Suffix:' ':00:'EA':
WhsNum:' ':'FG');
endif;
if %open(Suffwhsnbr);
close Suffwhsnbr;
endif;

Return TotalCost;
/end-free

P GetStdCost e


The difference is that I am running mine in STRSQL - after applying
STRDBG
I get to the very end
Return TotalCost;
With the value I am expecting to see in TotalCost That’s when I
receive Pointer not set for location referenced.

Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
‘If you're going through hell, keep going.’
Winston Churchill

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

Follow-Ups:
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.