3

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
user1943219
  • 396
  • 2
  • 5
  • 19
  • Your `Define` command, Is it inside your script or you entered it on the DCL prompt? – Saju Feb 13 '13 at 16:18
  • It's inside the script, it looked like i continued to use the error.log until i did a logoff and log on again – user1943219 Feb 13 '13 at 16:34
  • 2
    Have you tried `set message/nofacility/noseverity/noidentification/notext`? If that works for you then you can use `f$environment("message")` to get the current settings so they can be restored before exiting. – HABO Feb 13 '13 at 17:05
  • Set message worked better then the define sys$error thank you! – user1943219 Feb 13 '13 at 17:54
  • Thanks from me too! I used the 'set message' syntax and it works fine! My application of if is, I wanted to suppress warning message about files not found during a renaming operation, if they were Not found. – Learner74 Jun 11 '13 at 13:12

3 Answers3

7

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

Hein
  • 1,453
  • 8
  • 8
1

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

Saju
  • 3,201
  • 2
  • 23
  • 28
0

This works interactively and in batch.

$ SET MESSAGE /NOTEXT /NOSEV /NOFAC /NOID
$ <DCL_Command>
$ SET MESSAGE /TEXT /SEV /FAC/ ID
JohnH
  • 1,920
  • 4
  • 25
  • 32