Article 19488 of comp.os.vms:
Path: jac.nuo.dec.com!pa.dec.com!decwrl!wupost!howland.reston.ans.net!agate!library.ucla.edu!network.ucsd.edu!news.service.uci.edu!unogate!mvb.saic.com!info-vax
From: Arne Vajhoej <ARNE@kopc.hhs.dk>
Newsgroups: comp.os.vms
Subject: Re: Does there exist a EXE$LNMHASH ?
Message-ID: <01H2VDOG5CSI8WW2NE@kopc.hhs.dk>
Date: Sun, 12 Sep 1993 19:06:52 +0100
Organization: Info-Vax<==>Comp.Os.Vms Gateway
X-Gateway-Source-Info: Mailing List
Lines: 103

> Someone mentioned to me that there should be a routine EXE$LNMHASH which
> could do a wildcard search for LNM-Tables (e.g. LNM$JOB_*) somehow.
> Is this true and has anyone yet done any programming examples with it ? I
> can't find any documentation about it (not even sys.map reveals any usefull
> information to me).

The following code will lookup all logicals in the process-table:

        .title  lookup
        .link   "sys$system:sys.stb"/selective_search
        .library "SYS$LIBRARY:LIB"
        $LNMSTRDEF
;
; readonly data section
;
        .psect  $PDATA quad,pic,con,lcl,shr,noexe,nowrt
prctbl: .byte   17
        .ascii  "LNM$PROCESS_TABLE"
;
; writeread data section
;
        .psect  $LOCAL quad,pic,con,lcl,noshr,noexe,wrt
tbladr: .blkl   1
;
; code section
;
        .psect  $CODE quad,pic,con,lcl,shr,exe,nowrt
;***************************************
;
;  LOOKUP ( LNM , LNML , NLNM )
;
;  lookup logicals (only process-table)
;
;***************************************
        .entry  lookup,^m<r2,r3,r4,r5,r6,r7,r8,r9,r10,r11>
        movl    @#CTL$GL_LNMDIRECT,r6   ; address of logical-directory
        movl    B^LNMB$L_TABLE(r6),r6   ; address of logical-directory-header
        movl    B^LNMTH$L_CHILD(r6),r6  ; address of first logical-table
100$:   movl    B^LNMTH$L_NAME(r6),r7
        cmpc3   #18,B^LNMB$S_LNMBDEF-1(r7),prctbl ; test if table-name is
        tstl    r0                                ; LNM$PROCESS_TABLE
        beql    200$
        movl    B^LNMTH$L_SIBLING(r6),r6          ; goto next table
        brb     100$
200$:   movl    r6,tbladr               ; address of logical-table-header
        movl    B^4(ap),r0
        movl    B^4(r0),r9              ; address of string-array
        movzwl  (r0),r10                ; size of string-array-elements
        movl    B^8(ap),r11             ; address of length-array
        clrl    @B^12(ap)               ; number of logicals
        movl    @#CTL$GL_LNMHASH,r6     ; address of hash-table
        movzwl  B^LNMHSH$W_SIZE(r6),r7  ; size of hash-table
        addl2   r6,r7                   ; end-address of hash-entries
        addl2   #LNMHSH$S_LNMHSHDEF,r6  ; start-address of hash-entries
300$:   cmpl    r6,r7                   ; test if finished
        bgeq    700$
        tstl    (r6)                    ; test if zero-entry
        beql    600$
        movl    (r6),r8                           ; address of logical-name-block
400$:   cmpl    B^LNMB$L_TABLE(r8),tbladr         ; test if table=LNM$PROCESS
        bneq    500$
        cvtbl   B^LNMB$S_LNMBDEF-1(r8),(r11)      ; get length
        movc3   (r11),B^LNMB$S_LNMBDEF(r8),(r9)   ; get string
        addl2   r10,r9
        addl2   #4,r11
        incl    @B^12(ap)
500$:   tstl    B^LNMB$L_FLINK(r8)      ; test if forward-link
        beql    600$
        movl    B^LNMB$L_FLINK(r8),r8   ; goto next in link
        brb     400$
600$:   addl2   #4,r6
        brb     300$
700$:   ret
        .end

Test-program:

      PROGRAM ZZ
      INTEGER*4 L(100),N,I
      CHARACTER*80 S(80)
      CALL LOOKUP(S,L,N)
      DO 100 I=1,N
        WRITE(*,*) S(I)(1:L(I))
100   CONTINUE
      END

It should be easy to modify it to lookup all logicals in a system-wide
table:

  - change CTL$GL_LNMDIRECT to LNM$AR_SYSTEM_DIRECTORY
  - change the table-name
  - run it in EXEC mode
  - whatever additional changes that is necesarry

Hope it helps !

                                                          Arne

Arne Vajhj                             local DECNET:  KO::ARNE
Computer Department                     PSI:           PSI%238310013040::ARNE
Business School of Southern Denmark     Internet:      ARNE@KO.HHS.DK




                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       