Operating System - OpenVMS
1752587 Members
4025 Online
108788 Solutions
New Discussion юеВ

Re: OpenVMS DCL Error Handling

 
SOLVED
Go to solution
Graham Van der vaart_1
Super Advisor

OpenVMS DCL Error Handling

Hi
I'm "very" new to OpenVMS. I have a number od DCL scripts that do backups and copies etc. We also employ an SNMP based agent that provides a user trap facility based on a command procedure. All I need to pass this procedure is a single parameter. eg.
$ @send_severity_trap "%SYSTEM-F-NOLOGNAM, no logical name match".
This prcedure tests for the severity and then writes to a mailbox.
My question is simply, what is the simplest way to implement this? At the top of my script should I set error handling at a specific desired minimum severity eg. ON ERROR THEN GOTO ERR1
Then at ERR1: what should I pass to the procedure send_severity_trap.com?
Regards
Graham
15 REPLIES 15
Robert Gezelter
Honored Contributor

Re: OpenVMS DCL Error Handling

Graham,

You can use ON ERROR (and its related commands, ON WARNING, ON SEVERE_ERROR) to trap these conditions.

However, it may not be optimal. The problem is that DCL does not report WHERE or WHAT generated the error. For reporting that a problem occurred, it may be adequate. For troubleshooting, the results are limited.

This also presumes that your script does not invoke other scripts.

- Bob Gezelter, http://www.rlgsc.com
Wim Van den Wyngaert
Honored Contributor

Re: OpenVMS DCL Error Handling

Place your error routine in the beginning of the dcl script. Otherwise a missing " in the script will cause DCL to not find the routine.

$Abort:
$ stat=$status
$ reason=f$mes(status) + "(''status')"
$ @send "''reason'"


Wim
Wim
Wim Van den Wyngaert
Honored Contributor

Re: OpenVMS DCL Error Handling

Also :

The on error is reset when it is executed (reset means back to on error then exit".

Subroutines and files executed via @ also require "on error" or will have the default.

If set noon is used, make sure set on is done again in all cases. Otherwise the error will be ignored.

In big scripts, I regularly set the symbol "place" to a value and display it in the abort routine. Makes it easier to debug.

Wim
Wim
comarow
Trusted Contributor

Re: OpenVMS DCL Error Handling

Since you are new to VMS, as a more general answer, try to get the book, "Writing Real Programs in DCL". It will includes examples of error handling, as well as many other examples and techniques you will likely need.

As someone new to VMS, it sounds like you are doing great. Welcome!
Ian Miller.
Honored Contributor

Re: OpenVMS DCL Error Handling

Lots of dcl examples can be found at dcl.openvms.org

Details on the book are at
http://www.amazon.com/exec/obidos/external-search?search-type=ss&tag=tru64org&keyword=DCL&index=books

See also DCL Dialogue Online
http://www.kgb.com/dcl.html

____________________
Purely Personal Opinion
Wim Van den Wyngaert
Honored Contributor

Re: OpenVMS DCL Error Handling

Also bis :

Use dcl_check (freeware) to verify if the syntax is (probaly) correct. E.g. goto labels that don't exists are verified.

Wim
Wim
Graham Van der vaart_1
Super Advisor

Re: OpenVMS DCL Error Handling

Thanks for the help so far.
I seem to have something working. The majority of scripts are returning fine ...
(Successful. %SYSTEM-S-NORMAL, normal successful completion ). These scripts usually only do copies etc. The client wants this -S- severity reported since NNM must show green in the "VMS Jobs" alarm category unless there is a failed or problematic job.
However when an Oracle hotbackup script runs it returns the following:
(Warning. %BACKUP-W-NOMSG, Message number 10A38410 ) My question is, how do I now interpret the Message Number?
My call is as follows:
@send_severity_trap.com "''F$MESSAGE($status)' : Msg source = ec_db_hotbkup_pm.com"
Regards
Graham
Robert Atkinson
Respected Contributor
Solution

Re: OpenVMS DCL Error Handling

Graham,
messages for BACKUP are stored in a different file, SYSMGTMSG.EXE :-

ALPHA_ROB$ SET MESSAGE SYS$MESSAGE:SYSMGTMSG.EXE
ALPHA_ROB$ ws f$mess("%X10A38410")
%BACKUP-W-ACCONFLICT, !AS is open for write by another user

Rob.

Graham Van der vaart_1
Super Advisor

Re: OpenVMS DCL Error Handling

Thanks Rob
Yes, I would have expected that message since when Oracle is in hotbackup mode the files will be available to other users for writing.
Regards
Graham