Operating System - OpenVMS

how to DCL custom exit?

Go to solution
Hein van den Heuvel
Honored Contributor

Re: how to DCL custom exit?

Thanks Bob,

I used a specific logical name table in order not to clutter my name space.

Cleanup is easy also, but maybe hard to find at first: $DEAS/TABLE=symbol/ALL

For interested readers that did not yet 'see' what I did here...

The SSDEF module and others in STARLET look like:
Those first 3 lines are strictly for the Macro compiler and DCL does not like them.

But the rest, whilest actually being invocation of MACRO called "$EQU", look like fine DCL statements, if EQU was a command. The $EQU macro in macro translates to:
symbol = value
symbol == value
depending on the argument used for $SSDEF [GLOBAL|LOCAL|]

So I defined EQU in DCL as DEFINE and voila!

Robert Gezelter
Honored Contributor

Re: how to DCL custom exit?


Actually, I was thinking of something a little more sparing of long term system resources.

As I said, I will put something together shortly that is easily usable by everyone.

- Bob Gezelter, http://www.rlgsc.com
Dean McGorrill
Valued Contributor

Re: how to DCL custom exit?

Hein, if this were my post, i'd give you 10's for that one! cute and useful Dean!
Hein van den Heuvel
Honored Contributor

Re: how to DCL custom exit?

On a roll here....

$ @symbol $SSDEF *acl*

SS$_ACLEMPTY = 2512 Hex = 000009D0 Octal = 00000004720
SS$_ACLFULL = 2552 Hex = 000009F8 Octal = 00000004770
SS$_BADACL = 3642 Hex = 00000E3A Octal = 00000007072
SS$_BADACLCTX = 8652 Hex = 000021CC Octal = 00000020714
SS$_IVACL = 8676 Hex = 000021E4 Octal = 00000020744
SS$_NOACLSUPPORT = 8892 Hex = 000022BC Octal = 00000021274

------- 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.

Honored Contributor

Re: how to DCL custom exit?

Install the SDL kit off the OpenVMS Freeware V8.0 distro (VAX, Alpha and I64), or install a later version of SDL as available.

Invoke the following incantation...


SDL will extract the constant values -- and as DCL doesn't "do" data structures, much of what resides within the SDL Intermediate (SDI) file won't be propagated through -- and establish the DCL constants in an easy-to-include DCL command procedure.

Do use some caution here, as you might blow out and/or need to increase your DCL symbol table size if you are profligate with these "include files"...

Stephen Hoffman
HoffmanLabs LLC
Honored Contributor

Re: how to DCL custom exit?



The filename on the SDL /NOPARSE was added.

BTW, SDL /NOPARSE starts with and processes the .SDI (intermediate) files. SDL /PARSE starts with and processes .SDL (source) files.
Claus Olesen

Re: how to DCL custom exit?

Thank you for all the replies.

There is a lot of material in your replies to digest and choose from. I'm also looking forward to what Robert will put together.

The below is where I'm leaving what I started in the meantime. It works here but suffers from clutter most of which can be avoided by doing the lookup using DCL as you suggest as well as passing the cc value by DCL symbol as you also suggest.

The print bit in the cc is the reason for the rest of the clutter. I noticed from executing abc that the value of the print bit in the cc is sensitive to the way of exit. If the exit is by way of using dcl's exit i.e. "controlled" i.e. "on demand" (I suppose) then the print bit does not get set i.e. the cc does not get changed and/but a message is printed if error - as opposed to when DCL catches an exiting executable. so - to avoid "changing cc's" then always exit only by use of dcl's exit?

I looked for a callable (RTL) function to access *.TLB,*.MLB,*.OLB,*.HLB,...? Are there any?

$! abc.com
$ emit:=$srv$exe:emit
$! get condition codes to test for later - siliently and without dying
$! msgflags = f$environment("MESSAGE")
$! set mess/nofac/nosev/noid/notext
$ set noon
$ status=$status
$ write sys$output "abc.1 ''status'"
$ cc1=f$integer(status)
$ status=$status
$ write sys$output "abc.2 ''status'"
$ cc2=f$integer(status)
$ set on
$! set message 'msgflags'
$! execute some procedure also without dying
$ set noon
$ @xyz
$ status=$status
$ write sys$output "abc.3 ''status'"
$ status=status.and.%xfffffff
$ set on
$! now test the procedures exit status symbolically - the purpose of all of this
$ if status .eq. cc1
$ then
$ write sys$output "abc.4 cc1"
$ else if status .eq. cc2
$ then
$ write sys$output "abc.5 cc2"
$ endif
$! xyz.com
$! cc print bit does not get set if error handling is disabled
$ set noon
$! mcr srv$exe:emit SRV$_BADPARAM
$ mcr srv$exe:emit SRV$_DEADLOCK
$! emit:=$srv$exe:emit
$ status=$status
$ write sys$output "xyz.1 ''status'"
$ exit status
/* emit.c */
/* usage example: mcr srv$exe:emit SRV$_NORMAL */
int main(int argc,char *argv[])
int unsigned SymVal;
char FileName[80+1];
$DESCRIPTOR (dFileName,FileName);
$DESCRIPTOR (dSymName,"");

/* compose (system logical) name of our shareable */


/* lookup symbol value */

return SymVal;

/* alternatively set symbol - this requires a CLI */
Hein van den Heuvel
Honored Contributor

Re: how to DCL custom exit?

>>> I looked for a callable (RTL) function to access *.TLB,*.MLB,*.OLB,*.HLB,...? Are there any?

Util routine manual...
Librarian (LBR) Routines


But, I dunno Claus... you lost me, and possibly you lost 'it'.

This smacks of overengineering to an extreme.

Just hardcode those defintions in the top of the script.

If you have more than say 5, then make yourself a command file to execute to defined the list of selected symbols.

LIB$FIND_IMAGE_SYMBOL is NOT a light system service. It opens file(s), reads, create memory sections, allocates VM calls LIB$INSERT_tree, for future lookups (which will nto happen in your case) and so on!

Just have DCL read that text file already! KISS!

Best of luck,

Honored Contributor

Re: how to DCL custom exit?

Over-engineering further, you can use libext to grab the whole contents of STARLETSD.TLB, and extract it all out and process it. libext is a component of the innards of an old C compiler installation environment -- this tool and some other DCL was used to create the C reference directories. libext is available on Freeware V7.0. It might also serve as an example of calling the LBR routines within the Librarian; see the utility routines reference manual for that detail.
Claus Olesen

Re: how to DCL custom exit?

Just to summaries - what I had in mind is
- handling of condition codes symbolically in DCL
- automatic mask out of the control bits in the cc to eliminate comparison mismatches because of the control bits
- a library of messages dedicated to general use to avoid having to borrow codes from other facilities such as SS for use with for example RSH which doesn't return a code. Because if I receive an SS code then I should be able to rely on it originating from the "system" and not some other place out there like my DCL or my program.
Again, thank you for listening.