Jabbing the JIB...

Monday, 26 October 2009 07:43

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 solution:

The procedure below accepts the process id to look up in P1.  If no process id is specified then, like all process related queries, it defaults to the current process.

$ set noon
$ on warning then goto bail_out
$ on control_y then goto bail_out
$ say = "write sys$output"
$ 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'"
$ exitt 1

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

PCB address              8227CEC0    JIB address              824817C0
PHD address              8462E000    Swapfile disk address    00000000
KTB vector address       8227D1B0    HWPCB address   FFFFFFFF.8462E080

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.

The job table for process 2040500B is LNM$JOB_82483040

%S, no translation for logical name ASDF*