Use the OBJECT_LOCK_INFO view. https://www.ibm.com/support/knowledgecenter/en/ssw_ibm_i_73/rzajq/rzajqviewobjlockinfo.htm.
If I run this for a display file that I am using.
WHERE SYSTEM_OBJECT_NAME = 'IFSHCSURFM'
AND SYSTEM_OBJECT_SCHEMA = 'DRSUP';
I get this.
If no one is in the file I get no records.
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of JRusling@xxxxxxxxxxx
Sent: Monday, January 28, 2019 2:00 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?
I have used similar method myself.
I'm creating an 'Unlock process' program.
The locked process has a data area that needs to be cleared -- so that another user may initiate/use the (locked) process.
I can do this easily from my 'Unlock process' program, but . . .
My thought was to further insure that the process wasn't really in use...
i could see if the display file, used to initiate it, was open/in use.
(i was thinking that should be fairly easy to do)
The process that gets locked is only ever rarely actually locked.
Why it happens --
A user either exits the 5250 session abnormally or stays signed on so long that the nightly backup kicks their session off.
It would probably just be easier to throw a job in, at the end of nightly backups, to clear the data area.
Another way I have seen is people sometimes use a data area with a flag when screen open flag equal 1 and then all programs using this screen check that flag in this dtaarea.
On Mon, Jan 28, 2019, 2:14 PM Jose Perez <joseenocperez.jp@xxxxxxxxx
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 is the RPG programming on the IBM i (AS/400 and iSeries) (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxxxxxxxx To subscribe, unsubscribe, or change list options,
or email: RPG400-L-request@xxxxxxxxxxxxxxxxxx
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: https://amazon.midrange.com
[https://www.medtronsoftware.com/img/MedtronMinilogo.bmp] Kevin Bucknum
Senior Programmer Analyst
MEDDATA / MEDTRON
120 Innwood Drive
Covington LA 70433
Toll Free: 877-893-2550
This document and any accompanying this email transmission contain confidential information, belonging to the sender that is legally privileged. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, or the employee of agent responsible to deliver it to the intended recipient, you are hereby notified that any disclosure, copying, distribution or action taken in reliance on the contents of these documents is STRICTLY PROHIBITED. If you have received this email in error, please notify the sender immediately to arrange for return or destruction of these documents.