Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!pasteur!ucbvax!hplabs!sdcrdcf!psivax!nrcvax!kvc
From: kvc@nrcvax.UUCP (Kevin Carosso)
Newsgroups: comp.os.vms
Subject: Re: CTL$GB_MSGMASK Process Message Mask (was CLI$DCL_PARSE...)
Message-ID: <1512@nrcvax.UUCP>
Date: 24 Jun 88 18:42:33 GMT
References: <8806151302.AA18495@mitre-bedford.ARPA>
Reply-To: kvc@minnie.UUCP (Kevin Carosso)
Organization: Network Research Corp.  Oxnard, CA
Lines: 43

In article <8806151302.AA18495@mitre-bedford.ARPA> mhg@MITRE-BEDFORD.ARPA (Mark H. Granoff) writes:
>Recently I posted a message about surpressing the error output from
>CLI$DCL_PARSE.  I mentioned that if a SET MESS/NOFAC/NO... command is
>issued before running the program, the error output does not display.
>
>I did get a response from Mike Marques; he suggested using
>LIB$ESTABLISH to set up a condition handler that does nothing.  A good
>idea in theory, but the manual recommends not using this service in
>high level languages (like BASIC) that already have condition handlers
>set up.  I am using BASIC (stop laughing), and being curious, I tried
>it out.  My results were something less than successful.  A condition
>handler is overkill for my application anyway.
>
>Thanks in advance for any help.

For something like the CLI$ routines which signal their errors rather
than returning a status, the conditional handler really is the only way
to go.  The caveat about using LIB$ESTABLISH from a high level language
such as BASIC only applies to *how* you set up the handler, not whether
you can have one.  In Pascal, BASIC, PL/I, or Ada you want to use the built-in
language facilities for establishing the handler and not call LIB$ESTABLISH
directly.  The handler you actually establish is no different in the
high-level language (well, Ada may be a little different).

In the case of the CLI$ routines, things are really easy since VMS provides
some conditional handlers for your use.  One of these, LIB$SIG_TO_RET,

"converts any signalled condition value to a value returned as a function.
 The signaled condition is returned to the caller of the user procedure
 that established the handler that is calling LIB$SIG_TO_RET.  This routine
 may be established as or called from a condition handler."

In Pascal you would need to declare the routine LIB$SIG_TO_RET as
[ASYNCHRONOUS, UNBOUND] and then simply use:

	Establish (LIB$SIG_TO_RET);

in any procedures that want to catch CLI$ signals and convert them
into return values.  BASIC will probably be very similar.

        /Kevin Carosso                     kvc@nrc.com
         Network Research Co.              kvc@ymir.bitnet
                                           kvc@nrcvax.uucp