Operating System - OpenVMS
1828473 Members
2969 Online
109978 Solutions
New Discussion

search with redefined sys$output => NOSUCHDEV

 
SOLVED
Go to solution
Gilles Pion
Advisor

search with redefined sys$output => NOSUCHDEV

Hello everybody,

I've just found a strange problem with the search command.

Running this sample script:

$ on error then goto end
$ open/write out sys$login:out.lis
$ define sys$output out:
$ search sys$login:login.com nothing
$
$ end:
$ close out
$exit


produce the error status:
%SYSTEM-F-NOSUCHDEV, no such device available

This only seem to happen with the “search" command, any other command I'have tried has succeeded

Any advice?

(tested on VMS 7.3-2)
16 REPLIES 16
Albert Öttl
Advisor

Re: search with redefined sys$output => NOSUCHDEV

Hi Gilles,

If you define sys$output to "out:" then
VMS tries to open a device called "out:" because
of the colon.

The above "$ open/write out" defines a file
handle, not a logical device.

In short. use "$search/output=sys$login:out.lis"
or "$ define sys$output sys$login:out.lis"

LG
Albert
Robert Gezelter
Honored Contributor

Re: search with redefined sys$output => NOSUCHDEV

Gilles,

At first glance (I am running for a meeting), I would agree with Albert's suggestion: remove the ":" from the /OUTPUT qualifier and the logical name definition.

- Bob Gezelter, http://www.rlgsc.com
Gilles Pion
Advisor

Re: search with redefined sys$output => NOSUCHDEV

It seems that using "define sys$output " works

I did'nt try at first because I thought that , in this case, each commands in the script would have opened a new version of the output file, but dcl seem to be smart enough not to behave this way.

But what stills puzzle me is that, when using the original approach, other command than "search" (say "dir" for example) works as expected (output correctly redirected to out.lis)

Note also that this script is a simple example, using /output= is not an option in reality because the actual script execute many commands in sequence and most of them does not support the /output" qualifier.

labadie_1
Honored Contributor

Re: search with redefined sys$output => NOSUCHDEV

For the Vms commands not allowing /output, you can do
$ @tt:/out=file
and then ctrl Z at the end
Rob Kersey
Advisor

Re: search with redefined sys$output => NOSUCHDEV

Is that a supported feature or is it un-documented?
labadie_1
Honored Contributor

Re: search with redefined sys$output => NOSUCHDEV

I do not know if it is documented. I suspect it is a V1 feature.
Hein van den Heuvel
Honored Contributor

Re: search with redefined sys$output => NOSUCHDEV


Giles>> Any advice?

Use DEFINE /USER and all will be well.

Looks like a minor search problem.

Albert>> The above "$ open/write out" defines a file handle, not a logical device.

It creates a process permanent file accesssible through the logical name 'out',
which appear to be exactly what Giles want. He would not want a 'device'.

Albert>> In short. use "$search/output=sys$login:out.lis"
or "$ define sys$output sys$login:out.lis"

No, that give entirely different semantics.
It will create a fresh file every time.
The DCL open allows one to collect output from multiple programs in a consistent way.
At least, that is the intent.
DCL creates a VFC file which theoretically allows for better combining, where the other solutions create simple VAR files, but that difference is rarely needed/appreciated.

Bob>> remove the ":" from the /OUTPUT
Nah.. makes no difference here and the ":" will make it clear the script intents to use a logical name, not a file called out.

Cheers,
Hein.





Gilles Pion
Advisor

Re: search with redefined sys$output => NOSUCHDEV

define/user is not a solution: the real script runs many images in sequence and the sys$output definition will not survive the first image rundown

To be more precise the procedure is supposed to run either in batch or in interactive mode.

I woul like this kind of functionality:

if then
redirect sys$output to listfile for the rest of the script
fi
remaining stuff here
....
Robert Gezelter
Honored Contributor

Re: search with redefined sys$output => NOSUCHDEV

Gilles,

I got back from my meeting, and I see that there has been some back and forth on this topic.

Going back a ways (OpenVMS VAX 6.2, to be precise), the problem you mention is reproduceable there.

Apparently, there something unanticipated happening with SEARCH handling of the /OUTPUT parameter. However, essentially the same construct will work, as follows:

$ OPEN/WRITE OUTPUTFILE X.TMP
$ SEARCH/OUT=OUTPUTFILE filename string
$ CLOSE OUTPUTFILE

Note that OUTPUTFILE is opened as a process permanent file by DCL (the OPEN command) and thus is appended to in sequence until it is closed.

On first glance, I do not see a reason why your original code should not work. Actually, using the /OUTPUT qualifier does not seem to affect the problem. ASSIGNing or DEFINEing the process permanent file to SYS$OUTPUT will also cause the error.

If you have a support contrat, I would suggest submitting this as a bug (unless, of course, someone can volunteer a good explanation of why this behavior is "correct").

- Bob Gezelter, http://www.rlgsc.com
David Jones_21
Trusted Contributor

Re: search with redefined sys$output => NOSUCHDEV

Sounds like another case where search's need to know the output device is causing trouble. IIRC, at one time it didn't work at all with PIPE out, but they fixed it so it mostly works now.

If wants to know the device type so it can highlight the matched text properly.
I'm looking for marbles all day long.
Jan van den Ende
Honored Contributor

Re: search with redefined sys$output => NOSUCHDEV

Gilles,

another point not addressed so far, and maybe of relevance here, is the
/USER
qualifier on the dDEFINE SYS$OUTPUT command/

User_mode definitions are automagically deassigned upon image rundown; and if I understand correctly, that is NOT the desired behavior.
If you leave out the /USER (or substitute it by /SUPER, the default) you get a definition that remains in effect until either redefined or explicitly deassigned.
This means all output in the mean time will go to the file pointed at by the logical.

hth

Proost.

Have one on me.

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

Re: search with redefined sys$output => NOSUCHDEV

Gilles,

To amplify on my posting from yesterday:

The file opened by the OPEN command (and assigned to be used for SYS$OUTPUT) is a process-permanent file opened by DCL and accessible to the user program).

Thus, the following should route all output to the "log" file:

$ OPEN/WRITE OUTPUTFILE X.TMP
$ SEARCH/OUT=OUTPUTFILE filename string
$ DIRECTORY/OUTPUT=OUTPUTFILE
...
$ CLOSE OUTPUTFILE

- Bob Gezelter, http://www.rlgsc.com
Gilles Pion
Advisor

Re: search with redefined sys$output => NOSUCHDEV

[Replying-to: Robert Gezelter]

>If you have a support contrat, I would suggest
>submitting this as a bug (unless, of course,
>someone can volunteer a good explanation of
>why this behavior is "correct").

I also consider this behaviour as a bug, but not very serious, just strange:

$ open/write out out.lis
$ define sys$output out:
$ sear login.com nohing
%SYSTEM-F-NOSUCHDEV, no such device available
$ sear login.com/out=out: no ! this one works!!!
$ sear login.com/out=sys$output: no
%SYSTEM-F-NOSUCHDEV, no such device available
Robert Gezelter
Honored Contributor
Solution

Re: search with redefined sys$output => NOSUCHDEV

Gilles,

Concur. I suggest that you file it with HP if you have a support contract). If you want, you can mail them the hyperlink to the ITRC thread.

- Bob Gezelter, http://www.rlgsc.com
Gilles Pion
Advisor

Re: search with redefined sys$output => NOSUCHDEV

Thanks, I've opened a support case.
Jess Goodman
Esteemed Contributor

Re: search with redefined sys$output => NOSUCHDEV

Another odd feature of SEARCH's output file processing is that, unlike other VMS utilities, it OPENs its output file before opening its input file.

This makes it more difficult to use SEARCH as an incremental filter:

$ CREATE NAMES.TXT
Sally FRIEND
Holly ENEMY
$ SEARCH NAMES.TXT FRIEND /OUTPUT=NAMES.TXT
%SEARCH-W-OPENIN, error opening NAMES.TXT;2 as input
-RMS-E-FLK, file currently locked by another user
%SEARCH-I-NOMATCHES, no strings matched

So you have to keep using new file names at each step of a multiple pass SEARCH filter, or use a version number with the input file.

I think it should work the same way that:
$ TYPE NAMES.TXT /OUTPUT=NAMES.TXT !works

Hopefully the engineers will read this thread and fix this too (I have no software support so can't request it).
I have one, but it's personal.