- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - OpenVMS
- >
- Re: OpenVMS DCL Error Handling
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 09:29 PM
03-05-2006 09:29 PM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 09:55 PM
03-05-2006 09:55 PM
Re: OpenVMS DCL Error Handling
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 10:15 PM
03-05-2006 10:15 PM
Re: OpenVMS DCL Error Handling
$Abort:
$ stat=$status
$ reason=f$mes(status) + "(''status')"
$ @send "''reason'"
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 10:36 PM
03-05-2006 10:36 PM
Re: OpenVMS DCL Error Handling
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2006 11:40 PM
03-05-2006 11:40 PM
Re: OpenVMS DCL Error Handling
As someone new to VMS, it sounds like you are doing great. Welcome!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 12:50 AM
03-06-2006 12:50 AM
Re: OpenVMS DCL Error Handling
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 05:52 PM
03-06-2006 05:52 PM
Re: OpenVMS DCL Error Handling
Use dcl_check (freeware) to verify if the syntax is (probaly) correct. E.g. goto labels that don't exists are verified.
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 06:10 PM
03-06-2006 06:10 PM
Re: OpenVMS DCL Error Handling
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 08:22 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 09:17 PM
03-06-2006 09:17 PM
Re: OpenVMS DCL Error Handling
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2006 10:59 PM
03-06-2006 10:59 PM
Re: OpenVMS DCL Error Handling
Note that backup has another messages too : files gone during backup.
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 12:56 AM
03-07-2006 12:56 AM
Re: OpenVMS DCL Error Handling
Purely Personal Opinion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 06:30 PM
03-07-2006 06:30 PM
Re: OpenVMS DCL Error Handling
My send_trap.com script looks something like this:
$ percent = f$extract(0,1,p1)
$ if percent .nes. "%" then goto NO_SEV_CODE
$ sevcode = f$extract(f$locate("-",p1)+1,1,p1)
$ sevcode = f$edit(sevcode, "UPCASE")
$
$ if sevcode .eqs. "S" then goto S_SEV_CODE
$ if sevcode .eqs. "I" then goto I_SEV_CODE
$ if sevcode .eqs. "W" then goto W_SEV_CODE
$ if sevcode .eqs. "E" then goto E_SEV_CODE
$ if sevcode .eqs. "F" then goto F_SEV_CODE
$ goto NO_SEV_CODE
$
$S_SEV_CODE:
$ target = "SUCCESS_TRAP"
$ goto WRITE_MSG
$I_SEV_CODE:
$ target = "INFORMATIONAL_TRAP"
$ goto WRITE_MSG
$W_SEV_CODE:
$ target = "WARNING_TRAP"
$ goto WRITE_MSG
$E_SEV_CODE:
$ target = "ERROR_TRAP"
$ goto WRITE_MSG
$F_SEV_CODE:
$ target = "FATAL_TRAP"
$ goto WRITE_MSG
$NO_SEV_CODE:
$ target = "USER_TRAP"
$ goto WRITE_MSG
$
$WRITE_MSG:
$ open/write usr_trp_mbx 'target'
$ write usr_trp_mbx p1
$ close usr_trp_mbx
*****************************************
Now when I call this in my working scripts as follows:
$ SET VERIFY
$! SET NOON
$ ON ERROR THEN GOTO TRAP
$ (Do some work)
$ TRAP:
$ @send_trap.com "''F$MESSAGE($status)' : Msg source = ec_stm_image_copy_crb.com"
******************************************
If I write all of the output to a log file
and execute my working script I get the following result in the log:
$ SET VERIFY
$! SET NOON
$ ON ERROR THEN GOTO TRAP
$!
$!Do some work
$ copy dka500:[hcm01]*.* habs"arch"::dkc0:[hcm01]*.*
$!
$! Built in trap for error handling
$ TRAP:
$ @send_trap.com "%SYSTEM-S-NORMAL, normal successful completion"
$ percent = f$extract(0,1,p1)
$ if percent .nes. "%" then goto NO_SEV_CODE
$ sevcode = f$extract(f$locate("-",p1)+1,1,p1)
$ sevcode = f$edit(sevcode, "UPCASE")
$
$ if sevcode .eqs. "S" then goto S_SEV_CODE
$S_SEV_CODE:
$ target = "SUCCESS_TRAP"
$ goto WRITE_MSG
$WRITE_MSG:
$ open/write usr_trp_mbx SUCCESS_TRAP
%DCL-E-OPENOUT, error opening HABS"arch"::MBA140:[HCM01].DAT; as output
-RMS-F-DEV, error in device name or inappropriate device type for operation
$ TRAP:
$ @send_trap.com "%RMS-F-DEV, error in device name or inappropriate device type for operation"
$ percent = f$extract(0,1,p1)
$ if percent .nes. "%" then goto NO_SEV_CODE
$ sevcode = f$extract(f$locate("-",p1)+1,1,p1)
$ sevcode = f$edit(sevcode, "UPCASE")
$
$ if sevcode .eqs. "S" then goto S_SEV_CODE
$ if sevcode .eqs. "I" then goto I_SEV_CODE
$ if sevcode .eqs. "W" then goto W_SEV_CODE
$ if sevcode .eqs. "E" then goto E_SEV_CODE
$ if sevcode .eqs. "F" then goto F_SEV_CODE
$F_SEV_CODE:
$ target = "FATAL_TRAP"
$ goto WRITE_MSG
$WRITE_MSG:
$ open/write usr_trp_mbx FATAL_TRAP
%DCL-E-OPENOUT, error opening HABS"arch"::MBA144:[HCM01].DAT; as output
-RMS-F-DEV, error in device name or inappropriate device type for operation
****************************************
My question is why when the working script has no failures the SUCCESS trap is received by the SNMP manager, but when the script has errors as shown above, then the send_trap.com does not send these through to the SNMP manager?
If I paste the command (shown below) at the command prompt then the thing works.
@send_trap.com "%RMS-F-DEV, error in device name or inappropriate device type fo
r operation"
Regards
Graham
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 07:16 PM
03-07-2006 07:16 PM
Re: OpenVMS DCL Error Handling
A slightly modfied version... and a question
$ set verify
$ set noon
$ copy dka500:[hcm01]*.* habs"arch"::dkc0:[hcm01]*.*
$ copy_status = $status
$ call send_trap "''f$message(copy_status)'"
$ exitt 1
$
$send_trap: subroutine
$ ! SEND_TRAP.COM
$ the_message = P1
$ if (f$extract(0,1,the_message) .nes. "%") then goto no_sev_code
$ sevcode = f$element(1,"-",the_message)
$ sevcode = f$edit(sevcode, "UPCASE")
$ target = "USER_TRAP"
$ if sevcode .eqs. "S" then target = "SUCCESS_TRAP"
$ if sevcode .eqs. "I" then target = "INFORMATIONAL_TRAP"
$ if sevcode .eqs. "W" then target = "WARNING_TRAP"
$ if sevcode .eqs. "E" then target = "ERROR_TRAP"
$ if sevcode .eqs. "F" then target = "FATAL_TRAP"
$ open/write usr_trp_mbx 'target'
$!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$!!!!!!! what exactly are you expecting the above line to do?
$ write usr_trp_mbx "''the_message'"
$ close usr_trp_mbx
$ exitt 1
$ endsubroutine
tardis_FTA7> @a.a
$ set verify
$ set noon
$ copy dka500:[hcm01]*.* habs"arch"::dkc0:[hcm01]*.*
%COPY-E-OPENIN, error opening DKA500:[HCM01]*.*; as input
-RMS-F-DEV, error in device name or inappropriate device type for operation
$ copy_status = $status
$ call send_trap "%COPY-E-OPENIN, error opening !AS as input"
$send_trap: subroutine
$ ! SEND_TRAP.COM
$ the_message = P1
$ if (f$extract(0,1,the_message) .nes. "%") then goto no_sev_code
$ sevcode = f$element(1,"-",the_message)
$ sevcode = f$edit(sevcode, "UPCASE")
$ target = "USER_TRAP"
$ if sevcode .eqs. "S" then target = "SUCCESS_TRAP"
$ if sevcode .eqs. "I" then target = "INFORMATIONAL_TRAP"
$ if sevcode .eqs. "W" then target = "WARNING_TRAP"
$ if sevcode .eqs. "E" then target = "ERROR_TRAP"
$ if sevcode .eqs. "F" then target = "FATAL_TRAP"
$ open/write usr_trp_mbx ERROR_TRAP
$!^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
$!!!!!!! what exactly are you expecting the above line to do?
$ write usr_trp_mbx "%COPY-E-OPENIN, error opening !AS as input"
$ close usr_trp_mbx
$ exitt 1
$ exitt 1
tardis_FTA7> dire error*
Directory DBS0:[SCRATCH]
ERROR_TRAP.DAT;5 1/18 8-MAR-2006 08:14:21.20
Total of 1 file, 1/18 blocks.
tardis_FTA7> type error_trap.dat
%COPY-E-OPENIN, error opening !AS as input
tardis_FTA7>
Dave
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2006 07:37 PM
03-07-2006 07:37 PM
Re: OpenVMS DCL Error Handling
2. You didn't do a on error after the error that caused the 2nd trap.
Wim
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-15-2006 06:56 AM
03-15-2006 06:56 AM
Re: OpenVMS DCL Error Handling
In your script, when you try to open SUCCESS_TRAP, the error message tries to explain what is the problem:
"... error opening HABS"arch"::MBA140:[HCM01].DAT; ... "
Try inserting a line
$ SHOW LOGICAL SUCCESS_TRAP
just before your COPY, and you will see that the logical name SUCCESS_TRAP does exist, and has the value
HABS"arch"::MBA140:
Now, this is the specification of a mailbox device on a remote (DECnet) node...
If you try to open a file with an incomplete specification ( = device:[directory]name.extension;version ), then the file parser supplies any missing elements from the processes' current default.
And since a mailbox is not file structured, such devices do not have a dir spec.
Incluse a
$ SHOW DEFAULT
as well, and you will get [HCM01], try it!
No name is given, defaulting to empty string, and the file type defaults to .DAT
Version for OPEN/WRITE is ";", meaning the next higher or ;1 if not yet present.
And now, we are back to the mailbox not being file structured, leading to
"error in device name or inappropriate device type for operation"
...
Obviously this code is executed form a remote DECnet node.
There ARE ways to get your message written to the network mailbox, but we need some more info on the specifics of the connection to give you a working solution.
hth,
Proost.
Have one on me.
jpe