I remember using a sample technique: try to change the DSPF which cannot
be done when open..
of course is not 100% because this is a generic msgid that could have many
reasons... bu the method could be improved...
this sample code could fit your need ?
CHGDSPF FILE(LIB/MyDispf) TEXT('check if used...')
MONMSG MSGID(CPF7304)EXEC(GOTO KO)
/* this is executed when the file is unlocked */
CALL myProgram
RETURN
/* this is executed when the file is locked */
KO: SNDMSG MSG('CANNOT RUN NOW')
RETURN
From: rpg400-l-request@xxxxxxxxxxxxxxxxxx
To: rpg400-l@xxxxxxxxxxxxxxxxxx
Date: 28/01/2019 22:10
Subject: RPG400-L Digest, Vol 18, Issue 54
Sent by: "RPG400-L" <rpg400-l-bounces@xxxxxxxxxxxxxxxxxx>
Send RPG400-L mailing list submissions to
rpg400-l@xxxxxxxxxxxxxxxxxx
To subscribe or unsubscribe via the World Wide Web, visit
https://lists.midrange.com/mailman/listinfo/rpg400-l
or, via email, send a message with subject or body 'help' to
rpg400-l-request@xxxxxxxxxxxxxxxxxx
You can reach the person managing the list at
rpg400-l-owner@xxxxxxxxxxxxxxxxxx
When replying, please edit your Subject line so it is more specific
than "Re: Contents of RPG400-L digest..."
*** NOTE: When replying to this digest message, PLEASE remove all text
unrelated to your reply and change the subject line so it is meaningful.
Today's Topics:
1. Re: How can i test, from rpg, if a display file is in use?
(JRusling@xxxxxxxxxxx)
2. RE: [EXTERNAL] Re: How can i test, from rpg, if a display
file is in use? (JRusling@xxxxxxxxxxx)
3. RE: [EXTERNAL] Re: How can i test, from rpg, if a display
file is in use? (Alan Shore)
4. Re: How can i test, from rpg, if a display file is in use?
(JRusling@xxxxxxxxxxx)
5. RE: How can i test, from rpg, if a display file is in use?
(Kevin Bucknum)
----------------------------------------------------------------------
message: 1
date: Mon, 28 Jan 2019 13:59:56 -0600
from: JRusling@xxxxxxxxxxx
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.
Thanks Jose,
John
<snip>
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
wrote:
</snip>
<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.
------------------------------
message: 2
date: Mon, 28 Jan 2019 14:35:43 -0600
from: JRusling@xxxxxxxxxxx
subject: RE: [EXTERNAL] Re: How can i test, from rpg, if a display
file is in use?
Unsure about Jose's intent but. . .
When i use this method, it's to insure that only -one- user at a time, can
use the process/program.
I create a data area with the same name as the pgm in a common library.
When an additional user tries to use the pgm, if the data area exists,
someone else is using the program.
If the data area doesnt exist, the new user can use the program.
(of course, this is when the data area would be created, as well as
deleted upon exit)
John
<snip>
Hmmmmm
I'm trying to work out how using a data area will tell you when he display
file is NOT being used
For example - 28 separate users sign on and use this display file at
different times - but all 28 end up using the display file at once
Then - they come out of the display file - all at once - or one after the
other
How do you know when no one is using the display file via a data area
Alan Shore
</snip>
<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.
------------------------------
message: 3
date: Mon, 28 Jan 2019 20:43:45 +0000
from: Alan Shore <ashore@xxxxxxxx>
subject: RE: [EXTERNAL] Re: How can i test, from rpg, if a display
file is in use?
Ah ha
Its one user at a time
Completely missed that
Now it makes sense
Alan Shore
E-mail : ASHORE@xxxxxxxx
Phone [O] : (631) 200-5019
Phone [C] : (631) 880-8640
'If you're going through hell, keep going.'
Winston Churchill
-----Original Message-----
From: RPG400-L [mailto:rpg400-l-bounces@xxxxxxxxxxxxxxxxxx] On Behalf Of
JRusling@xxxxxxxxxxx
Sent: Monday, January 28, 2019 3:36 PM
To: RPG programming on the IBM i(AS/400 and iSeries)
<rpg400-l@xxxxxxxxxxxxxxxxxx>
Subject: RE: [EXTERNAL] Re: How can i test, from rpg, if a display file is
in use?
Unsure about Jose's intent but. . .
When i use this method, it's to insure that only -one- user at a time, can
use the process/program.
I create a data area with the same name as the pgm in a common library.
When an additional user tries to use the pgm, if the data area exists,
someone else is using the program.
If the data area doesnt exist, the new user can use the program.
(of course, this is when the data area would be created, as well as
deleted upon exit)
John
<snip>
Hmmmmm
I'm trying to work out how using a data area will tell you when he display
file is NOT being used For example - 28 separate users sign on and use
this display file at different times - but all 28 end up using the display
file at once Then - they come out of the display file - all at once - or
one after the other How do you know when no one is using the display file
via a data area
Alan Shore
</snip>
<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 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,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
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
------------------------------
message: 4
date: Mon, 28 Jan 2019 14:44:46 -0600
from: JRusling@xxxxxxxxxxx
subject: Re: How can i test, from rpg, if a display file is in use?
<snip>
Getting to the root of what you are asking, are you really asking if you
can get an Exclusive Lock on a Display Screen ?
Depending on your need, you could Duplicate the screen into QTEMP and then
OVRDSPF to the QTEMP version. It would get you exclusive use of the
display.
( I used to use this when we were changing Menu Screens throughout the day
- and we needed to recompile them in production mid-day )
- John V
</snip>
John,
I want to know if any user is sitting on that screen, getting ready to
fire off the process, because. . .
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.
Also, i'm trying NOT to change the existing process.
btw -- I am a fan of the copying the dspf object into qtemp and using IT
instead of the COMMON copy of it.. for reasons you pointed out.
John B.
<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.
------------------------------
message: 5
date: Mon, 28 Jan 2019 21:09:46 +0000
from: Kevin Bucknum <Kevin@xxxxxxxxxxxxxxxxxxx>
subject: RE: How can i test, from rpg, if a display file is in use?
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.
SELECT LOCK_STATE,
LOCK_STATUS,
LOCK_SCOPE,
JOB_NAME,
OBJECT_TYPE
FROM QSYS2.OBJECT_LOCK_INFO
WHERE SYSTEM_OBJECT_NAME = 'IFSHCSURFM'
AND SYSTEM_OBJECT_SCHEMA = 'DRSUP';
I get this.
*SHRNUPHELDJOB679042/KEVIN/MN207A*FILE
If no one is in the file I get no records.
-----Original Message-----
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.
Thanks Jose,
John
<snip>
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
wrote:
</snip>
<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 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,
visit:
https://lists.midrange.com/mailman/listinfo/rpg400-l
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
Local: 985-893-2550
Toll Free: 877-893-2550
https://www.medtronsoftware.com
CONFIDENTIALITY NOTICE
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.
------------------------------
Subject: Digest Footer
As an Amazon Associate we earn from qualifying purchases.