Yeah, this is a good technique. Throw that in a service program and you're golden.

Creating or populating a data area is a horrible way to do this. It's just as bad as setting an "active" flag in a file. Ugh! Any abend and you're screwed.

If you MUST use a data area, just lock it exclusive. Don't deal with existence or content. When the job ends (however it ends), the lock will disappear.

Roger Harman
COMMON Certified Application Developer - ILE RPG on IBM i on Power



From: RPG400-L <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx> on behalf of JRusling@xxxxxxxxxxx <JRusling@xxxxxxxxxxx>
Sent: Monday, January 28, 2019 1:16 PM
To: RPG programming on the IBM i(AS/400 and iSeries)
Subject: RE: How can i test, from rpg, if a display file is in use?
Ya know, in the back of my mind, a voice was saying to me...  "i'll be
there's one of those sql functions/thing-a-ma-bobs to get that".

Thanks Kevin.  I'll be giving that a try.


Use the OBJECT_LOCK_INFO view.

If I run this for a display file that I am using.

I get this.

If no one is in the file I get no records.
<br />
The information in this email is confidential and may be legally privileged.
It is intended solely for the addressee. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by 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].