Leave Program B with *inlr = *off.
Mark Walter
Business to Business Data Integration Specialist
Certified IBM System i Specialist
Paragon Consulting Services, Inc
mwalter@xxxxxxxxxxxxxxx
717-764-7909 ext. 126
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of Rick.Chevalier@xxxxxxxxxxxxxxx
Sent: Monday, October 05, 2009 8:05 AM
To: rpg400-l@xxxxxxxxxxxx
Subject: RE: Pointer puzzle
David,
I believe you are correct in your assessment. If the pointer is generated in the called program (points to a location in the called program) and passed back to the caller you will receive an error because the called program is no longer in the call stack and the location pointed to doesn't exist any more.
Rick
-----Original Message-----
From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of David FOXWELL
Sent: Monday, October 05, 2009 6:42 AM
To: RPG programming on the IBM i / System i
Subject: Pointer puzzle
Hi, I thought I had pointers sussed, but it seems not. Hope someone can help.
I'm calling program B from program A via a router program with a pointer in and out as parameters.
I've debugged and I can see that program B receives a value *NULL for the output parameter pointer. It initialises the pointer, it is returned to the router OK, but once back in the calling program A, if I do EVAL on the pointer, I get CPF8E17, Pointeur non défini pour l'emplacement référencé. ( would someone give me the English version of that message? ).
Then, when I try and use the DS based on the pointer, it says I'm trying to access something that no longer exists (MCH3402). I wonder if the problem is not the pointer but the fact that the router program has ended?
I've already successfully tested program B, using a test program to call it directly, now I'm testing with the router.
Thanks.
1 .My Calling program (A)
IF NOT ExcRouter (
'My program to call' :
AnErrMg :
wPtr_in :
wPtr_out
);
RETURN *OFF;
ENDIF;
Procedure ExcRouter
Callp routerpgm (
APgmId :
AnErrMg :
Aptr_in :
Aptr_out
);
2 .Extract from routerpgm
SELECT;
WHEN %PARMS > 3;
Trt03 (
APtr_In :
APtr_Out :
AnErrMg
);
WHEN %PARMS > 2; .....etc
D Trt03 PR EXTPGM ( APgmId )
D APtr_In * OPTIONS ( *OMIT ) CONST
D APtr_Out * OPTIONS ( *OMIT )
D AnErrMg LIKE ( DFN_ERRMG )
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives at
http://archive.midrange.com/rpg400-l.
Privileged and Confidential. This e-mail, and any attachments there to, is intended only for use by the addressee(s) named herein and may contain privileged or confidential information. If you have received this e-mail in error, please notify me immediately by a return e-mail and delete this e-mail. You are hereby notified that any dissemination, distribution or copying of this e-mail and/or any attachments thereto, is strictly prohibited.
--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit:
http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at
http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.