Doug Chanco wrote:
Hello all,
I am back in the universe world after working in jBASE for many
years now, is there a better tool than LIST.READU to show the locking
table? (similar to jBASE SHOW-ITEM-LOCKS which is pretty awesome)
It shows record locks BUT not what file the lock is on ....... I am
still learning our system and seeing a lock like "123456789" does not
tell me anything about what file the lock is on, I suppose I might be
able to figure out something with the inode but still ......
I wrote some code today in Universe on an AIX system; basic code locks a
record, executes a LIST.READU to show user the locks, prompts user for
Inode of the locked record and returns "ls data" for the pathname.
Quick and dirty, but it could be cleaned up and expanded to work for you...
>RUN ADE.BP FIND.LOCKED.FILE
NEW - LOCKED
Active Record Locks:
Device.... Inode.... Netnode Userno Lmode Pid Login Id
Item-ID.............
655393 573455 0 12 71 RU 53522 conv1234 ALLEN
INODE: 573455
12/09/07 04:59:17pm
EXECUTING SH 'find / -inum 573455 -ls'
12/09/07 05:00:20pm
573455 276 -rw-rw---- 1 conv1234 conv1234 280576 Dec 7 12:34
/CONV1234/UV.E
XTRA.CONV/VOC >
>CT ADE.BP FIND.LOCKED.FILE
FIND.LOCKED.FILE
0001 * UV.EXTRA.CONV; ADE.BP; FIND.LOCKED.FILE
0002
0003 * Quick & dirty - given inode of locked record from LIST.READU,
0004 * find the filepath.
0005 *
0006 * Code for demo purposes, sets own lock.
0007 *
0008 * ADE 12/09/07 - original design/coding
0009
0010
0011 * UniVerse Compiler Directives
0012 $OPTIONS EXEC.EQ.PERF ;*Compile EXECUTE as a PERFORM which reuses
worksp
ace
0013 $OPTIONS PIOPEN.EXECUTE ;*EXECUTE can use CAPTURING & RETURNING but
reuse
wrkspace
0014 $OPTIONS TIME.MILLISECOND ;* Return time in whole seconds
0015
0016 * Constants
0017 PROMPT ""
0018
0019 * Open the file, set the lock.
0020 OPEN "", "VOC" TO F.VOC ELSE
0021 CRT "YEAH RIGHT"
0022 STOP
0023 END
0024 D.VOC = ""
0025 *
0026 READU D.VOC FROM F.VOC, "ALLEN" THEN
0027 CRT "EXISTING - LOCKED"
0028 END ELSE
0029 CRT "NEW - LOCKED"
0030 END
0031
0032 * Show the lock(s).
0033 EXECUTE "LIST.READU ALL"
0034
0035 * Prompt user for INODE of locked record.
0036 CRT "INODE: ":
0037 INPUT INODE
0038 LEN.INODE = LEN(INODE)
0039
0040 CMD = "find / -inum ": INODE: " -ls"
0041 CMD = "SH '": CMD: "'"
0042 *
0043 CRT OCONV(DATE(), "D2/"): " ": OCONV(TIME(), "MTHS")
0044 CRT "EXECUTING ": CMD
0045 EXECUTE CMD CAPTURING CMD.CAP RETURNING CMD.RET
0046 CRT OCONV(DATE(), "D2/"): " ": OCONV(TIME(), "MTHS")
0047 *
0048 REM1 = 999
0049 LOOP WHILE REM1 NE 0
0050 REMOVE LINE FROM CMD.CAP SETTING REM1
0051 IF LINE[1, LEN.INODE] EQ INODE THEN
0052 CRT LINE
0053 END
0054 REPEAT
0055
0056 * Done.
0057 STOP
--
Allen Egerton
aegerton at pobox dot com
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/