Article 140870 of comp.os.vms:
Path: nntpd.lkg.dec.com!pa.dec.com!decwrl!spool.mu.edu!munnari.OZ.AU!ihnp4.ucsd.edu!mvb.saic.com!info-vax
From: chris@ccagroup.co.uk
Newsgroups: comp.os.vms
Subject: Re: If $TRNLNM doesn't take wildcards, how can SHOW LOGICAL?
Message-ID: <0099E493.B0363B80.219@ccastat.demon.co.uk>
Date: Thu, 22 Feb 1996 09:50:40 GMT
Organization: Info-Vax<==>Comp.Os.Vms Gateway
X-Gateway-Source-Info: Mailing List
Lines: 68

Bad news I'm afraid - SHOW LOGICALS dives into the internals. There used to
be exec routines available to scan logical name tables - both $TRNLNM and
SHOW LOGICALS use these. I don't know whether they're still available.
Maybe there's a guru out there somewhere, or you have the VMS source fiche &
a love of kernel mode code. Here's some code of mine which used it - this is
from a program called SETUSER.MAR of mine, which I think made it onto a SIG
tape a few years ago (part of an offering from CCAUK).
        .extrn  lnm$lockr, lnm$firsttab, lnm$unlock

; LNM$LOCKR - Lock LNM mutex for READ
; Input:
;       R4 = PCB
; Output:
; IPL = astdel
;       R0 = status

; LNM$FIRSTTAB - look up LNM table
; Input:
;       R1 = access mode, bit 8 = case_blind flag
;       R2 = name length
;       R3 = name address
; Logical name mutex must be locked READ or WRITE
; Output:
;       R0 = status
;       R1 = logical name table header
;       R2 = actual name length (in LNMB)
;       R3 = actual name address (in LNMB)

; LNM$UNLOCK - release LNM mutex
; Input:
;       R4 = PCB
; Output:
;       R0 = status
;       R1, R2, R3 modified
        clrl    r0
        movl    pcb$l_jib(r4), r2
1$:     extzv   r0, #4, r2, r1
        movb    b^hex(pc)[r1], -(sp)
        acbl    #28, #4, r0, 1$
        movq    job, -(sp)

; lockr
        jsb     g^lnm$lockr     ; trash r0-3, require r4 = pcb
; searchlog
        movl    #16, r2
        movl    sp, r3          ; lognam
        movzwl  #256, r1        ; acmode!case_blind
        jsb     g^lnm$firsttab
        movq    r0, -(sp)       ; save result while we release mutex
; unlock
        jsb     g^lnm$unlock    ; trash r0-3, require r4 = pcb
        setipl  #0              ; allow process deletion again
                                ; ipl was raised to ASTDEL in LNM$LOCKR
        movq    (sp)+, r0
; we now have our job table lnmb
        blbc    r0, 9$
assume orb$l_owner,eq,0
        movl    4(ap), @lnmth$l_orb(r1)
9$:     ret

This program fragment finds the logical name structures & changes the ownership
There's probably some more useful calls.
This is probably much more involved than you want to get - maybe you could use
a single logical:
define my_logical "equiv0 = value0","equiv1 = value1",...
You can get at this via $trnlnm.

Chris Sharman, CCA Stationery, Eastway, Fulwood, Preston, UK


