Recently there was a post to comp.os.vms, JIB Jab. It asked of a way, from DCL, to determine the name of a process' job logical name table. I posted (and submitted to dcl.openvms.org) the following procedure as a solution:
$ set noon
$ on warning then goto bail_out
$ on control_y then goto bail_out
$
$ say = "write sys$output"
$
$ p1 = f$edit(p1,"TRIM,UNCOMMENT,COLLAPSE,UNCOMMENT")
$ if (p1 .eqs. "") then p1 = f$getjpi("","PID")
$
$ pipe say "show process/id=''p1'" -
| analyze/system -
| search sys$pipe "JIB" -
| ( read sys$pipe result ; -
define/job/nolog pipe_result &result )
$
$ jibadr = f$element(5," ",f$edit(f$trnlnm("PIPE_RESULT"),"COMPRESS,TRIM"))
$
$ say "The job table for process ''p1' is LNM$JOB_''jibadr'"
$
$bail_out:
$ exitt 1
The procedure accepts the process id to look up in P1. If no process id is specified then, like all process related queries, it default to the current process.
This procedure works because a process' job logical name table is constructed from the string 'LNM$JOB_' and the 32-bit hexadecimal representation of the Job Information Block (JIB) address. The JIB of a process is accessible via the ANALYZE/SYSTEM utility and its SHOW PROCESS command. The output from SHOW PROCESS looks something like the following snippet:
Process index: 02CA Name: Tim at FTA40 Extended PID: 20404ECA
--------------------------------------------------------------------
Process status: 020C0001 RES,PHDRES,HIBER,INTER
status2: 00000001 QUANTUM_RESCHED
By searching for the string 'JIB' the address is extracted and the job logical name table is determined. The following test demonstrates the procedure works correctly.
$ @GETJIB
The job table for process 2040500B is LNM$JOB_82483040
$ SHOW LOGICAL/JOB ASDF*
(LNM$JOB_82483040)
%S, no translation for logical name ASDF*
As at: Friday, 18 May 2012 03:36 Updated: Thursday, 18 November 2010 08:47 (1 year ago)