Operating System - OpenVMS
1752758 Members
4826 Online
108789 Solutions
New Discussion юеВ

Re: $SEVERITY one more time ...

 
SOLVED
Go to solution
Art Wiens
Respected Contributor

$SEVERITY one more time ...

Why doesn't my command procedure work "as expected"? I have attached the pertinent bits from the command procedure and the resulting log. $SEVERITY is supposed to be the last three bits of $STATUS and $STATUS is %X10A38410 ie. the last message logged is a -W-ACCONFLICT so $SEVERITY should be 0.

Clearly I must have a DCL issue , but I can't see it and DCL_CHECK.COM thinks it's ok too.

It's been a rough week. Two more hours 'till beverage time!!

Cheers,
Art
10 REPLIES 10
Art Wiens
Respected Contributor

Re: $SEVERITY one more time ...

It's VAX/VMS v6.2 .
Jan van den Ende
Honored Contributor

Re: $SEVERITY one more time ...

Art,


$ backup_status = $STATUS
$ backup_severity = $SEVERITY


I would think backup_severity will receive the severity of the
" $ backup_status = $status " assignment...
and, barring DCL table overflow, this will return Success, as the asssignment will only fail if $satus is undefined OR DCL table overflows.

Replace the severity asignment by:

$ backup_severity = backup_status .and. %X7

will do the trick.

hth

Proost.

Have one on me.

jpe
Don't rust yours pelled jacker to fine doll missed aches.
Art Wiens
Respected Contributor

Re: $SEVERITY one more time ...

I thought about that, but then why does it take the "if not then" path? And if that's the case, why didn't it fire the OK mail message?

Cheers,
Art
David Jones_21
Trusted Contributor

Re: $SEVERITY one more time ...

I haven't used 6.2 in a long time, perhaps it gets confused about the data type of $severity and makes backup_severity a string instead of an integer, in which case the .eq. tests do strange things. Try changing the assignement to backup_severity = f$integer($severity).
I'm looking for marbles all day long.
Doug Phillips
Trusted Contributor

Re: $SEVERITY one more time ...

Art,

Jan is right. Now, in answer to your last question:

$status & $severity are set upon backup completion and only tell you whether or not backup finished normally or failed to complete.

Your -W- messages didn't cause backup to exit abnormally, so the backup succeeded.

To see why you didn't get any mail, try this:

$ backup_status = %X10A38410
$ backup_severity = $SEVERITY
$!
$ if .NOT. %X10A38410
$ then
$ write sys$output -
"NOT and $severity=" + backup_severity
$ else
$ write sys$output "OK"
$ endif


Art Wiens
Respected Contributor

Re: $SEVERITY one more time ...

Clearly I was thinking about beverages instead of DCL when I answered Jan ... backup_status got me there, backup_severity was "corrupt" when I got there.

I understand now ... after a few bev's ;-)

Cheers x8,
Art
Hein van den Heuvel
Honored Contributor
Solution

Re: $SEVERITY one more time ...

The procedure shown is severely broken as fatal backup failures do not sent out mail.

The fact that a simple assignment sets a new $status in DCL is a bit puzzling. It would require a rather creative dcl procedure to exploit that, whereas it would clearly be useful, and possibly natural, to retain status over this trivial built-in.
This very topic shows this.
The trouble comes perhaps with complex assignment like a dynamic array: $x = x'y
Or when using a lexical $x = f$lexical...
Still...

Some comments:

1) I'm with David on the text/integer concern. When assigning $STATUS you may want to use a substitition and get it in integer form: $x = '$status
I personally don't like using constructs like: $if string .eq. 1
It does the right thing, but raises unneeded doubts (as proven by Davids reply).
Plus, the substitution helps with verification mode (batch logs)

2) The test_status section tests for two explicit non-success values, but does not handle the 3rd possible value: 4 = fatal
(for example after $BACKUP nonsense: xxx)

So I would prefer to just test for warning else error (or fatal):
$ if backup_severity .EQ. 0 ! Warning
$ then
:
$ else
:
$ endif

3) Instead of 3 repeated nearly identical 'complex' commands which is hard to maintain consider something like this (untested)

$text_status = f$element (backup_severity,"|","with Warnings|OK|with Errors|OKish|with FATAL Error")
$maill /subj="''nodename' backup completed ''text_status' ''target_device_name'" nl: "smtp%""awiens@domain.com"""

Cheers,
Hein.


Art Wiens
Respected Contributor

Re: $SEVERITY one more time ...

"The procedure shown is severely broken as fatal backup failures do not sent out mail."

No it's not, I didn't include it, but there is an on severe_error up top to catch all the "bad things".

The rest of your suggestions are very good! I'll change up the procedure to incorporate all the suggested changes.

Thanks guys!

Art
Hein van den Heuvel
Honored Contributor

Re: $SEVERITY one more time ...

Ok, fair enough. That part of script was not shown in the include file.

And, fwiw, I do believe it would merrit a comment in the 'test_status' section mentioning 'can not get here with sev=4: fatal errors'.

Cheers,
Hein.