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



How are your key fields defined?
How is the Input Data Structure defined?
Are either of these input parms?
Are the BASED on a Pointer?

Is this procedure only called from other RPG procedures or are you trying to call it from a CLLE program or something else?

Is there any other code in the ON-EXIT section other than the "if open then close"?

I've had similar issues with ON-EXIT code where I receive a pointer error when attempting to use any variable that was declared local to the sub-procedure.

In my experience, only the Status Indicator variable of the ON-EXIT does not have this issue.


For example this defines "HasError" as the Status Indicator for the ON-EXIT section:

Dcl-Proc Test;
Dcl-s HasError ind;
// do stuff
On-Exit HasError;
If HasError;
//do something
Endif;
End-Proc;


Chris Hiebert
Senior Programmer/Analyst
Disclaimer: Any views or opinions presented are solely those of the author and do not necessarily represent those of the company.


-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of Stuart Rowe
Sent: Monday, April 1, 2019 9:22 AM
To: RPG programming on the IBM i (AS/400 and iSeries) <rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: Odd run-time behavior with "on-exit"

I have a small procedure that contains a local database file (dcl-f), input only. It opens the file, setll and reade a subset of records by key, calls a procedure for each record read, closes the file. Fabulous thing that procedure-local file.

I thought I'd be slick you know, and use some newer (to me) compiler features. I added this to the procedure:

on-exit;
if %open( inputfile );
close inputfile;
endif;

Now, the procedure no longer functions. The file gets opened, but as soon as I setll, whammo I get MCH3601 returned from the setll operation.

I comment out the on-exit business, works slick as buttered glass again.

I checked that the correct file in the correct library has been opened and it has the correct key and record format. NOTHING in the joblog but the
MCH3601 and that's not all that informative.

Anyone heard of any internal conflicts between "procedure-local" files and the on-exit processing? Seems weird that I could have affected the ODP (or it's internal tables) this way. I am on os version 7.2.
--
This is the RPG programming on IBM i (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
visit: https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.midrange.com_mailman_listinfo_rpg400-2Dl&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=GYVfe7k5MogwSsRr94zbPeTDRJYpFK3WOG9BKFEwK1s&m=jNLnfRepJn_pQ2LGKSej-XdCITj1Z2TnRCQT8xPbOKI&s=6ZH9EWi8vVJB9S42qpRBRxNdKRfX2S7OAo-NiqLW89A&e=
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives at https://urldefense.proofpoint.com/v2/url?u=https-3A__archive.midrange.com_rpg400-2Dl&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=GYVfe7k5MogwSsRr94zbPeTDRJYpFK3WOG9BKFEwK1s&m=jNLnfRepJn_pQ2LGKSej-XdCITj1Z2TnRCQT8xPbOKI&s=xrHqX_-U61bGAttXVeGVHLaiQksdTPszw1EgV-ECMWM&e=.

Please contact support@xxxxxxxxxxxx for any subscription related questions.

Help support midrange.com by shopping at amazon.com with our affiliate link: https://urldefense.proofpoint.com/v2/url?u=https-3A__amazon.midrange.com&d=DwICAg&c=2S-2xx8Cum_thMfWs-kOOHQTwolPvSZ4PFLhr1wDDGs&r=GYVfe7k5MogwSsRr94zbPeTDRJYpFK3WOG9BKFEwK1s&m=jNLnfRepJn_pQ2LGKSej-XdCITj1Z2TnRCQT8xPbOKI&s=l5v_ORceCsDPBkdCjTiR5q03_ZFiL_k7ytQL3O9Lx9o&e=

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.