I was pleasantly surprised to see that in D3,
the basic command READU can assert
a lock on a planned item name even before you
create the item.
Since that lock, and that filename, show up in the
output of TCL verb LIST-LOCKS, it seems this
lets a subroutine find out the actual filename of an
open file handle it gets, for example via either
MYSUB(myfile)
or
COMMON myfile
In other words, just have the subroutine READU
an item id known not to exist, then
EXECUTE "LIST-LOCKS" CAPTURING STUFF
and paw through STUFF for the filename on the same
line as you see your mythical item name.
Suggestion: use id = 'mycroftxxx':SYSTEM(22)
{system(22) is your pick ****t number} as test item id.
Also , here's an example of READU three-clause usage;
READU myfile, "george" LOCKED
CRT 'name george is locked by someone else;':
CRT ' item may or may not exist'
END THEN
CRT 'george did exist, and we now own a lock on that name'
END ELSE
CRT 'george does not exist, but we now own a lock on the name'
END


|