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



Ok, thanks all, here's what happened.

In PGM1 :

D wDS DS LIKEDS ( gDS )
D BASED ( Ptr_wDS )

/FREE

CLEAR gDS;

Call pgm2 (
some parms :
Ptr_wDS
);

gDS = wDS;


/END-FREE


On the first call to pgm2 after activation of pgm1, wDS was never initialised, although Ptr_wDS was. All subsequent calls worked fine. On debugging I saw that gDS was empty then, stepping through to the next call, saw that wDS was correctly filled.


In pgm2 :

P MyProc B
D PI

D wDS DS LIKEDS ( gDS )

/FREE

code to initialize wDS;

OutputPointer = %ADDR ( wDS );

/END-FREE

P MyProc E

OutputPointer is a global variable returned by pgm2. So pgm1 is trying to use a pointer to the local variable wDS of MyProc. If this is the problem, why does it work ok except the first time? How should I return the pointer correctly? Use a global variable in pgm2 or use a static variable?


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.