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



See below -
<snip>
I didn't see Kevin's suggestion to use the OBJECT_LOCK_INFO view until
after I had posted my own.

On 1/28/2019 1:09 PM, Kevin Bucknum wrote:
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.
</snip>

Hi Jonathan,

Got Kevin's suggestion working for this.

Thanks Jonathan, Kevin, Roger, Don, Paul, Craig, Jose, Gary, Sam, dclark &
Mark.

John

fyi threw it in a procedure as i anticipate some form of this going into a
srvpgm at some point -

//===============================================================
dcl-proc is_DisplayFile_InUse ;
dcl-pi *n varchar( 26) ;
pDspFilNam varchar( 10) value ;
pDspFilLibNam varchar( 10) value ;
end-pi;
// Returns 'N' ... NO if not in use
// Returns job name; job#/user/wsid of using job,ie
123123/JOHNG/MPT1234 when in use
//===============================================================
dcl-s rtnval varchar( 26) ;
dcl-ds ObjLckInfDs qualified ;
lock_state char( 9) ;
lock_status char( 11) ;
lock_scope char( 12) ;
job_name char( 30) ;
// ie 123123/JOHNG/MPT1234
objtype char( 9) ;
end-ds;
dcl-s NbrRecs int( 5) ;
// Use db2 obj lock info to see if anyone is using display file
exec sql declare mycsr cursor for
select
LOCK_STATE,LOCK_STATUS,LOCK_SCOPE,JOB_NAME,OBJECT_TYPE from
QSYS2/OBJECT_LOCK_INFO
where SYSTEM_OBJECT_NAME = :pDspFilNam and
SYSTEM_OBJECT_SCHEMA = :pDspFilLibNam ;
exec sql open mycsr ;
NbrRecs = 0 ;
//---
dou ('6' = '9') ;
clear ObjLckInfDs ;
exec sql fetch mycsr into :ObjLckInfDs ;
if (SqlCod = 100) ;
leave ;
endif ;
NbrRecs += 1 ;
if NbrRecs > 0 ;
leave ;
endif ;
enddo ;
//----
exec sql close mycsr ;
if NbrRecs > 0 ;
// If display file being used, return qualified job name of
using job
rtnval = ObjLckInfDs.job_name ;
else ;
rtnval = NO ;
endif ;
return rtnval ;
end-proc ;
<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.

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.