I am currently seeking contract or permanent employment in the Sydney area. If you know of a company requiring OpenVMS expertise in infrastructure management, storage management, porting, operations, systems or applications programming, please contact me.
Problem: you need to dismount a disk that has an image installed /SHARED on it. When you attempt to de-install the image, VMS tells you that it can't because someone has the image open. However, in this situation, SHOW DEV/FILES only shows you that the image is installed, and not who has it open. Bummer.
Solution:
$! See bottom of file for comments.
$ set on
$ on warning then goto error
$ on control_y then goto error
$ say := write sys$output
$ ask := read/error=error/end_of_file=error sys$command -
command/prompt=
$ do_header = 1
$ required_privs = "WORLD, CMKRNL"
$ old_privs = f$setprv (required_privs)
$ if .not. f$privilege (required_privs)
$ then
$ say "Required privileges: " + required_privs
$ goto exit
$ endif
$ask_p1:
$ image = f$edit (p1, "uncomment, collapse")
$ if image .eqs. ""
$ then
$ ask "Image to search for? "
$ p1 = f$edit (command, "uncomment,collapse")
$ goto ask_p1
$ endif
$ if f$search (image) .eqs. ""
$ then
$ say "Can't find image: " + image
$ p1 = ""
$ goto ask_p1
$ endif
$ image = "]" + f$parse (image,,,"name") + -
f$parse (image,,,"type") + ";"
$
$ context = ""
$ temp1 = "sys$scratch:" + f$unique() + ".tmp"
$ temp2 = "sys$scratch:" + f$unique() + ".tmp"
$loop:
$ pid = f$pid (context)
$ if pid .eqs. ""
$ then
$ goto end_loop
$ endif
$ open/write out 'temp1'
$ write out "$ define/user sys$output nl:"
$ write out "$ define/user sys$error n:"
$ write out "$ analyze/system"
$ write out "$ deck"
$ write out "set output " + temp2
$ write out "show process/channel/index=" + pid
$ write out "exit"
$ write out "$ eod"
$ write out "$ exit"
$ close out
$ @'temp1'
$ delete/nolog 'temp1';*
$ define/user sys$output nl:
$ define/user sys$error nl:
$ search 'temp2' "''image'"
$ if f$integer ($status) .eq. 1
$ then
$ if do_header
$ then
$ do_header = 0
$ say "PID Process"
$ endif
$ say pid + " " + f$getjpi (pid, "prcnam")
$ endif
$ delete/nolog 'temp2';*
$ goto loop
$end_loop:
$ goto exit
$error:
$ set noon
$exit:
$ if f$trnlnm ("out") .nes. ""
$ then
$ close out
$ endif
$ if f$type (temp1) .nes. ""
$ then
$ if f$search (temp1) .nes. ""
$ then
$ delete/nolog 'temp1';*
$ endif
$ endif
$ if f$type (temp2) .nes. ""
$ then
$ if f$search (temp2) .nes. ""
$ then
$ delete/nolog 'temp2';*
$ endif
$ endif
$ old_privs = f$setprv (old_privs)
$ exit
$!++
$!
$! DESCRIPTION
$!
$! This command procedure, given the name of an image file
$! (or any file for that matter) uses SDA's SHOW PROCESS/CHANNEL
$! command to locate processes that have an open channel to
$! files of that name. Note only the file name and type are
$! matched, but this will usually be quite enough to locate the
$! process you are looking for (and that way I don't have to get
$! into messy file parsing and searching).
$!
$! AUTHOR
$!
$! James F. Duff
$!
$! DATE
$!
$! 23-Jun-2009
$!
$! MODIFICATIONS
$!
$! X01-00 Jim Duff 23-Jun-2009
$! Original version of module.
$!
$!--
[17-Jun-2009]
WatchDir X01-05:
I've make a new version of WatchDir available on the website. This is in response to someone out in userland not understanding the code and running the utility with privileges in what I'm going to call "experiment mode". Two crashes later... (145 words)
[13-Jun-2009]
CMKRNL and /DEBUG:
Prompted by a site experiencing a system crash after compiling, linking, and running one of my kernel mode utilities under control of the standard debugger, I have to stress that doing this is extremely unsupported and things like system crashes are to be expected. Use the DELTA/XDELTA debugger instead. (362 words)
[27-Apr-2009]
$ SET RESTART_VALUE:
A little used feature of DCL appears to be the $ SET RESTART_VALUE command. This is a pity, as this is an extremely useful technique to know if you wish to guarantee that a command procedure will always run, despite system crashes or operator intervention. (286 words)
[08-Apr-2009]
CSS Naked Day 2009:
eight-cubed.com once again bares it all in support of web standards. If you're wondering what happened to the site design, see the link. (23 words)
[01-Apr-2009]
MATH utility:
Announcing a Bison based utility that implements an infix calculator supporting all the one argument double precision C math functions. You can get a zip file containing full source code, and a binary compiled and linked on Alpha 8.2 from the MATH section on the downloads page. (583 words)
[31-Mar-2009]
Contract summary:
Today is the last day of my current contract. I've had quite a bit of fun, learning and teaching opportunities, frustration and accomplishment, in the nearly nine months I've spent working for this company. For a description of the high and low points, read on. (1533 words)
[22-Mar-2009]
Test cases for examples:
I've been using DTM for quite some time to store test cases for the code examples available on this site. Lately, I've made a concerted effort to generate tests for code examples that previously didn't have a test, and I'm happy to report that of the 207 examples, now only 27 lack a test (and I'm working on those). (82 words)
[12-Mar-2009]
Output redirection:
There are a number of ways to redirect the output from execution of a DCL command procedure to a file, some more obscure that others. (286 words)
[23-Feb-2009]
Artistic Style 1.23 released:
Artistic Style 1.23 has been released, and I have ported it OpenVMS. Artistic Style is a source code indenter, formatter, and beautifier for the C, C++, C# and Java programming languages, maintained by Jim Pattee. This version updates a lot of the format processing for various of the supported languages to reflect standardization in indent style over the last couple of years.
More information, the the release notes, and the links to download the package can be found at the Artistic Style home page. (100 words)