From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f7344,d12c737003eaeb1 X-Google-Attributes: gidf7344,public X-Google-Thread: 1164f8,d12c737003eaeb1 X-Google-Attributes: gid1164f8,public From: hoffman@xdelta.enet.dec.com (Stephen Hoffman) Subject: Re: Successful and not successful completion Date: 1995/08/14 Message-ID: <40ns2i$aok@nntpd.lkg.dec.com>#1/1 X-Deja-AN: 108138288 distribution: world references: <1995Aug9.192334.1@sldb5.slac.stanford.edu> <40c5ab$er4@caip.rutgers.edu> organization: Digital Equipment Corp reply-to: hoffman@xdelta.enet.dec.com (Stephen Hoffman) newsgroups: comp.os.vms,comp.sys.dec In article <40c5ab$er4@caip.rutgers.edu>, halasz@caip.rutgers.edu writes: :In article <1995Aug9.192334.1@sldb5.slac.stanford.edu>, :fairfield@sldb5.slac.stanford.edu writes :> .... :> ... I suggest you study :> up on VMS _condition values_. A good reference would be the OpenVMS :> Calling Standard, Chapter 6 (in the V6.1 doc set) which discusses : :Why is it a good idea that there is this message, : %SYSTEM-x-NORMAL, normal successful completion :which is not meaningful unless x is "S"? :Why is it a good idea that there is this message, : %SYSTEM-x-ABORT, abort :which is not meaningful unless x is "E" or "F"? :For file not found, even "S" can be useful. No, :it would hav been better if there were one message, : %SYSTEM-x-COMPLETION, completion There is a simple test for successful completion, simply test the low bit of the condition value. (Condition handling is itself a major topic in the OpenVMS Programming Manual; using the OpenVMS support, one can easily implement centralized condition handlers and signals under OpenVMS, and one can also easily implement a condition handling model with more endemic one-per-operation handlers.) If using C, the basic test looks like this: #include RetStat = Mumble(); if ( !$VMS_STATUS_SUCCESS( RetStat )) return RetStat; If using VAX macro, the test looks like this: calls #0,g^Mumble blbc r0,error If the low bit is set, the operation succeeded. There was a deliberate design choice made in OpenVMS to provide this -- the OpenVMS operating system provides multiple success codes, and multiple failure codes of various severities, and provides an easy way to perform a blanket "it worked" or "it failed" test. I've worked with various applications written for other operating systems, and I've worked on other operating systems, and I've often found the error reporting in these situations to be rather inconsistent -- sometimes zero is success and non-zero is failure, sometimes it's reversed. When zero is a failure code, one occasionally has to resort to dependence on a non-reentrant data cell (C routines use errno here) to determine the reason for the failure. One then needs errno for each thread (or AST) of execution, where the OpenVMS model is rather easier to deal with. The OpenVMS scheme certainly appears more baroque when compared with other schemes and it can certainly be misused by folks testing for one particular explicit success (or failure) code, but the scheme is what makes generic recovery routines possible -- one does not need to code each possible status code, yet one can also easily choose to special-case a particular set of status codes, status codes from a particular facility, or status codes of a particular severity level. ------------------------------ Opinionative ------------------------------- Stephen Hoffman OpenVMS Engineering hoffman@xdelta.enet.dec.com ---------------------------------------------------------------------------