Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Logical name wildcard search

SOLVED
Go to solution
ptrskg
Frequent Advisor

Logical name wildcard search

Hello friends,

In a program I need to retrive logical names with wildcards like the DCL command:
$ sho log *AXES* and then do some procesing on the resulting list.
Have somebody any ideas/experience how to do that?

Thanks,
Peter
8 REPLIES
Anton van Ruitenbeek
Trusted Contributor

Re: Logical name wildcard search

Hello Peter,

We do have the same problem(s). We did solve this by doing this the &^%$%^^*&% Unix methode.
$ show log *axes*/output=
$ open/read/error=error file_in
$ loop1:
$ read/end_of_file=end file_in line
.

.
$ goto loop1
$ end:
$ close file_in
$ error:
$ if f$search("") .nes. "" then delete/nolog/noconfirm ;
$ exit

Succes on you,

AvR
NL: Meten is weten, maar je moet weten hoe te meten! - UK: Measuremets is knowledge, but you need to know how to measure !
Jan van den Ende
Honored Contributor

Re: Logical name wildcard search

Yeah..

wouldn't it be nice to have F$TRNLNM behave like F$SEARCH, F$PID, F$DEVICE, or F$GETQUI?

I know, different concepts internally, but the final effect is that they allow to scan through a list of objects that satisfy some selection criterion.

Deserves a place on the wish-list, in my opinion.
Guy, would that be an easy or a hard one?


Proost.

Have one on me.

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

Re: Logical name wildcard search

Peter,

My offhand recollection is that SHOW LOGICALS uses a different set of scanning code than the normal search and translate functions.

The easiest way I can think of is:

- do the appropriate SHOW/LOGICAL command, and use the /OUTPUT=filename option
- process the resulting file, with due regard for:
o table names (beginning with a "(")
o blank lines
o search lists -- these will have a value on the right hand side of the "=", but no left hand side

An alternative to this is to use only the left hand side of the SHOW LOGICAL result and use F$TRNLMN to get the actual value of the name, and its associated attributes,. This approach is far less work in the form of ad-hoc parsing.

I hope that the above is helpful.

- Bob Gezelter, http://www.rlgsc.com
Martin Vorlaender
Honored Contributor

Re: Logical name wildcard search

Peter,

You can download LNMLOOKUP for VAX and Alpha by Ferry Bolhár-Nordenkampf at http://vms.process.com/scripts/fileserv/fileserv.com?LNMLOOKUP . The description says "System service to look up logical names (wildcards too!)"

HTH,
Marti
Robert Brooks_1
Honored Contributor

Re: Logical name wildcard search

SHOW LOGICAL does not use SYS$TRNLNM to do its work. SHOW LOGICAL has knowledge of the relevant internal data structures that support logical names, as does $TRNLNM (obviously).

Having said that, it's not a simple case of adding wildcard support to F$TRNLNM; as with many lexical functions, F$TRNLNM is simply a wrapper around SYS$TRNLNM, so the modifications would need to be done to the system service. We would not entertain the possibility of allowing divergent behaviour between the DCL lexical and the system service by enhancing only the DCL lexical function.

The logical name subsystem is rather twisty and complicated; support for wildcarding would not be a quick midnight hack.

That said, if enough customers complain directly to product management, something may get done (stating support here or in other public fora does not help, as upper management does not tend to visit here)
Hein van den Heuvel
Honored Contributor
Solution

Re: Logical name wildcard search


Show log is really your only standard VMS tool today.

How often do you need to do this?
Once per login / batch job?
Once per minute?
It may well be reasonable to spawn SHOW LOG, or process it's output.

What kind of processing? I find the perl 'backtick' operator quit handy for a quick loop over command output. For example:

$ perl -e "foreach (`show log`){chop; $t=$_ if (/^\(/); print ""$t $1 $2\n"" if (/""(.*LOGIN.*)"" = ""(.*)\""/)}"


It looks a little ugly because you need to double up quotes in a quoted string.

The first regexp: (/^\(/)
^/\) = string that starts with (escaped) paren

The second: (/""(.*LOGIN.*)"" = ""(.*)""/)}"

"" = Find quote
( = remember in $1
.* = piece of string
LOGIN
.* = piece of string
) = stop remembering
"" = "" = quote space equal-sign space quote
( = remember in $2
.* = piece of string = translation
) = stop remembering

alternatively you can SPLIT the line by quotes selecting element 1 and 3 (0 based).
The example pick up the tablename in $tb, the logical name in $lo and the translation in variable $tr. It simply prints that lot.

$ perl -e "foreach (`show log`){$tb=$_ if (/^\(/); ($lo,$tr)=(split(/""/))[1,3]; print ""$lo $tr $tb"" if ($tr && $lo =~ /LOGIN/)}"

cheers,
Hein.
Jan van den Ende
Honored Contributor

Re: Logical name wildcard search

Robert,

thanks for the explanation

Hein,
no offence meant, but I think I will stick to DCL :-)

I want to be able to use my pet tools procedures on every system I happen to run in to.

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
ptrskg
Frequent Advisor

Re: Logical name wildcard search

Thanks for all answers!
Peter