Article 4263 of vmsnet.internals:
Path: nntpd.lkg.dec.com!pa.dec.com!decwrl!genmagic!sgigate.sgi.com!swrinde!gatech!news.mathworks.com!mvb.saic.com!macro32
From: "Brian Schenkenberger, VAXman-" <brians@advsyscon.com>
Newsgroups: vmsnet.internals
Subject: RE: Q: 2 Questions
Message-ID: <00994538.7E8A2C40.7@AdvSysCon.COM>
Date: Thu, 03 Aug 1995 14:47:18 EST
Organization: Macro32<==>Vmsnet.Internals Gateway
X-Gateway-Source-Info: Mailing List
Lines: 97

>	Hello all,
>
>	I have 2 questions. Perhaps someone can help me.
>
>	1) What is the equivalent of the EXE$NAMPID routine in
>	   OpenVMS AXP?

Isn't one... Not directly.  Try EXE$NAM_TO_PCB.  If you don't know what
to do after you've got the PCB you shouldn't be playing in K mode.

>	2) I'am looking for a code which provide services similar
>	   to the DCL SHOW LOGICAL command:
>
>	   o - accepts (one or more) (wildcarded) logical name(s)
>	   o - accepts (one or more) (wildcarded) logical name table name(s)
>	   o - if requested, performs iterative translation
>	   o - is called repeatly until no more names are available.
>
>	   Has anyone written a routine which provides one or more
>	   of the features above? If so, where can i get them from?

Time to get intimate with the I&DS chapter on Logicals... In addition,
here's a little toy I had stashed in one of my directories.  Should get
you a start.

-------
VAXman-


	.library	"sys$library:lib.mlb"
	.link		"sys$system:sys.stb"

	$lnmdef		; logical name 
	$lnmstrdef	

	.psect	data,wrt,noexe,long,5

lnm:	.quad	0
chan:	.long	0
iosb:	.quad	0

args:	.long	1
	.address	wildcrd

wildcrd:.ascid	/*LNM$JOB*/

term:	.ascid	/SYS$OUTPUT/

	.psect	code,nowrt,exe,long,5
	.entry	go,0

	$assign_s	chan=chan,devnam=term

	$cmkrnl_s	routin=k_rtn,arglst=args
	ret

	.entry	k_rtn,^m<>
	movl	@#lnm$al_hashtbl,r0	; get pointer to shareable hash tbl 
10$:	movl	(r0),r0			; get the address of the hash table
	movzwl	lnmhsh$w_size(r0),r3	; get the size of the hash table
	subl2	#lnmhsh$k_bucket,r3	; less the size of the table header
	ashl	#-2,r3,r3		; alchemy: change bytes to longwords
	movab	lnmhsh$k_bucket(r0),r2	; start of the hash index listheads

20$:	movl	(r2)[r3],r5		; get a listhead entry at index=r3
	beql	50$			; was it zero? go try another
30$:	bbc	#lnmb$v_table,-		; does LNMB maintain the name of a
		lnmb$b_flags(r5),40$	;    logical table? branch 40 if not
	bsbb	chkmatch		; see if the LNMB's string matches
40$:	movl	(r5),r5			; get the next LNMB in the chain
	bneq	30$			; if not zero, chain not exhausted
50$:	sobgeq	r3,20$			; decr. hash index counter.

	tstl	r2			; see if we have process hash tbl
	bgtr	60$			; yes?  done. (p1 adr>0)(S0 Adr<0)
	movl	@#lnm$al_hashtbl+4,r0	; get process-private hash table
	brb	10$			; branch 10$ and check it out.

60$:	movl	#1,r0			; that's all folks!
	ret				

chkmatch:	
	movzbl	lnmb$t_name(r5),lnm	; make ascic string into descr.
	movab	lnmb$t_name+1(R5),lnm+4

	pushl	4(ap)			; put wildcard string on stack
	pushab	lnm			; put logical name descr on stack
	calls	#2,g^str$match_wild	; let RTL do the dirty work
	blbs	r0,10$			; was a match? Then, output it.
	rsb				; better luck next time.

10$:	$qiow_s	chan=chan,func=#io$_writevblk,iosb=iosb,-	;qio to
		p1=@lnm+4,p2=lnm,p4=#^x8d010000			; output
	rsb				; thank you sir, may I have another
	
	.END	GO



