Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Which $STATUS would be returned ?

 
SOLVED
Go to solution
The Brit
Honored Contributor

Which $STATUS would be returned ?

I had a fatal error occur during a batch backup job,

%BACKUP-E-FATALERR, fatal error on $2$MGA1:[]ND10.BCK;
-SYSTEM-F-PARITY, parity error

I want to trap this and similar errors using the "ON SEVERE_ERR0R" condition.

My question is: Will this situation be caught by SEVERE_ERROR condition ($severity = 4), or will the returned status be for the ERROR ($severity = 2)?

Thanks

Dave.
10 REPLIES 10
Willem Grooters
Honored Contributor

Re: Which $STATUS would be returned ?

Yes. ON ERROR ($severity = 2) will trap any error condition on, or above value 2, provided bit 0 is clear (causing informationals ($severity = 3) to pass)

From HELP ON:

If you specified an error condition as the condition parameter,
the action is taken when errors equal to or greater than the
specified level of error occur.

Willem
Willem Grooters
OpenVMS Developer & System Manager
The Brit
Honored Contributor

Re: Which $STATUS would be returned ?

Note:

I don't necessarily want to be notified just because an ERROR condition occurred.
I am only interested in whether a SEVERE_ERROR occurred.

Dave
Willem Grooters
Honored Contributor

Re: Which $STATUS would be returned ?

Too fast...
$STATUS will be "%BACKUP-E-FATALERR", $severity will be 2 and therefore, you wont be able to trap this one with ON SEVERE_ERROR.

On the other hand: Trapping it with ON ERROR, save $STATUS (because it will change with every statement), and check whether bit 3 is set: $ IF(STATUS .AND. 4) THEN...
would do the trick.
Willem Grooters
OpenVMS Developer & System Manager
Hein van den Heuvel
Honored Contributor

Re: Which $STATUS would be returned ?

Dave,

You are asking about what threshold level to pick right? You are not under the impression that you can do "on error this; on severe that" no?

There recently was an interesting spinoff discussion in a comp.os.vms thread about: "file locked by another user" mystery

Check it out...

http://groups.google.com/group/comp.os.vms/search?group=comp.os.vms&q=%22on+error%22+mystery&qt_g=Search+this+group

fyi... It brought up the old chestnut:
$ RESET := ON ERROR THEN RESET

Cheers,
Hein.
The Brit
Honored Contributor

Re: Which $STATUS would be returned ?

Hein,
you are correct, I am trying to figure out what level of error I need to trap this problem so I can deal with it appropriately.

Willem,
I cant quite figure out what you are describing with the (STATUS .AND. 4) check.

Here is something I am playing with,

Consider;

$ TYPE ASDF:[ASDF]ASDF
%TYPE-W-SEARCHFAIL, error searching for ASDF:[ASDF]ASDF.LIS;
-RMS-F-DEV, error in device name or inappropriate device type for operation
$ show symb $severity
$SEVERITY == "0"

and

$ edit ASDF:[ASDF]ASDF
%EDT-F-OPENIN, error opening ASDF:[ASDF]ASDF.; as input
-RMS-F-DEV, error in device name or inappropriate device type for operation
$ show symb $severity
$SEVERITY == "4"

I was playing with this scripting idea, vis.

$ Set Verify
$ On WARNING then Gosub ERROR_CHECK
$ TYPE ASDF:[ASDF]ASDF
$ Edit ASDF:[ASDF]ASDF
$ Set NoVerify
$ Exit
$!
$ ERROR_CHECK: ! Sub-routine
$ Stat = $Status
$ Write sys$output Stat
$ write sys$output f$message(Stat)
$ On ERROR then Gosub ERROR_CHECK
$ Return

When this runs,

@gosub_test
$ On WARNING then Gosub ERROR_CHECK
$ TYPE ASDF:[ASDF]ASDF
%TYPE-W-SEARCHFAIL, error searching for ASDF:[ASDF]ASDF.LIS;
-RMS-F-DEV, error in device name or inappropriate device type for operation
$ ERROR_CHECK: ! Sub-routine
$ Stat = $Status
$ Write sys$output Stat
%X10951238
$ write sys$output f$message(Stat)
%TYPE-W-SEARCHFAIL, error searching for !AS
$ On ERROR then Gosub ERROR_CHECK
$ Return
$ Edit ASDF:[ASDF]ASDF
%EDT-F-OPENIN, error opening ASDF:[ASDF]ASDF.; as input
-RMS-F-DEV, error in device name or inappropriate device type for operation
$ ERROR_CHECK: ! Sub-routine
$ Stat = $Status
$ Write sys$output Stat
%X1085109C
$ write sys$output f$message(Stat)
%EDT-F-OPENIN, error opening !AS as input
$ On ERROR then Gosub ERROR_CHECK
$ Return
$ Set NoVerify

The only danger that I see is if an warning or higher occurs actually in the subroutine. However the problem is that it only reports the first (lesser) warning/error.

Is there any way to get to the accompanying message, i.e.

-RMS-F-DEV, error in device name or inappropriate device type for operation

Dave.