Operating System - OpenVMS
1828270 Members
3363 Online
109975 Solutions
New Discussion

Translating Logical Name

 
SOLVED
Go to solution
Barry Alford
Frequent Advisor

Translating Logical Name

I want to access a logical name value within a (Fortran) program -- I can do this with a call to SYS$TRNLNM but I have to specify a specific table or a list in which to look it up.

I'd like to use the same translation mechanism as DCL does (default: process, job, group, system). Is there an easy way to do this?

I'd like this to work on fairly old versions of VMS (7.1 on...)
12 REPLIES 12
Marc Van den Broeck
Trusted Contributor

Re: Translating Logical Name

Hi,

you can use lib$get_logical.
(See help rtl lib$)

Rgds
Marc
Martin Vorlaender
Honored Contributor

Re: Translating Logical Name

Hi,

the logical name LNM$FILE_DEV in table LNM$SYSTEM_DIRECTORY holds the table names that get searched.

HTH,
Martin
Jan van den Ende
Honored Contributor

Re: Translating Logical Name

Barry,

To begin with: Welcome to the VMS forum!

Martin just about described the answer, but to put it in the phrasing of your question:

Use LNM$FILE_DEV as the table, and you and up with the same translation that VMS presents to $TRNLNM (and its derivatives).
This way you also take in account any redefines that might be in effect.

hth.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Robert Gezelter
Honored Contributor

Re: Translating Logical Name

Barry,

To my recollection (without a set of V5.0 manuals handy), SYS$TRNLNM has not changed significantly over the entire time.

On the translation side, the additon of cluster logical names was done by expanding the definition of LNM$SYSTEM to embrace the cluster-wide table (LNM$SYSTEM, the name for the System Logical name table, is used in LNM$FILE_DEV).

You can display the contents of the default LNM$FILE_DEV with the command:
SHOW LOGICAL LNM$FILE_DEV/TABLE=LNM$SYSTEM_DIRECTORY

- Bob Gezelter, http://www.rlgsc.com
Ian Miller.
Honored Contributor

Re: Translating Logical Name

The DCL SHOW LOGICAL command uses the list of logical name tables defined by the logical name LNM$DCL_LOGICAL. This is usually LNM$FILE_DEV which is the list of logical name tables used by RMS when processing file specifications.

Both of these are defined in LNM$SYSTEM_DIRECTORY which is a logical name table containing names of logical name tables which are shared.

The names of process local logical name tables are held in LNM$PROCESS_DIRECTORY.

So the answer to your question is specify LNM$DCL_ TABLE as the the logical name table when calling $TRNLNM.
____________________
Purely Personal Opinion
Barry Alford
Frequent Advisor

Re: Translating Logical Name

Thanks for your replies, but I don't seem to get them to work. The attached program uses DCL, $TRNLNM and LIB$GET_LOGICAL to translate a name which is input. Only the spawned DCL finds the logical name!

Sample output:
$ run log
SYS$SYSDEVICE
"SYS$SYSDEVICE" = "DS6000$DKA0:" (LNM$SYSTEM_TABLE)
SYS$TRNLNM:
444 no logical name match
LIB$_GET_LOGICAL:
444 no logical name match

What's going on?
Barry Alford
Frequent Advisor

Re: Translating Logical Name

Further info showing the (default) setup...

$ SHOW LOGICAL LNM$FILE_DEV/TABLE=LNM$SYSTEM_DIRECTORY
"LNM$FILE_DEV" = "LNM$PROCESS" (LNM$SYSTEM_DIRECTORY)
= "LNM$JOB"
= "LNM$GROUP"
= "LNM$SYSTEM"
= "DECW$LOGICAL_NAMES"
1 "LNM$SYSTEM" = "LNM$SYSTEM_TABLE" (LNM$SYSTEM_DIRECTORY)
= "LNM$SYSCLUSTER"
2 "LNM$SYSCLUSTER" = "LNM$SYSCLUSTER_TABLE" (LNM$SYSTEM_DIRECTORY)
1 "DECW$LOGICAL_NAMES" [table] = "" (LNM$SYSTEM_DIRECTORY)
Hein van den Heuvel
Honored Contributor
Solution

Re: Translating Logical Name

The problem is that you are passing a space padded string. As a test, just change that lnm variable size to 13 and it will work. For a real solution you'll have to 'trim' the string or rather pass a descriptor to the variable with the length set to the first space location.

Hein.
John Gillings
Honored Contributor

Re: Translating Logical Name

Further to Hein's comment.

Simple rule for system services. Don't expect them to do ANY extra processing of parameters. No trimming of whitespace or case conversions. What you pass is what is used.

Logical name tables are case sensitive, but most of the time, logical names are upper case. When calling $TRNLNM, make sure the string is exactly what you're looking for, with correct case, and all whitespace trimmed and correct length specified.

RTL routines STR$TRIM & STR$UPCASE might be useful.
A crucible of informative mistakes
Steven Schweda
Honored Contributor

Re: Translating Logical Name

> [...] STR$UPCASE [...]

Or specify the LNM$M_CASE_BLIND flag when
calling SYS$TRNLNM()(first argument).

I had this one all figured out, too, but my
Fortran is so rusty these days, that HvdH got
his response posted while I was still running
my test program. Such a disappointment.
Barry Alford
Frequent Advisor

Re: Translating Logical Name

Dank U wel, Hein! .. and thanks to John and Steven too for their advice. I tried using LNM$M_CASE_BLIND before, but I still had the length problem, of course.

The test program now works if I use the argument lnm(:length) where length=len_trim(lnm).

I appreciate the time everyone took to contribute.
Barry Alford
Frequent Advisor

Re: Translating Logical Name

Hein hit the spot with the string lengh!

I have been browsing the OVMS forums for a few months now and have gained valuable information just reading the topics. After posting my first question, I got a solution and some good advice within 24 hours!

I'll now close this thread.. thanks again, guys!