From:	SMTP%"RELAY-INFO-VAX@CRVAX.SRI.COM" 15-JAN-1994 18:23:16.68
To:	EVERHART
CC:	
Subj:	Re: Appending to logical names definitions

X-Newsgroups: comp.os.vms
From: bigmike@rossinc.com (Michael Nowacki)
Subject: Re: Appending to logical names definitions
Message-Id: <1994Jan14.191354.11091@rossinc.com>
Organization: Ross Systems, Inc.
Date: Fri, 14 Jan 1994 19:13:54 GMT
Lines: 85
To: Info-VAX@CRVAX.SRI.COM
X-Gateway-Source-Info: USENET

In <2h4rum$dq@gap.cco.caltech.edu> carl@SOL1.GPS.CALTECH.EDU (Carl J Lydick) writes:

>In article <1994Jan12.142123.713@buckie.uh.colorado.edu>, dwing@uh01.Colorado.EDU (Dan Wing) writes:
>=No; however here's some code stolen from NEWSRDR_STARTUP.COM (a product
>=written by MadGoat Software):
>=
>=$!
>=$! Subroutine for adding a directory to a search list logical name
>=$!
[DCL deleted...]

>Please note that the above code doesn't deal at all with translation
>attributes.  The following procedure returns the translation, including
>attributes, but doesn't deal with either translation mode or logical name table
>(i.e., it implicitly uses LNM$FILE_DEV to define the tables it searches).

>$! GET_TRANSLATION.COM -- Return translation of parameter P1 in the symbol
[Carl's DCL deleted...]

I got Carl's proc via mail last month and it has evolved into this:

$! split_logical.com
$ IF P2 .NES. "" THEN goto start
$ type sys$input
De-compose a logical name into its equivalents and translation
attributes.
Specify a logical name in parameter P1 (input) and a symbol name prefix
in P2.

Creates symbols whose names are prefixed with the string specified as
P2:

 'P2'_NITEMS  = number of elements in the logical name specified as P1
 'P2'_EQU_'n' = device:[directory] path for each equivalence in the P1
logical
 'P2'_ATR_'n' = command qualifiers used to define each logical name in
P1

Use these symbols to duplicate the existing logical name when modifying
it or
creating related logicals.

Example:
 @split_logical decw$book foo
 sho sym foo*
  FOO_ATR_0 == ""
  FOO_ATR_1 == ""
  FOO_ATR_2 == ""
  FOO_ATR_3 == ""
  FOO_EQU_0 == "W6$DKA400:[DECW$BOOK]"
  FOO_EQU_1 == "DISK17:[DECW$BOOK]"
  FOO_EQU_2 == "ROCKET$DKC100:[DECW$BOOK]"
  FOO_EQU_3 == "ROCKET$DKB0:[DECW$BOOK]"
  FOO_NITEMS == 4   Hex = 00000004  Octal = 00000000004

 @split_logical sys$sysroot bar
 sho sym bar*
  BAR_ATR_0 == "/TRANS=(CONC,TERM)"
  BAR_ATR_1 == ""
  BAR_EQU_0 == "ROCKET$DKA0:[SYS0.]"
  BAR_EQU_1 == "SYS$COMMON:"
  BAR_NITEMS == 2   Hex = 00000002  Octal = 00000000002

$ exit
$start: MAX_INDEX = F$TRNLNM(P1,,,,,"MAX_INDEX")
$ 'P2'_NITEMS == MAX_INDEX + 1
$ N = 0
$LOOP:
$ 'P2'_EQU_'n' == F$TRNLNM(P1,,N)
$ TERM = F$TRNLNM(P1,,N,,,"TERMINAL")
$ CONC = F$TRNLNM(P1,,N,,,"CONCEALED")
$!
$ 'P2'_ATR_'N' == ""
$ IF TERM .AND. CONC
$ then 'P2'_ATR_'N' == "/TRANS=(CONC,TERM)"
$ else  IF TERM
$       then 'P2'_ATR_'N' == "/TRANS=TERM"
$       else    IF CONC
$               then 'P2'_ATR_'N' == "/TRANS=CONC"
$               endif
$       endif
$ endif
$ N = N + 1
$ IF N .LE. MAX_INDEX THEN GOTO LOOP
$ exit