Operating System - OpenVMS

how to DCL custom exit?

Go to solution
Robert Gezelter
Honored Contributor

Re: how to DCL custom exit?


As a demonstration of how one aspect of this can be accomplished (e.g., being able to do something along the lines of:


I made available a simple command procedure that compiles a logical name table from the contents of the list of system error codes ($SSDEF in SYS$LIBRARY:STARLET.MLB) and a symbol definition for EXITSTATUS that uses this logical name table to convert from the symbolic name to the actual numeric value.

While I have not yet done so, it is straightforward to extend this to extend this with new codes and facility codes (to allow the use of the message facility).

This procedure is designed to be usable either by individual users within their processes, or it can be set up on a more global basis by system managers.

The ZIP archive of this example can be found at: http://www.rlgsc.com/demonstrations/exitstatus.html

- Bob Gezelter, http://www.rlgsc.com
Richard W Hunt
Valued Contributor

Re: how to DCL custom exit?

Just to take this in a different direction, I create a .MAR file that includes things like $SSDEF and $QIODEF and any other thing for which I need definitions. Assemble it with /LIST option.

When I want the condition codes, I run a little simple-minded parser that reads the listing with the right prefix (SS$_ for example) and picks out the values for me, then reformats it to something useful.

Like, for DCL it creates strings of

$ SS$_xxxx = %X{whatever I got from the file}

whereas for BASIC it does something else and for ADA it does still a third thing, in each case usable as an INCLUDE or syntax equivalent that is compatible with my language-du-jour.

Then the hardest issue becomes finding a message that tells me what I wanted to say from the list of messages available this way.

Sr. Systems Janitor
Hein van den Heuvel
Honored Contributor

Re: how to DCL custom exit?


Why go through a list file and parse all that!
With a little less work, Macro can do it all:

For yucks run the commandfile below as:

$ @status_to_symbol.com $ssdef *priv*

---- status_to_symbol.com ------

$IF p2.EQS."" THEN EXIT 16
$CREATE tmp.mar
$ copy sys$input nl:
.MACRO $DEFINI dummy arg more_dummy
.MACRO $DEFEND dummy arg more_dummy
$ show symb arg
.MACRO $EQU nam num
$ nam = num
$OPEN/APPEND tmp tmp.mar
$WRITE tmp "''p1' ''p2'"
$CLOSE tmp
$MACRO/ALPH/PREP=tmp.com tmp.mar
$!DELE tmp.mar.,tmp.com.

A minor change will drop the 'search-for' argument and create global symbols.

And below here is a version which plunks the defintions into a logical name table
It also has some comments to the above to make it less cryptic. [ a few weeks ago I thought the few commands I write above simple enough, but coming back to them, they had me puzzled! ]

------------------- STATUS_TO_TABLE -----

$! STATUS_TO_TABLE.COM, hein van den Heuvel, Feb 2008
$! Define macro module symbols as logical names, using macro pre-processor
$IF p1.EQS."" THEN EXIT 16 ! Need Macro module name to explode
$temp_macro_source = "TMP.MAR"
$temp_dcl_source = "TMP.COM"
$CREATE 'temp_macro_source ! Has replacements for $DEFINI and $DEFEND.
$ copy sys$input nl: ! Eat bonus lines from macro compiler
.MACRO $DEFINI dummy arg more_dummy
.MACRO $DEFEND dummy arg more_dummy
$! show log/table=lnm_exit_status arg ! optional for inline show and forget
$ delete 'f$environment("procedure")',arg
$ copy sys$input nl: ! Eat blank bonus lines, avoiding %DCL-W-SKPDAT
.MACRO $EQU nam num
$define/tabl=lnm_exit_status nam num
$temp_macro_source_full_spec = f$search(temp_macro_source)
$! Macro will strip ";". Replace by "."
$!temp_macro_source_full_spec = f$elem(0,";"tmp) + "." + f$elem(1,";"tmp)
$temp_macro_source_full_spec[F$LOC(";",temp_macro_source_full_spec),1] := "."
$!Append actual macro activation line to temporary macro source file.
$OPEN/APPEND tmp 'temp_macro_source
$WRITE tmp "''p1' ''temp_macro_source_full_spec'"
$CLOSE tmp
$MACRO/ALPH/PREP='temp_dcl_source 'temp_macro_source_full_spec