APPX is the Premier Development and Runtime Environment for Business Application Software
(Answer) (Category) FAQ's - APPX Software, Inc. : (Category) APPX Utility : (Category) APPX System Administration :
How to track “Record Held by Another User"
You can instruct AppxIO to track lock holders on a file-by-file or FMS Group basis:

Include the text "track_locks" (without the quotes) in an FMS control string. APPX will record extra information in the file whenever a record is locked. There is a performance penalty of two extra I/O operations per READ with HOLD when you use this flag, so you may want to apply this flag selectively, through 'Edit File Specifications'.

'track_locks;' is defined for individual files in Appl Design > Tools Tab > Database Management > File Specification > File Attributes. 'track_locks;' is defined for whole databases using SysAdmin > Config > File System Groups > 'FMS Group Attributes', and SysAdmin > DB/Appl > DB/Appl > 'FMS Group'. (It is not defined as an environment variable.)

Appx displays the user's three-character UserID on an ILF 'READ with Hold', whenever it waits more than 10 seconds for a lock.

APPX will *not* wait for or display User-holding information for records attempting to be held by INPUT processes, in either Change or Delete mode. Instead it goes into 'Chg/Inq' or 'Del/Inq' mode and displays a generic 'This record held by another user'. If however you execute a Read with Hold from ILF within such an INPUT process, APPX will display the holding user's UserID.

On Unix systems, you will see a process ID even if you don't use 'track locks'. There is no performance penalty for this.

On Unix systems' INPUT processes, you can also run 'fuser -u {filename}' to determine who has a given file open.


If you get the "Record Held by Another User" message on application design files (such as in the OUTPUT editor), you can use the following code in a SUBR within that application:
      BEG READ 0AD PROCESS                HOLD 1 KEY IS  PROCESS KEY
      END READ 0AD PROCESS
You can hold (but not write, rewrite or delete) 0-app file records. The above code attempts to lock every PROCESS file record. If it gets hung on a Process for more that 10 seconds, it generates the message:
 Waiting for lock held by APX in /usr/appx/data/00/SUR/Data/PROCESS.dat
or
 Waiting for lock held by session 9999 in /appx/data/00/SUR/Data/PROCESS.dat
You get the former if "track_locks;" is defined in an FMS group referenced by the application's Application record in System Administration.

You get the latter if there is no "track_locks;". This could be more useful, as it tells you *which* APX user session holds the lock.


You can also use the lsof (or fuser) commands to find information about open files. lsof shows you all files currently opened by a given process, or it can show you all processes that have opened a given file.

lsof and fuser are available on Linux and Unix systems. Windows systems use 'Process Explorer':

 Windows - use SysInternals.com's Process Explorer utility:
           http://www.sysinternals.com ... look for "Process Explorer"
AIX - http://aixpdslib.seas.ucla.edu/packages/lsof.html

 HP/UX   - http://hpux.cs.utah.edu/hppd/hpux/Sysadmin/lsof-4.70

 Red Hat Linux - part of the lsof RPM package

 Solaris - use the fuser command instead of lsof

[Append to This Answer]
2006-Nov-21 5:04pm
Previous: (Answer) WinSQL: APPX ODBC debug utility.
Next: (Answer) How APPX License counts WS's
This document is: http://board.appx.com/cgi-bin/fom.cgi?file=244
[Search] [Appearance]
This is a Faq-O-Matic 2.719.
Copyright 2003 by APPX Software, Inc. All rights reserved.