Question

I have a test script I'm running that generates some errors,shown below, I expect these errors. Is there anyway I can prevent them from showing on the screen however? I use the

$ write sys$output

to display if there is an expected error.

I tried to use

$ DEFINE SYS$ERROR ERROR.LOG

but this then changed my entire error output log to this, if this is the correct way to handle it can I unset this at the end of my script somehow?

[error example]

%DCL-E-OPENIN, error opening TEST$DISK:[AAA]NOTTHERE.TXT; as input
-RMS-E-FNF, file not found
%DCL-E-OPENIN, error opening TEST$DISK:[AAA]NOTTHERE.TXT; as input
-RMS-E-FNF, file not found
%DCL-W-UNDFIL, file has not been opened by DCL - check logical name
Was it helpful?

Solution 2

To suppress Error message inside a script. try this command

 $ DEFINE/USER SYS$ERROR NL:

NL: is a null device, so you don`t see any error messages displayed on your terminal.

good luck

OTHER TIPS

DEFINE/USER creates a logical name that disappears when the next image exits. So if you use that just before a command just to protect that command, then fine. Otherwise I would prefer SET MESSAGE to control the output.

And of course yoy want to grab $STATUS and verify it after the command for success or for the expected error, reporting any unexpected error.

Better still... if you expect certain error conditions to occur, then why not test for them? For example:

$ file = F$SEARCH("TEST$DISK:[AAA]NOTTHERE.TXT")
$ IF file.NES."" THEN TYPE 'file'

Cheers, Hein

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top