The OpenNET Project / Index page

[ новости /+++ | форум | wiki | теги | ]

Поиск:  Каталог документации | DEC

OpenVMS Frequently Asked Questions (FAQ), Part 3/5

This posting contains answers to frequently asked questions about the OpenVMS operating system from Compaq Computer Corporation, and the computer systems on which it runs.
Archive-name: dec-faq/vms/part3
Posting-Frequency: quarterly
Last-modified: 2 Oct 2001
Version: VMS-FAQ-3.TXT(7)

This is the OpenVMS Frequently Asked Questions Part 3/5. 
Please see Part 1/5 for administrivia, indexing, archiving, etc.

MGMT60. Changing the OpenVMS Version Number?

  Fool your friends, baffle your enemies, run the OpenVMS version of
  your choice!

  OpenVMS Alpha:
    REPLACE V9.9
    $ EXIT

  OpenVMS VAX:
    $ set default SYS$COMMON:[SYS$LDR]
    $ patch SYS.EXE
    define sys$gq_version=800044b8
    set mode ascii
    !examine sys$gq_version
    !examine sys$gq_version+4
    deposit sys$gq_version   = "V9.9"
    deposit sys$gq_version+4 = "    "
    $ Exit

  Then reboot the system at your leisure.

MGMT61. Explain disk (or tape) allocation class settings?

  The allocation class mechanism provides the system manager with a way 
  to configure and resolve served and direct paths to storage devices 
  within a cluster.  Any served device that provides multiple paths 
  should be configured using a non-zero allocation class, either at the 
  MSCP (or TMSCP) storage controllers, at the port (for port allocation
  classes), or at the OpenVMS MSCP (or TMSCP) server.  All controllers
  or servers providing a path to the same device should have the same
  allocation class (at the port, controller, or server level).

  Each disk (or tape) unit number used within a non-zero disk (or tape) 
  allocation class must be unique, regardless of the particular device 
  prefix.  For the purposes of multi-path device path determination, any 
  disk (or tape) device with the same unit number and the same disk (or
  tape) allocation class configuration is assumed to be the same device.

  If you are reconfiguring disk device allocation classes, you will want 
  to avoid the use of allocation class one ($1$) until/unless you have 
  Fibre Channel storage configured.  (Fibre Channel storage specifically 
  requires the use of allocation class $1$.  eg: $1$DGA0:.)

MGMT62. How to prevent users from choosing obvious passwords?

  To prevent users from selecting obvious passwords on OpenVMS, you
  will want to use the reserved password (password screening) mechanism.
  Effectively, you merge your list of reserved passwords into the
  existing reserved words database maintained by OpenVMS.  (You can
  also then require all users to reset their passwords -- via the
  pre-expired password mechanism -- thus forcing users to select new
  passwords.)  For details on the password screening mechanism, of the
  reserved password database (VMS$PASSWORD_DICTIONARY.DATA), and details
  of how to merge your list of prohibited passwords into the database,
  please see the associated chapter in the OpenVMS security manual.
  For details of the password expiration mechanism, see the AUTHORIZE
  command qualifier /PWDEXPIRED.

  You can also implement a site-specific password filter with the
  information provided in the back of the OpenVMS Programming Concepts
  manual.  The password filter permits you to establish particular
  and site-specific password requirements.  For details, please see
  the system parameter LOAD_PWD_POLICY and the programming concepts
  manual, and see the examples in SYS$EXAMPLES:.  (Examples and
  documentation on V7.3 and later reflect both platforms, the examples
  are found only on OpenVMS VAX kits on earlier releases.  The
  capabilities have existed on both the VAX and Alpha platforms for
  some time now.)

  To verify current passwords, you can also use a technique known to
  system crackers as the "dictionary attack" -- the mechanism that makes
  this attack somewhat more difficult on OpenVMS is the hashing scheme
  used on OpenVMS, and the file protections used for the SYSUAF
  authorization database.  Given a dictionary of words and the
  unprotected contents of the SYSUAF file, a search for obvious
  passwords can be performed.  Interestingly, a "dictionary attack"
  also has the unfortunate side-effect of exposing the password to
  the user -- while this is clearly the goal of a system cracker,
  authorized privileged and non-privileged system users should not
  know nor have access to the (cleartext) passwords of other users.

  Accordingly, OpenVMS does not store the cleartest password.  Further,
  OpenVMS uses a password hashing algorithm, not an encryption algorithm.
  This means that storage of a cleartext password is deliberated avoided,
  and the cleartext value is deliberately very difficult to obtain.
  The hash is based on a Purdy Polynomial, and the hash itself
  includes user-specific values in addition to the password, values
  that make the results of the password hash unique to each user.

  Regardless of the use of a password hashing scheme, if a copy of
  your password file should become available to a system cracker, you
  will want to force all users to use new passwords immediately.

  If you should require a user to verify a password, use the username,
  the user's salt value (this value is acquired via $getuai) and the
  user's specified cleartext password, and compare the resulting hashed
  value (using a call to $hash_password) against the saved hashed password
  value (this value also acquired via $getqui).  For reasons of security,
  avoid saving a cleartext password value in any data files, and do not
  maintain the cleartext password in memory longer than required.

  Kerberos authentication (client and server) is available on OpenVMS
  V7.3 and later.  Integration of Kerberos support into various Compaq
  and into third-party products is expected.

  If you are simply looking for OpenVMS access and the SYSTEM and all
  other privileged passwords are forgotten or otherwise unavailable,
  please see section MGMT5 and/or the OpenVMS documentation set.

  Also please see the C2 guidelines in the OpenVMS security manual.

MGMT63. Volume Shadowing MiniCopy vs MiniMerge?

Mini-Merges have been supported for many years on VMS, as long as you
had MSCP controllers (i.e. HSC, HSJ, or HSD) which supported the
Volume Shadowing Assist called 'Write History Logging'.

If you want mini-merges on HSG80 (Fibre Channel) controllers, the
latest info I've seen (the "Fibre Channel in a Disaster-Tolerant
OpenVMS Cluster System" whitepaper at
indicates that this will require ACS 8.7 and VMS 7.3-1, assuming
things go according to plan.

Since there have already been responses in this thread referring to
the Mini-Copy capability, and I don't know if you really meant
Mini-Merge or Mini-Copy, it might be helpful to describe the
difference between Mini-Merge and Mini-Copy.

A Shadowing Full Copy occurs when you add a disk to an existing
shadowset using a MOUNT command; the entire contents of the disk are
effectively copied to the new member (using an algorithm that goes
through in 127-block increments and reads one member, compares with
the target disk, and if the data differs, writes the data to the
target disk and loops back to the read step, until the data is equal
for that 127-block section).

If you warn VMS ahead of time (at dismount time) that you're planning
to remove a disk from a shadowset but re-add it later, VMS will keep a
bit-map tracking what areas of the disk have been modified while the
disk was out of the shadowset, and when you re-add it later with a
MOUNT command VMS only has to update the areas of the returned disk
that the bit-map indicates are now out-of-date.  VMS does this with a
read source / write target algorithm, which is much faster than the
shenanigans the Full Copy does, so even if 100% of the disk has
changed, a Mini-Copy is faster than a Full Copy.

A Shadowing Merge is initiated when a VMS node in the cluster (which
had a shadowset mounted) crashes or otherwise leaves unexpectedly,
without dismounting the shadowset first.  In this case, VMS must
ensure that the data is identical, since Shadowing guarantees that the
data on the disks in a shadowset will be identical.  In a regular
Merge operation, Shadowing uses an algorithm similar to the Full Copy
algorithm (except that it can choose either of the members' contents
as the source data, since both are considered equally valid), and
scans the entire disk.  Also, to make things worse, for any read
operations in the area ahead of what has been merged, Shadowing will
first merge the area containing the read data, then allow the read to

A Merge can be very time-consuming and very I/O intensive, so some
controllers have Shadowing Assists to make it faster.  If the
controllers support Write History Logging, the controllers record the
areas (LBNs) that are the subject of Shadowing writes, and if a node
crashes, the surviving nodes can query the controllers to find out
what exact areas of the disk the departed node was writing to just
before the crash, and thus Shadowing only needs to merge just those
few areas, so this tends to take seconds as opposed to hours for a
regular Merge.
                                         [Keith Parris]

MGMT64. Why is BACKUP not working as expected?



  BACKUP has a very complex interface, and there are numerous command
  examples and extensive user documentation available.  For a simpler
  user interface for BACKUP, please see the documentation for the

  As for recent BACKUP changes, oddities, bugs, etc:

  o A change made in OpenVMS V6.2 WILL cause more files to be included into
    a file-based BACKUP saveset using /SINCE=BACKUP as all files underneath
    any directory with a sufficiently recent (selected) date will be included
    in the saveset.  This change was deliberate and intentional, and was
    mandated by the need to provide a functional incremental restoration.

    Without the inclusion of these apparently-extra files, an incremental
    saveset can NOT be reliably restored.

  o As part of the OpenVMS V6.2 change, the /SINCE command -- without the
    specification of the =BACKUP keyword -- selected more files than it
    should have.  This is a bug.  This bug has been remedied  in the
    OpenVMS BACKUP source code and in some of (all of?) the BACKUP ECO kits.

  When working with BACKUP, you will want to:

  o Get the current BACKUP ECO kit and install it BEFORE you attempt to
    troubleshoot any problems.

  o Learn about the /NOINCREMENTAL (new) and /NOALIAS (V6.2 and later)
    command qualifiers.  The former qualifier returns to the pre-V6.2
    behaviour of the /SINCE file selection mechanism, while the latter
    (specified with /IMAGE) reduces the replication of files on system
    disks and other disks with file alias and directory alias entries.
    Both of these can reduce the numbers of files that will be selected
    and thus included into the saveset.

  When working with the BACKUP callable API:

  o Build your applications with the most current BACKUP API available.
    Changes made to the V7.1-2 and V7.2 API were incompatible with the
    V7.1 and V7.2-1 and later APIs, and this incompatibility was
    repaired via a BACKUP ECO kit.  Do NOT build your application with
    the versions of the BACKUP API that shipped with V7.1-2 and V7.2,
    as these are incompatible with the BACKUP API constants that were
    used on other versions.

MAIL1.  How do I send Internet mail?

The simplest answer on most OpenVMS V6.2 and later systems: just enter the 
Internet (SMTP) address at the "to" prompt in MAIL.  On most such systems,
this will send your email to the specified recipient.

That said, there is no one answer to this question.  Internet mail is built 
upon the TCP/IP protocols, which are not directly supported by OpenVMS -- 
support requires the installation of a package that understands TCP/IP and 
specifically one that provides the Simple Mail Transport Protocol (SMTP). 

A number of implementations of TCP/IP are available for OpenVMS -- from Compaq, 
from third parties, and even a free "support it yourself" form.   The MAIL
program  that comes with OpenVMS does not directly support the mail protocol
used on the  Internet (though it does recognize SMTP addresses in V6.2 and
later), but various  programs have been written that use MAIL's "foreign
protocol" facility to provide  such support -- these tools are called
transports.  To send mail through a transport,  place the transport specifier
at the front, and (typically) quote the address.  

For example, IN%"" -- you *must* include the
quotation  marks -- indicates that IN transport will be used to send the mail
to the address  Common names for the transport
are IN%, MX%, and SMTP%. (MX is a widely used, free, mail handler; see question 
SOFT1.  SMTP% is used by  Compaq's TCP/IP Services product.)  Other systems may
use some other name.  If none  of these prefixes work, please ask your system
manager for assistance.
					[Stephen Hoffman]

See also MAIL2.

MAIL2.  How do I get IN% or MX% added automatically to Internet addresses?

For older OpenVMS releases, you can acquire the MAILSHR_PATCH package
(there's one each for VAX and Alpha) from the WKU FILESERV server 
(see question SOFT1.).

As of OpenVMS V6.2, this is not necessary -- simply enter the SMTP email
address directly.  If the address specified to MAIL contains an embeded "@"
character in it (a quoted string is not needed), MAIL will look to see if 
the logical name MAIL$INTERNET_TRANSPORT is defined.  If it is, then MAIL
will use the translation as the transport protocol, otherwise it will use 
the SMTP transport as is used by TCP/IP Services for OpenVMS.  

To alter this, for example, if you wanted IN% added, you'd define 

MAIL3.  How do I automatically append a signature file to my mail messages?

OpenVMS 7.0 adds the ability to automatically append signature files - in
MAIL, use the SET SIGNATURE command to specify a signature file name.
For earlier versions, see the following paragraphs.

The basic MAIL utility which is shipped with VMS does not have an intrinsic
mechanism for adding signature files.  If you're using an enhanced mail
handling package (e.g PMDF), however, it may have provisions for adding
signature files to all messages it handles - check the documentation for
details.  In addition, it's common practice to use an editor to handle
addition of `quotation marks' (e.g. >) and signature files to mail messages
and news postings.  There are several implementations of this for different
editors available on the net; for one example, see the MAIL_EDIT package.


Define the logical MAIL$EDIT to a COM-file, which looks something like
the following:

$ IF P1 .NES. ""
$    COPY 'P1',<signaturefile> 'P2'
$    COPY <signaturefile> 'P2'
$ <editorname> 'P2'

Where <signaturefile> is the name of the signature-file (including directory
and disk) and <editorname> is EDIT/EDT or EDIT/TPU (or your favorite editor).
					[Arne VajhЬj]

MAIL4.  Do I have to use VMS MAIL?  I like my Unix mailer better.

Several Unix mailers have been ported to VMS, some by the vendors of specific
TCP/IP packages, some by users who have made them freely available.  See the
documentation for your TCP/IP package, and refer to question SOFT1 for
information about the availability of the free ports.
					[Jerry Leichter]

MAIL5.  How can I forward my mail?  Can I forward it to an Internet address?

You can use the SET FORWARD command within MAIL to specify where you want all
your mail forwarded to.  Use SHOW FORWARD to see your current forwarding.  To
cancel all forwarding, type SET NOFORWARD.

You can forward your mail to an Internet address, but you have to be careful
because of the way MAIL handles special characters, such as quotation marks.
First, determine the address you would use to send mail to the place you want
to forward to - say, IN%"".  Take that string and
*double all the quotation marks*, producing IN%"""".
Finally, wrap quotation marks around the outside and use the the result with


If you do SHOW FORWARD, you should now see:

	Your mail is being forwarded to IN%"".

Note that the MAIL$INTERNET_TRANSPORT feature doesn't yet work with
SET FORWARD in that you'll still have to use the syntax above with the
quotation marks.

MAIL6.  How can I forward my mail to a list of addresses?

VMS MAIL does not support forwarding a message to more than one address.
(Older versions of MAIL allowed you to specify such forwarding, but it never
worked correctly.)

Many of the TCP/IP mail packages support forwarding to mailing lists, as does
the free MX mail handling system and the DELIVER mail "extender".  See the
documentation of your TCP/IP package and question SOFT1.

MAIL7.  MAIL keeps saying I have new messages, but I don't.  What do I do?

The count of new mail messages is kept separately from your mail folder
in SYS$SYSTEM:VMSMAIL_PROFILE.DATA.  It sometimes happens that this count
differs from what's in your mail folder.  If this happens, go into MAIL
and repeat the READ/NEW command until you see no new mail messages.  Then
enter the command one more time.  This will resynchronize the counters.

MAIL8.  How do I move all of my mail messages to another system?

If you are moving to another OpenVMS system, perhaps the best way is to select
each folder and do (in MAIL) a:


Move MYMAIL.MAI to the other system, then do this (in MAIL):

	SET FILE mymail.mai
	COPY/ALL foldername MAIL.MAI

This will place a copy of all of your messages in the given folder.  If
you wanted to maintain the separate folders, do separate EXTRACT commands
(above) specifying different .mai files, then repeat the SET FILE, COPY
for each one.

If you are moving to a non-OpenVMS system, the EXTRACT command above can
be used to create a file which you can then copy - how you import it into
your mailer is an exercise left to the reader.

MAIL9.  How do I send or read attachments in VMS MAIL?

Is there any way to send or read mail with files as attachments from VMS?

Not directly with the OpenVMS MAIL facility, but there are several 
other options:

1. Install PINE, available commercially from Innosoft or free from Andy 
   Harper.  With PINE you can both send and receive MIME messages, if 
   you have the appropriate viewers available.

2. If you're working from an X11 server use the OpenVMS version of Netscape
   Navigator.  This option is ok for sending mail, but is not optimal for
   reading it, since Netscape will use POP and remove messages entirely 
   the OpenVMS MAIL system, which is not generally what you want.

3. MPACK/MUNPACK.  To send a MIME mail, construct the message with
   attachments manually using MPACK.  You cannot send the resulting file
   directly through MAIL because an extra  blank header line will be
   inserted between your message and the OpenVMS MAIL headers, which will
   cause the message to appear as plain text in most mail programs.  Some
   TCP/IP stacks provide a work around for this problem, and if that
   doesn't work, you should generally be able to force the message directly
   into the SMTP port of your mail machine.  Examples of both methods are

   To read a MIME mail message, open it in MAIL, extract it to a file, then
   use MUNPACK to break out and decode the attachments.    

   MPACK/MUNPACK tools are also available on OpenVMS Freeware V5.0:

					[David Mathog]

4. With OpenVMS V7.2 and later, use the supplied MIME tool.

MAIL10.  How can I block SMTP mail relay spam?

  Use the anti-spam capabilities present in the TCP/IP Services V5.1 
  and later SMTP servers.

  Use a firewall.

  On earlier TCP/IP Services releases, some simple DCL can reportedly
  prevent relay SMTP spam.  Use the UCX command SHOW SERVICE SMTP/FULL 
  to find the directory containing the UCX$SMTP_RECV_STARTUP.COM file, 
  and insert the following DCL:

$       !
$       ! Block spam.
$       !
$       IF $STATUS.EQ.1
$       THEN
$         WRITE SYS$OUTPUT "SPAM from relay rejected"
$         EXIT
$       ENDIF
$       IF $STATUS.EQ.1
$       THEN
$         WRITE SYS$OUTPUT "SPAM source relay rejected"
$         EXIT
$       ENDIF
$       !
$       ! Run receiver.
$       !
$       run sys$system:ucx$smtp_receiver.exe
$       goto exit

                                    [Henry Juengst]

UTIL1.  How do I play an audio CD on my workstation?

If you've installed the DECwindows examples, you'll find
DECW$CDPLAYER.C, .DAT, .EXE, .UIL, and .UID.  Copy the .UID and .DAT
files to DECW$USER_DEFAULTS: (typically SYS$LOGIN:), define the logical name
DECW$CD_PLAYER to be the device name of your CD-ROM drive (eg. DKA400:),
give yourself PHY_IO and DIAGNOSE privileges, and run the .EXE.  (These
privileges are required, as the access to the CD-related extensions will
require the use of the privilege-protected IO$_DIAGNOSE I/O function code.)
You can also install the image with these privileges.  See the source for
additional details - note that the comments regarding the need for
SYSGEN CONNECT are no longer applicable (at least as of VMS V5.5-2).

There's also SYS$EXAMPLES:CDROM_AUDIO.C and .EXE, a non-Motif program,
available on OpenVMS VAX, and DECW$EXAMPLES:DECW$CDPLAYER.* on OpenVMS
VAX and OpenVMS Alpha.

The standard OpenVMS IDE DQDRIVER does not support the necessary 
IO$_DIAGNOSE function required for access to audio CD media (on OpenVMS 
versions prior to V7.3), but an updated DQDRIVER device driver (source 
code and all) with this capability and with the source code of an updated 
CD audio player is available on the OpenVMS Freeware website 
(, and these updates are also 
expected to be included on Freeware V5.0 and later.

UTIL2.  How do I access a MS-DOS floppy disk from OpenVMS?

The Compaq Advanced Server (formerly known as PATHWORKS) for OpenVMS 
product includes an unsupported and undocumented utility called PCDISK,
and this tool can read and write various MS-DOS format diskettes.

ProGIS in Germany sells a product called VMove which supports DOS files 
on many different device types.  For more information, send mail to

Engineering Software has a product called VAKSAT which will read, write,
and erase files on DOS diskettes.  Available for both VAX and Alpha.
Contact for more information.

MadGoat PC Exchange (PCX) is a utility for copying files to and from
MS-DOS (FAT) format diskettes under VMS, using an RX23 (3.5"), RX26 
(3.5"), or RX33 (5.25") diskette drive.  For 3.5" diskettes, high-density
disks can be read or written; double-density disks are read-only. Only
high-density disks are supported on the RX33.

UTIL3.  How do I play sound files on an AlphaStation?  DECsound doesn't work

The new AlphaStation systems use a different sound board (Microsoft Sound
System) than the earlier DEC 3000 AXP systems, and DECsound, as supplied by
DECwindows Motif, doesn't support this board.  Compaq offers an optional
product, Multimedia Services for OpenVMS:
which provides a replacement DECsound for this card as well as many other 
features (an AVI and MPEG player, video capture support, etc.)

Ensoniq sound support is also available.

UTIL4.  Why is DECmigrate not working with Fortran?

OTS-F-INDATCOR internal data corrupted in Run-time Library

This error can arise with Fortran programs if you are running a 
recent version of OpenVMS Alpha, and are using DECmigrate to
translate Fortran applications.  The DECmigrate Run-Time Library 
attempts to support mixed translated-native I/O to the same unit 
by sharing the native Fortran RTL's internal data structures, and
in OpenVMS 7.2 these structures changed and the translated RTL
was not updated accordingly.

You can copy DEC$FORRTL.EXE from OpenVMS 7.1, copying it to some 
spare directory, and then defining the logical name DEC$FORRTL to 
point to it before running your translated application.  Or rebuilding 
the application to use the available native Fortran compiler.  Or
you can apply the current Fortran RTL kit, which has a fix for this.

See SOFT13.
                                    [Steve Lionel]

UTIL5.  How do I read IBM EBCDIC tapes on OpenVMS?

IBM boxes can read ANSI-labeled ASCII magtapes.  Fixed-length records and
the DCL COPY command can be used to transfer text files around.  Check the
IBM documentation for details.

There exists various freeware around (TAPECOPY, ETAPE, TCOPY, MTEXCH) that 
can read and write EBCDIC tapes.  Visit the DECUS website software archives
search engine (via, and search for "EBCDIC".
                                    [Steve Hoffman]

One source for ETAPE is:

OpenVMS Freeware V5.0 is expected to include this tool.
                                    [Fletcher Hearns]
                                    [Dale Miller]

UTIL6.  How can I patch an OpenVMS Alpha image?

  Using the OpenVMS Freeware tool ZAP:

  tell ZAP to read a block (bucket) of information based on the
  virtual block number (VBN), using X for hexadecimal.  Dump
  yourself into the OpenVMS debugger with R2 pointing into the 
  buffer, EXAMINE/INSTRUCTION as needed, alter the buffer as
  required, GO to get out of the debugger and back into ZAP, and
  use the ZAP W command to write the updated block.

  OpenVMS Freeware V5.0 is expected to have an updated version
  of the ZAP tool.

DCL1.   How do I run a program with arguments?

The RUN command does not accept arguments.  To pass arguments to a program,
you must use what is called a "foreign command".  For example:

	$ unzip :== $disk:[dir]unzip.exe
	$ unzip -?

The leading $ in the equivilence name for the symbol definition is what 
makes the DCL symbol a foreign command. If the device and directory are
omitted, SYS$SYSTEM: is assumed.

Under OpenVMS V6.2 and later, DCL supports automatic foreign command
definition via the logical name DCL$PATH:.  An example of a definition 
of this logical name is:

    $ DEFINE DCL$PATH SYS$DISK:[],ddcu:[mytooldir],SYS$SYSTEM:

DCL will first look for a command in the DCL command table, and if no match is
found and if DCL$PATH is defined, it will then look for command procedures and
executable images with filenames matching the command specified, in the
directories specified via DCL$PATH.  The first match found is invoked, and
under OpenVMS, the DCL$PATH support will cause a command procedure to be
activated in preference to an executable image.

For more information on foreign commands or on automatic foreign command
support, see the OpenVMS User's Manual.

See also question PROG2.

If you want to create a detached process that takes arguments from a command
line, it must be run under the control of a command line interpreter (CLI)
(typically DCL).  This is done by placing the command line in a file,
specifying SYS$SYSTEM:LOGINOUT.EXE as the image to run and the command file as
the input.  For example:

	$ WRITE CMD "$ MYCOMMAND arguments"

Various OpenVMS library calls (such as lib$spawn(), cli$dcl_parse(), and the C
library system() call) require access to a command line interpreter such as
DCL to perform requested actions, and will not operate if a CLI is not

When a CLI is not available, these calls typically return the error status
SS$_NOCLI.  And as mentioned above, invoke the image LOGINOUT to cause a CLI
(such as DCL) to be mapped into and made available in the context of the
target process.

For examples of how TCP/IP Services sets up its foreign commands (which
includes tools such as uuencode and uudecode), please see the DCL command

Also see DCL11.
					[Stephen Hoffman]

DCL2.   How can I redefine control keys in DCL?

The DCL DEFINE/KEY command allows you to define function and keypad
keys, but not control keys.  Also, keys you define with DEFINE/KEY are
not recognized inside applications.  Many applications which use the
SMG$ routines for input have a similar DEFINE/KEY feature.

The terminal driver line-editing control keys, including the use of DEL
for delete, are not modifiable.

DCL3.   How can I clear the screen in DCL?

The simplest way is the TYPE/PAGE NLA0: command.

You can set up a symbol to clear the screen in your LOGIN.COM:


DCL4.   Using REPLY/LOG from DCL?  Disabling Console OPCOMs?

Your terminal must be enabled as an operator terminal before the
REPLY/LOG command can be used, but a DCL procedure (batch command
file, system startup, etc) does not have an associated terminal.
To make this work, use the following sequence to enable the OPA0: 
console as the operator terminal, then the REPLY/LOG command will 
be accepted:


To disable the system console terminal (OPA0:) as an operator terminal, 
use the following command:


Also see SYLOGICALS.COM (and SYLOGICALS.TEMPLATE) for information
on configuring the behaviour of OPCOM, including the (default) use 
of the system console (OPA0:) as an operator terminial and the 
specific contents and behaviour of the system operator log file 
						[Arne VajhЬj]
						[Stephen Hoffman]

DCL5.   How do I generate a random number in DCL?

Here's my random number generator for inclusion into the OVMS FAQ;
just do a GOSUB RAND and the global symbol RANDOM will contain a
randomly generated number.  The user/programmer can feed the generator
a ceiling value (__CEIL) or a new seed (__SEED).

$! RAND - returns a positive random number ("RANDOM") between 0 and 
$!        __CEIL - 1.
$ IF F$TYPE(__SEED) .EQS. ""
$     ! seed the random number generator, ...
$     __NOW = F$CVTIME()
$     __HOUR = 'F$EXTRACT(11,2,__NOW)'
$     __MINUTE = 'F$EXTRACT(14,2,__NOW)'
$     __SECOND = 'F$EXTRACT(17,2,__NOW)'
$     __TICK = 'F$EXTRACT(20,2,__NOW)'
$     __SEED == __TICK + (100 * __SECOND) + (6000 * __MINUTE) + -
         (360000 * __HOUR)
$     ! the generator tends to do better with a large, odd seed, ...
$     __SEED == (__SEED .OR. 1)
$     ! clean up, ...
$ __SEED == __SEED * 69069 + 1
$ RANDOM == (__SEED.AND.%X3FFFFFFF)/(%X40000000/__CEIL)

DCL6.   What does the MCR command do?

The MCR command runs the specified image, with a default filespec of
SYS$SYSTEM:.EXE, and passes any (optional) command line arguments in the
same manner as a foreign command.  In other words:


is equivalent to:

	$ FOO :== $FOO

It derives from the RSX operating system from which VMS evolved and is
still often used as a shortcut for activating images.  The MCR command is
different from the MCR command line interpreter, which is provided as part
of the optional VAX-11 RSX product that provides RSX emulation under VMS.

DCL7.   How do I change the OpenVMS system prompt?

You can use the SET PROMPT command for this purpose.  SET PROMPT sets the DCL
prompt to the specified string.

When you want to display variable information, you will need to establish a
tie-in that provides the information to the SET PROMPT command as required.

If you wish to display the default directory for instance, you will have to
establish a tie between the SET DEFAULT command and the SET PROMPT commands,
as there is no direct way to get the default directory as the DCL prompt.  You
can easily acquire or create a set of DCL command procedures that perform the
SET DEFAULT and SET PROMPT for you.  These DCL command procedures often use a
command such as:

  $ set prompt='f$env("default")'

More advanced users could implement a system service or other intercept, and
use these tools to intercept the directory change and reset the prompt
accordingly.  (This approach likely involves some kernel-mode programming, and
requires write access to various undocumented OpenVMS data structures.)

There are related tools available from various sources, including the
following web sites:



  o James F. Duff has also made available a Macro32 tool known as
    TIME_PROMPT, a tool that sets the prompt to the current system time.

  o Many folks have contributed DCL procedures to perform this task.
    Visit the newsgroup archives for information and examples.

Information in this section has been acquired from various postings that
have discussed this topic in the comp.os.vms newsgroup in the past, and
examples from Arne Vajhoej, Brian Schenkenberger, James Duff, and others.

				[Stephen Hoffman]

DCL8.   Can I do DECnet task-to-task communication with DCL?

Yes, you can do this with DCL.

The OpenVMS DECnet documentation shows various simple examples using the
task object and the TYPE command to trigger the execution of a DCL command
procedure on a remote node.  A slightly more advanced example of using DCL
for DECnet task-to-task -- a procedure that acts as both the client and as
the server as appropriate, and that uses a basic form of half-duplex
communications -- is included:

        $! This procedure must be in the user's login directory.
        $! Requires a self-referential (not reverential :-) proxy:
        $!    UAF> add/prox <LocalNode>::<CurrentUser> <CurrentUser>/default
        $! Author: Stephen Hoffman, OpenVMS Engineering, Compaq
        $ goto 'f$mode()'
        $ open/read/write chan 0::"task=x"
        $ write chan "Hello"
        $ read chan parameter
        $ close chan
        $ write sys$output parameter
        $ exit
        $ open/read/write chan sys$net
        $ read chan parameter
        $ write chan "''parameter' yourself!"
        $ close chan
        $ exit

  An example of a run of the above procedure:

        $ @x
        Hello yourself!

DCL does not include support asynchronous I/O, thus a predetermined protocol
or a predetermined "turn-around" command sequence must be implemented in
order to avoid protocol deadlocks -- cases where both tasks are trying to
write or both tasks are trying to read.  The task that is writing messages
to the network must write (or write and read) a predetermined sequence of
messages, or it must write a message that tells the reader that it can now
start writing messages.  (This is the essence of a basic half-duplex network
protocol scheme.)
					[Stephen Hoffman]

DCL9.   How can I get the width setting of a terminal?

  $ width = f$getdvi(terminal,"DEVBUFSIZ")

DCL10.  How can I substitute symbols in a PIPE?

  Use ampersand substitution, not apostrophe substitution.

    $ pipe show system | search sys$input opcom | (read sys$input pid ;
           pid=f$element(0," ",pid) ; define/system opcom_pid &pid)
    $ show log opcom_pid
       "OPCOM_PID" = "0000020B" (LNM$SYSTEM_TABLE)
                                           [Norm Lastovica]

DCL11.  Use of RUN/DETACH, LOGINOUT, and logical names?

  With a command to create a detached process such as:


  If you are trying to use a logical name as the /INPUT, /OUTPUT or
  /ERROR on a RUN/DETACH command, then you must translate the logical
  name specifications to physical references before passing them, or
  the definitions must reside in a logical name table that is visible 
  to the newly-created process.

  Also note that LOGINOUT only creates the SYS$LOGIN, SYS$LOGIN_DEVICE, 
  and SYS$SCRATCH logical names if it is processing a login that is based 
  on the contents of a SYSUAF record -- without access to the associated
  SYSUAF record, this information is not available to LOGINOUT.  (If you 
  want to see these particular logical names created, then please specify
  the /AUTHORIZE qualifier on the RUN/DETACHED command.)

  If you do not specify LOGINOUT as the image, then there is no easy way 
  to get these logical names.  Also, any logical names that are used in the 
  target image file specification must also be in a logical name table 
  accessable (by default) by the newly-created detached process.  Shared 
  tables include the group (if the process is in the same UIC group) and 
  the system table.  (If the target process is to be in another UIC group, 
  a suitablly privileged user or application can create the necessary 
  logical name(s) directly in the other group logical name table.)

  When in doubt, create a short DCL command file as input, and use a
  SHOW LOGICAL and similar commands to examine the context.  (And use
  physical device and directory references on the RUN/DETACH of the
  LOGINOUT image, when specifying this command file as /INPUT.)  Also
  remember to check both security auditing and system accounting when 
  troubleshooting problems with the RUN/DETACH.

  Also see DCL1.

DCL12.  How to use escape and control characters in DCL?

  To write a message and then the bell character, use:

    $ bell[0,7] = 7
    $ write sys$output "Hello''bell'"

  To write blinking text, use:

    $ esc[0,7] = 27
    $ text = "Blinking Text"
    $ write sys$output "''esc'[5m''text'''esc'[m"

  Also see sections DECW9, MISC2.

FILE1.  How can I undelete a file?

OpenVMS doesn't have an "undelete" function.  However, if you are quick
to write-protect the disk (or if you can guarantee that no new files get
created or existing files extended), your data is still on the disk
and it may be possible to retrieve it.  The FLORIAN tool available from
the WKU Fileserver claims to be able to do this (see question SOFT1.)
Other alternatives here include the DFU tool, available on the OpenVMS
Freeware CD-ROM distribution.

If you are setting up a user environment for yourself or for others, it
is quite easy to use DCL to intercept the DELETE command, using a symbol:


The DELETE symbol will cause the procedure to be invoked whenever the user
enters the DELETE command, and it can copy the file(s) to a "trashcan"
subdirectory before issuing a "real" DELETE on the files.  Other procedures
can retrieve the file(s) from the "trashcan" subdirectory, and can (and
should) clean out the "trashcan" as appropriate.  (Realize that this DELETE
symbol can interfere with DELETE/GLOBAL and other similar DCL commands.)
					[Stephen Hoffman]

FILE2.  Why does SHOW QUOTA give a different answer than DIR/SIZE?

DIR/SIZE doesn't take into account the size of file headers which are
charged to your quota.  Also, unless you use DIR/SIZE:ALL, you'll see only
the "used" size of the file, not the allocated size which is what gets
charged against your quota.  Also, you may have files in other directories.
					[Steve Lionel]

$ DIR/SIZ=ALL/GRAND [username...]

Grand total of D1 directories, F1 files, B1/B2 blocks.

$ DIR/SIZ=ALL/GRAND [-]username.DIR

Grand total of 1 directory, 1 file, B3/B4 blocks.

  User [username] has B5 blocks used, B6 available,
  of B7 authorized and permitted overdraft of B8 blocks on disk

If the user has no files in other directories and all file-headers are
only 1 block, then the following should apply:


If the diskquota is out of synch, then the system-manager can make a rebuild.
					[Arne VajhЬj]

Also be aware that the DIRECTORY/SIZE command can report larger values 
than might otherwise be expected when used to evaluate files and/or 
directories that are alias links -- such as the system roots on OpenVMS 
system disks -- as the command reports a total that is cumulative over 
all of the files and directories examined, without regard for which ones 
might be alias entries and which are not.  (In other words, a DIRECTORY/SIZE 
of an entire OpenVMS system disk will report a disk useage value larger than 
the (usually more accurate) value reported by the SHOW DEVICE command.  This
as a result of the alias entries linking each SYS$SYSDEVICE:[SYSCOMMON]SYS*.DIR 
directory file and the SYS$SYSDEVICE:[000000]VMS$COMMON.DIR file together.)

FILE3.  How do I make sure that my data is safely written to disk?

If your application must absolutely guarantee that data is available,
no matter what, there's really no substitute for RMS Journaling and
host- or controller-based shadowing.  However, you can achieve a good 
degree of data integrity by issuing a SYS$FLUSH RMS call at appropriate 
times (if you're using RMS, that is.)  If you're using a high-level 
language's I/O system, check that language's documentation to see if 
you can access the RMS control blocks for the open file.  In C you can 
use fflush followed by fsync.  Note that fsync, which was undocumented 
for VAX C but is documented for DEC C, takes a file descriptor as an 
argument, not a *FILE.

For details on disk bad block handling on MSCP and on SCSI disk devices, 
please see Ask The Wizard (ATW) topic (6926).

FILE4.  What are the limits on file specifications and directories?

A file specification has an aggregate maximum size of 255 characters at
present.  The node and device specification may be up to 255 characters each -
file name and file types may be up to 39 characters each.  File versions are
from 1 through 32767, though 0 (latest version), -0 (oldest version) and -n
(n'th previous version) can be used in most contexts.  A file specification
may not have more than 8 directories and subdirectories - while it is possible
to create subdirectories of greater depth, accessing them is problematic in
most cases and this should be avoided. 

Application developers should use OpenVMS-supplied routines for parsing
file specifications - this ensures that changes in what is allowable will
not tend to break your application.  Consider that various parts of the
file specification may contain quoted strings with embedded spaces and
other punctuation!  Some routines of interest are SYS$FILESCAN, SYS$PARSE
and LIB$TRIM_FILESPEC.  For further information, see the OpenVMS Guide to
File Applications.

Performance of larger directory files improves (greatly) with OpenVMS 
V7.2 and later -- operations on directory files of 128 blocks and larger 
were rather slower on earlier OpenVMS releases due to the smaller size
of the directory cache and due to the directory I/O processing logic.

For fastest directory deletions, consider a reverse deletion -- delete
from the last file in the directory to the first.  This reversal speeds 
the deletion operation by avoiding unnecessary directory I/O operations
as the files are deleted. Tools such as DFU can be used for this purpose,
as can various available reverse-DELETE DCL command procedures.

FILE5.  What is the largest disk volume size OpenVMS can access?

One Terabyte (TB; 2**31 blocks of 2**9 bytes).  Prior to the release of 
V6.0, the OpenVMS file system was limited to disk volumes of 8.38 GB
(2**24 blocks, 16777216 blocks) or less.

On some systems, there are restrictions in the console program that limit the
size of the OpenVMS system disk.  Note that data disks are not affected by
console program limits.  For example, all members of the VAXstation 3100
series are limited to a system disk to 1.073 GB or less due to the console,
though larger data disks are possible.

Some SCSI disks with capacities larger than 8.58 gigabytes (GB) will 
require the use of an OpenVMS ECO kit (eg: ALPSCSI04_062 or later) for 
new SCSI device drivers.  Failure to use this ECO can cause "rounding 
errors" on the SCSI disk device capacity -- OpenVMS will not use nor 
display the full capacity of the drive -- and  "%sysinit-e-error mounting 
system device status equals 000008C4" (8C4 -> "%SYSTEM-?-FILESTRUCT, 
unsupported file structure level") errors during bootstrap.  (One 
workaround for the bootstrap when the bitmap is located far into the 
disk is the use of INIT/INDEX=BEGIN.)  The problem here involves the
particular extensions and fields used for larger capacity disks within 
the SCSI specifications and within the various intepretations of same.
					[Stephen Hoffman]

For IDE disk drives:

  o Versions of DQDRIVER *BEFORE* X-15 topped out at 8.455 GB.
    Fixed drivers (>="X-15") were shipped in:

      OpenVMS Alpha V7.2-1, and later
      V7.2 UPDATE V1.0 ECO, and later
      V7.1-2 UPDATE V1.0 ECO, and later
      V7.1-2 UPDATE V3.0 ECO, and later

  o The newer DQDRIVER driver operates to disks up to 33 GB 
    without (known) problems, and effectively works with rather
    larger disks (up to circa 137 GB?) but is known to report an 
    incorrect number of "cylinders" with disks above 33 GB.

  See ALPHA23 for additional IDE DQDRIVER information.

Be aware that a known restriction in certain older versions of the 
Alpha SRM Console prevents booting most IDE drives larger than 
8.455 GB, depending on exactly where the various files are located 
on the volume.  Updated SRM consoles for systems with SRM and IDE 
drive support are (will be) available.  (OpenVMS Engineering has 
successfully bootstrapped 20GB IDE disks using the appropriate 
SRM console version.)

NOTE: All IDE-related disk sizes listed in this section are stated 
in units of "disk (base ten) gigabytes" (1 GB = 10^9 bytes) and NOT 
in units of "software (base two) gigabytes" (1 GB = 2^30 (1073741824.) 
bytes.   See MISC21.
                                          [Atlant Schmidt]

Be aware that larger disks that are using an extension of SCSI-2 -- 
disks that are using a mode page field that the SCSI specifications 
normally reserved for tape devices -- to permit a larger disk volume 
size will require a SCSI driver update for OpenVMS, and this change 
is part of V7.1-2 and later, and also part of ALPSCSI07_062 and later.
(These larger disks disks will typically report a DRVERR, or will see 
the volume size "rounded down".)  SCSI disks larger than 16777216 blocks 
cira 8.455 GB (base ten); 8GB (base two) require this ECO, or require 
the use of OpenVMS Alpha V7.1-2 or later.

Also see VAX5, MISC21.

FILE6.  What is the maximum file size, and the RMS record size limit?

RMS can store individual files of a size up to the maximum supported
volume size.  Under OpenVMS V6.0 and later, the volume size and the RMS
maximum file size limit is 2**31 * 512 bytes -- one terabyte (1 TB).

"Use a volume set to provide a large, homogeneous public file space.
You must use a volume set to create files that are larger than a single
physical disk volume. (The file system attempts to balance the load on
the volume sets, for example, by creating new files on the volume that
is the least full at the time.)"

"You can add volumes to an existing volume set at any time. The maximum
number of volumes in a volume set is 255."

The RMS formats -- sequential, relative, and indexed -- are limited by
the one terabyte maximum volume size.  RMS relative files are further
limited to a number of records that will fit in 32 bits -- 4 billion
records.   Sequential and indexed formats do not have a record limit.

Also see PROG14, MISC21.
					[Stephen Hoffman]

FILE7.  How do I write recordable CD media (CD-R) on OpenVMS?

At its simplest: get LDDRIVER from the Freeware.  Get CDRECORD or CDWRITE.
(CDRECORD and CDWRITE are freely available, though versions are not on the
Freeware V5.0 distribition; the URLs are referenced later in this section).
Build the contents of the disk on the LD device partition.  Then use the 
CDRECORD or CDWRITE tool to record the contents of the LD partition directly 
onto the CD-R or CD-RW media.  

While folks have had success getting PC-based CD-R/CD-RW tools to work with 
OpenVMS partitions, it is far easier and more reliable to use the 
OpenVMS-based versions of the tools.

More details: Creation of CD-ROMs using CD-Recordable media (CD-R) under 
OpenVMS typically involves one of two approaches: the use of the optional
CD-R (`Scribe') capabilities available for the InfoServer or other 
"offline" hardware packages (PC-based packages will be included in this), 
or the use of a host-based package such as the CDWRITE13_VMS utility, an 
OpenVMS port of a Linux tool.

OpenVMS presently has no integrated support for recording CD-R media.

OpenVMS can read both ODS2 and ISO9960 format CD-ROMs.

InfoServer hardware configurations are no longer availble from Compaq,
but may potentially be acquired through other means.

The CDWRITE13_VMS package is one example of a host-based package that
can be used to create CD-R media.  The contact for CDWRITE13_VMS is
Dr. Eberhard Heuser-Hofmann.  One website that discusses this package
is located at:

Also see the newest linux-cdwrite package, XCDROAST.

Additional information is available via David J. Dachtera at:

Also see:

                                          [Stephen Hoffman]

U.S. Design offers a package that includes the tools necessary to 
create a CD or DVD-R with either 9660 or ODS-2 format, for standalone 
CD-R or DVD-R drives, for recent OpenVMS versions.  Details are 
available at:
                                           [Harry Garonzik]

FILE8.  What I/O transfer size limits exist in OpenVMS?

The maximum transfer size is an attribute of the particular I/O device,
controller and driver combination; there is no inherent limit imposed
by OpenVMS (other than the fact that, today, byte counts and LBNs are
generally limited to 32 bits).

The maximum size of a device I/O request is limited by the value in
UCB$L_MAXBCNT, which is set by the device driver based on various
factors.  (Also check the setting of the MAXBUF system parameter for
buffered I/O transfers, and check the process quotas.)

Currently, SCSI drivers limit I/O transfers to FE00(16) bytes, 65024
bytes (decimal).  The reasons for this transfer size limitation are largely
historical.  Similarly, DSSI devices are limited to the same value,
this for hardware-specific reasons.  Transfers to HSC and HSJ device
controllers via the CI are limited to 1,048,576 bytes.  Client MSCP-served
devices are limited to 65535 bytes -- to help ensure that the I/O
fragmentation processing happens on the client and not on the server

Parts of the OpenVMS I/O subsystem are optimized for data transfers less
than 64KB, because (obviously) most I/O operations are (substantially)
less than that.  OpenVMS can handle larger transfers, if the driver and
the device can handle it.

Also see FILE4, FILE5

                                        [John Croll]

FILE9.  Can I use ODBC to connect to OpenVMS database files?

Yes, you can use various available third-party packages that
permit remote ODBC clients to access RMS files and various 
commercial databases via the network.

For RMS, consider acquiring one of the packages available from 
EasySoft, Attunity Connect (formerly known as ISG Navigator), 
Oracle (DB  Integrator), SolutionsIQ, and Synergex. 

For specific commercial databases (other than RMS), contact 
the database vendor directly for assistance.

PROG1.  How do I call <routine_name> from <language_name>?

Most OpenVMS system services and RTL routines pass string arguments by
descriptor.  Languages which support native string data types create
descriptors automatically; those which do not (eg., C) require that you set
them up explicitly.

There is a lot of information available on how to call system services
and Run-Time Library routines, including examples in numerous languages.
The best references are:

	Your language's User Manual
	OpenVMS Programming Environment Manual
	OpenVMS Programming Concepts Manual
	OpenVMS Programming Interfaces: Calling a System Routine
	OpenVMS Calling Standard

In addition, if you are a subscriber to the Compaq Software Information
Network (available to those with a software support contract), the support
database contains hundreds of worked examples of calling system services
and RTL routines, including the one that seems to trip up almost everyone,
					[Steve Lionel]

Arne VajhЬj has put together a collection of OpenVMS example programs.
It can be found at:
					[Arne VajhЬj]

Additional information and examples for OpenVMS are available via:

					[Stephen Hoffman]

PROG2.  How do I get the arguments from the command line?

If you're writing a program and want to accept arguments from a foreign
command, you can use LIB$GET_FOREIGN to get the command line and parse
it yourself, or if you're programming in C, use the normal argc/argv

To write an application which uses the normal DCL verb/qualifier/parameter
syntax for invocation, see the description of the CLI$ routines in the
OpenVMS Callable Utility Routines Reference Manual.

It is possible to write an application which can be used both ways; if a 
DCL verb isn't used to invoke the image, the application parses the command 
line itself.  One way to do this is to call CLI$GET_VALUE for a required
parameter.  If it is not present (or you get an error), call 
LIB$GET_FOREIGN to get the command line and do the manual parse.

See also question DCL1.

PROG3.  How do I get a formatted error message in a variable?

Use the SYS$PUTMSG system service with an action routine that stores
the message line(s) in the variable of your choice.  Be sure the action
routine returns a "false" (low bit clear) function value so that SYS$PUTMSG
doesn't then try to display the message (unless you want it to.)  See the
description of $PUTMSG in the System Services Reference Manual for an
example of using an action routine.

PROG4.  How do I link against SYS$SYSTEM:SYS.STB on an Alpha system?

LINK/SYSEXE is the OpenVMS Alpha equivalent of linking against SYS.STB.

Also see PROG11, particularly for pointers to the details on shareable 
images and shareable image creation.

PROG5.  How do I do a SET DEFAULT from inside a program?

The problem is that SYS$SETDDIR only changes the default directory - NOT
the default disk. The default disk is determined by the logical SYS$DISK.
If you want to change the default disk within a program, then call
LIB$SET_LOGICAL to change the logical SYS$DISK. You will need to call both
LIB$SET_LOGICAL and SYS$SETDDIR to change both default disk and the default
					[Arne VajhЬj]	

PROG6.  How do I create a shareable image transfer vector on an Alpha system?

This is something that was greatly simplified for OpenVMS Alpha.  You don't
need to create a separate transfer vector module; just use the SYMBOL_VECTOR
statement in a linker options file.  For example, if your shareable image
has two routines named FOO and BAR, the linker options file should contain
the following line:


The Linker manual has more details on this.

PROG7.  How do I turn my Fortran COMMON into a shareable image on Alpha?

You need to add SYMBOL_VECTOR=(<common-name>=PSECT) to your options file.  On
OpenVMS VAX all OVR/REL/GBL psects were automatically exported into the
shareable image's Global Symbol Table.  On OpenVMS Alpha you have to tell the
linker that you want this done by means of the PSECT keyword in the
SYMBOL_VECTOR options file statement.

This has several advantages over OpenVMS VAX.  First, you don't have to worry 
about the address of the psect when you try to create a new, upwardly 
compatible version of the shareable image. Second, you can control which
psects, if any, are made visible outside the shareable image.

By default, COMMON PSECTs in DEC Fortran for OpenVMS Alpha (as well as most
other OpenVMS Alpha compilers) are NOSHR.  On VAX, the default was SHR which
required you to change the attribute to NOSHR if you wanted your COMMON
to be in a shareable image but not write-shared by all processes on the
system.  If you do want write-sharing, use: 
	CDEC$ PSECT common-name=SHR
in the Fortran source code (the CDEC$ must be begin in column 1) or a linker 
options file PSECT_ATTR statement to set the COMMON PSECT attribute to SHR.

For further information, see the Linker manual.

PROG8.  How do I convert between IEEE and VAX floating data?

In OpenVMS V6.1 and later, the routine CVT$CONVERT_FLOAT is documented 
in the LIB$ Run-Time Library Reference Manual, and can perform floating
point conversions between any two of the following floating datatypes: 
VAX (F,D,G,H), little-endian IEEE (single, double, quad), big-endian IEEE 
(single, double, quad), CRAY and IBM System\370, etc.

DEC Fortran (all platforms) has a feature which will perform automatic
conversion of unformatted data during input or output.  See the DEC Fortran
documentation for information on "non-native data in I/O" and the
CONVERT= OPEN statement keyword.

There are floating-point conversion source code packages available
for various platforms.

For further floating-point related information, see:

PROG9.  How do I get the argument count in a Fortran routine?

On VAX, many programmers would use a MACRO routine which accessed the
AP register of the caller to get the address of the argument list and
hence the argument count.  This was not guaranteed to work on VAX, but
usually did.  However, it doesn't work at all on OpenVMS Alpha, as there
is no AP register.  On Alpha systems, you must use a language's built-in
function to retrieve the argument count, if any.  In Fortran this is
IARGCOUNT, which is also available in DEC Fortran on OpenVMS VAX.

Note that omitting arguments to Fortran routines is non-standard and is
unsupported.  It will work in many cases - read the DEC Fortran release
notes for additional information.

PROG10. How do I get a unique system ID for licensing purposes?

Many software developers desire to use a unique hardware ID to "lock" a
given copy of their product to a specific system.  Most VAX and Alpha 
systems do not have a unique hardware-set "system ID" that can be used 
for this purpose.  Compaq does not use hardware IDs in its licensing
methods and many users consider a hardware-based licensing scheme to be
a negative attribute when considering software purchases.

Compaq OpenVMS uses a software-based system called the License Management 
Facility (LMF).  This provides for software keys (Product Authorization 
Keys or PAKS) which support capacity and user-based license checking.  
Compaq offers an LMF PAK Generator to CSA members -- see ALPHA4.

However, if a hardware-based method is required, the most common method is
based on an Ethernet adaptor hardware address.  Sample source code for
implementing this is available at:

PROG11. What is an executable, shareable, system or UWSS image?

   Executable code in OpenVMS typically resides in an image -- an
   image is a file -- the file extension is typically .EXE -- that
   contains this code.  Common types of images include executable
   images, shareable images, system images, and protected (UWSS)

   Executable images are programs that can be directly executed.
      These images can grant enhanced privileges, with an INSTALL
      of the image with /PRIVILEGE, or can grant enhanced access
      with the specification of a subsystem identifier on the ACL
      associated with the image.

   Shareable images contain code executed indirectly, these images
       are referenced from executable images and/or from other
       shareable images.  These images can not grant enhanced
       privileges, even with the use of INSTALL with /PRIVILEGE
       or a subsystem identifier.  These shareable images can be
       dynamically activated (a LINK that occurs at run-time) via
       the LIB$FIND_IMAGE_SYMBOL run-time library (RTL) routine.
       (See `protected images' for information on `privileged
       shareable images'.)

   System images are intended to run directly on the VAX or Alpha
       hardware -- these are normally used for the kernel code
       that comprises an operating system. 

   Protected images -- also refered to as User-Written System Services
       (UWSS), or as privileged shareable images -- are similiar in
       some ways to a standard shareable images, but these images
       include a `change mode' handler, and execute in an `inner'
       processor mode (privileged mode; executive or kernel), and
       code executing in inner modes has implicit SETPRV privilege.
       Must be INSTALLed with /PROTECT.  Note that inner-mode code
       has restrictions around calling library routines, around
       calling various system services, and around calling code
       located in other protected or shareable images.

   Loadable images and device drivers are images that can be used
   to add code into the OpenVMS kernel.  Pseudo-device drivers
   are a particularly convenient way to add executable code, with
   associated driver-defined data structures, into the kernel.
   The pseudo-device driver includes the UCB and DDB data structures,
   and a calling interface with support for both privileged and
   unprivileged access to the driver code via sys$qio[w] calls.

   A cookbook approach to creating OpenVMS shareable images is
   available at the (admittedly overly long) URL:

					[Stephen Hoffman]

PROG12. How do I do a file copy from a program?

There are several options available for copying files from within a program. 
Obvious choices include using lib$spawn(), system(), sys$sndjbc() or
sys$creprc() to invoke a DCL COPY command.  Other common alternatives include
using the callable convert routines and the BACKUP application programming
interface (V7.1 and later).

					[Stephen Hoffman]

PROG13.  What is a descriptor?

A descriptor is a data structure that describes a string or an array.  Each
descriptor contains information that describes the type of the data being
referenced, the size of the data, and the address of the data.  It also
includes a description of the storage used for the data, typically static
or dynamic.   Descriptors are passed by reference.

The following are examples of creating and using descriptors in C, with
the use of the angle brackets normally expected by the C include statements 
deliberately altered in deference to HTML:

    #include {descrip.h}
    #include {lib$routines.h}
    #include {stsdef.h}
    int RetStat;
    char TxtBuf[TXTSIZ]
    struct dsc$descriptor StaticDsc =
      { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
    struct dsc$descriptor DynDsc = 
      { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, NULL };
    int DynDscLen = 255;
    $DESCRIPTOR( ConstDsc, "This is a string" );

    /* finish setting up a static descriptor */
    StaticDsc.dsc$w_length      = TXTSIZ;
    StaticDsc.dsc$a_pointer     = (void *) TxtBuf;

    /* finish setting up a dynamic descriptor */
    RetStat = lib$sget1_dd( &DynDscLen, &DynDsc );
    if ( !$VMS_STATUS_SUCCESS( RetStat ) )
      return RetStat;

    /* release the dynamic storage */
    RetStat = lib$sfree1_dd( &DynDsc );
    if (!$VMS_STATUS_SUCCESS( RetStat ))
      return RetStat;

Static descriptors reference storage entirely under application program
control, and the contents of the descriptor data structure can be modified
as required (by the application).  OpenVMS routines do not modify the
contents of a static descriptor, nor do they alter the address or length
values stored in the static descriptor.  (The term "static" refers to the
descriptor data structure, and not necessarily to the storage referenced
by the descriptor.)

Dynamic descriptors reference storage under the control of the run-time
library, and the contents of a dynamic descriptor data structure -- once
initialized -- can only be modified under control of run-time library
routines.  The dynamic storage referenced by the dynamic descriptor is
allocated and maintained by the run-time library routines.  Various
OpenVMS routines do alter the contents of the descriptor data structure,
changing the value for the amount and the address of the storage associated
with the dynamic descriptor, as required.  Routines can obviously access
and alter the contents of the storage referenced by the descriptor.

OpenVMS languages that include support for strings or arrays are expected
to use descriptors for the particular structure.  Most OpenVMS languages,
such as Fortran and BASIC, use descriptors entirely transparently.  Some, 
like DEC C, require the programmer to explicitly create and maintain the

For further information on string descriptors, see the _OpenVMS Programming
Concepts_ manual, part of the OpenVMS documentation set.

					[Stephen Hoffman]

Fortran defaults to passing integers by reference and characters by
descriptor.  The following sites discuss mixing Fortran and C source
code in the same application:
                                        [Arne Vajhoej]

PROG14.  How many bytes are in a disk block?

A disk block is the minimum unit of disk storage allocation in OpenVMS.

Under OpenVMS VAX and OpenVMS Alpha, the disk volume block size is
consistent, with each block containing 512 bytes.

The minimum disk allocation granularity actually permissible (in the
ODS-2 and ODS-5 volume structures commonly used on OpenVMS) is determined
on a per-volume basis, and is typically based on a combination of the
total number blocks on the disk volume and the total size of the volume
storage bitmap.  The allocation granularity is known as the volume cluster
factor -- the cluster factor is the number of blocks in a disk cluster,
and it is the smallest number of blocks that can be allocated on a
particular disk volume.

Prior to OpenVMS V7.2, the  maximum permissible size of the bitmap
requires larger cluster factors as volume sizes increase.  Starting
with V7.2, the bitmap can be larger, and cluster factors as small as
one block can be used.

The number of bytes in a file can be determined by multiplying the
number of blocks allocated for the file times the number of bytes in
a block.  For sequential files (only), the FFB (XAB$W_FFB, in the
File Header XAB) value can be used to find out how much of the last
(XAB$L_EBK) block is used.  FFB and EBK are meaningful only for
sequential files, and only in a limited context -- partial block
allocations are not permitted.  For other file formats, the EOF marker
is not meaningful.

Disk allocations always occur only in units of the cluster factors,
which can be from one block up to (potentially) clusters of eighteen
blocks or more, depending on the volume cluster factor.

OpenVMS assumes that the device driver and the underlying storage device
will present the file system with addressable units of storage of 512
bytes in size, or the appearance of same.  Various third-party CD-ROM
devices, for instance, support only 2048 byte blocks, and such devices
are incompatible with the standard OpenVMS device drivers.

To determine the number of bytes required for a file from DCL, one
option uses the f$file_attributes item EOF, multiplied by the size
of a block in bytes (512).  This does not account for the unused
space in the last block of a sequential file, but it also does not
have to differentiate sequential files from other files.

					[Stephen Hoffman]

PROG15. How many bytes are in a memory page?

A memory page is the minimum unit of memory allocation in OpenVMS.
With OpenVMS VAX, the memory page size matches the disk block size:
it is always 512 bytes.

With OpenVMS Alpha, the memory page size is variable, and it can range
from 8192 bytes (8 kilobytes) up to 64 kilobytes.  The current system
page size can be determined using the sys$getsyi or f$getsyi PAGE_SIZE
item.  Programs with hardcoded constants for the memory page size (or
page alignment) should always assume a page size of 64 kilobytes.

On OpenVMS Alpha, a 512 byte area of memory -- equivilent in size to
an OpenVMS VAX memory page -- is refered to as a pagelet.

					[Stephen Hoffman]

PROG16. How do I create a process under another username?

Many server processes can operate within the context of the target user
using privileges, using calls such as sys$chkpro and (more commonly in
this context) sys$check_access as needed to determine if access would be
permitted for the specified user within the current security model.

With OpenVMS V6.2 and later, the persona system services (SYS$PERSONA_*)
can be used to assume the persona of the specified user -- these allow the
server to operate as the specified user, in a controlled fashion.  The
persona services can be used as a "wrapper" around a sys$creprc process
creation call, as well -- this will create a seperate process entirely
under the assumed persona.

Information on the persona system services is included in the OpenVMS
V6.2 new features documentation, and in the OpenVMS V7.1 and later system
services documentation.  These system services exist and are supported in
OpenVMS V6.2 and later releases.

Typical mechanisms for creating a process under another username include:

    o personna services around a sys$creprc call.  See above.
    o via DECnet task-to-task, using explicit specification of
      username and password, or using a DECnet proxy.
      This creates a network-mode job under the target user.
      The network-mode job might do little more than a RUN/DETACH
      of an image passed in via task-to-task -- task-to-task
      communications are fully available using strictly DCL-to-DCL
      processing, or using a compiled language and DCL, etc.)
    o SUBMIT/USER, or the username argument on the sys$sndjbc call.
      This creates a batch-mode job under the specified username.
      The batch-mode job might do little more than a RUN/DETACH
      of an image passed in via a parameter.
    o the UIC argument on the sys$creprc call.
      This mimics the UIC of the target user, and is certainly not
      the prefered mechanism for this task.
    o Via pseudo-terminals...

There are likely a few other mechanisms around...  There are various tools
available from DECUS and other sources that allow various forms of user
impersonation, as well.  These tools will require version-dependent kernel
code and enhanced privileges for some of (or all of) their operations.

					[Stephen Hoffman]

PROG17.  Why do lib$spawn, lib$set_symbol fail in detached processes?

The processing within run-time library (RTL) calls such as lib$attach,
lib$disable_ctrl, lib$do_command, lib$enable_ctrl, lib$get_symbol,
lib$run_program, lib$set_symbol, lib$set_logical, and lib$spawn, is
dependent on and requires the presence of a command language interpreter
(CLI), such as DCL.  Without a CLI present in the current process, these
calls will fail with a "NOCLI, no CLI present to perform function" error.

Detached processes typically do not have a CLI present.

In place of lib$spawn, sys$creprc can often be used.  The context of the
parent process (symbols and logical names) will not be propogated into
the subprocess when sys$creprc is used, though when there is no CLI
present in the process this (lack of) propogation is moot.

To create a detached process with a CLI, you must specify LOGINOUT as the
target image as discussed elsewhere in the FAQ, or only use these calls
(and any other calls requiring a CLI) from images that are running in an
"interactive", "batch", or "other" mode process.

					[Stephen Hoffman]

Also note that the lib$spawn and the C system call will fail in a CAPTIVE
login environment.  The lib$spawn call can be gotten to work in this
environment with the specification of the TRUSTED flag.  

PROG18.  Where can I obtain Bliss, and the libraries and supporting files?

The Bliss language compilers and documentation are available
on the OpenVMS Freeware distributions.

Bliss language source code that contains the following statement:


or similar requires the presence of the Bliss libraries.  These
libraries are created on the target system using the Bliss require
files, and are built using the following Bliss commands:

  STARLET.L32 contains the public interfaces to OpenVMS:


  LIB.L32 contains both the public and private interfaces to OpenVMS:


  The equivilent files for Bliss64 are created with:


Some Bliss code may also require the OpenVMS VAX architecture flags.
The following is the equivilent of the Alpha ARCH_DEFS.BLI module:

  ! This is the OpenVMS VAX version of ARCH_DEFS.BLI, and
  ! contains the architectural definitions for conditionally
  ! compiling OpenVMS Bliss sources for use on VAX systems.

  MACRO VAX =                     ! = 1 if compiled BLISS/VAX
          %BLISS(BLISS32V)%;      ! = 0 if not compiled BLISS/VAX

  MACRO EVAX =                    ! = 1 if compiled BLISS/E*
  ! A more appropriate definition can only be used with versions
  ! of the Bliss compilers that understand the 32E/64E flags.
  !       %BLISS(BLISS32E) OR %BLISS(BLISS64E)%; ! = 0 if compiled /VAX
          NOT %BLISS(BLISS32V)%;  ! = 0 if compiled /VAX

          %BPADDR%;               ! = 32 or 64 based on compiler used

					[Stephen Hoffman]

PROG19. How can I open a file for shared access?

  When creating a file, it is often useful to allow other
  applications and utilities -- such as TYPE -- to share
  read access to the file.  This permits you to examine the
  contents of a log file, for instance.

  A C source example that demonstrates how to do this is
  available in topic (2867) in the OpenVMS Ask The Wizard

  Depending on the environment, you may need to use C calls
  such as fsync and fflush, and -- in specific cases -- the
  setvbuf(_IONBF) call.

					[Stephen Hoffman]

PROG20. How can I have common sources for messages, constants?

  Use the GNM tools on the OpenVMS Freeware to have common sources
  for MSG (message) files and SDML (Document) documentation files.
  Use the DOCUMENT command to convert the SDML documentation into
  the necessary formats (Text, Postscript, HTML, etc).  Use the
  MESSAGE/SDL tool (latent in OpenVMS) to create an SDL file based 
  on the messages.  Then use the SDL tool (available on the OpenVMS 
  Freeware) to convert the SDL file into language-specific definitions.
  (There is also a converter around to convert SDL into SDML, if you 
  want to get pictures of the data structures for your documentation.)

PROG21. How do I activate the OpenVMS Debugger from an application?

#include <lib$routines.h>
#include <ssdef.h>
#include <string.h>

    char ascic_debug_commands[128];
    char *dbgcmd = "*show calls;go;exit";

    strcpy( ascic_debug_commands, dbgcmd );
    ascic_debug_commands[0] = (char) strlen( dbgcmd ) - 1;


    return 1;

PROG22.   Dealing with Endian-ness?

  OpenVMS on VAX, OpenVMS on Alpha and OpenVMS on Intel IA-64 platforms
  (as well as all Microsoft Windows implementations and platforms) all
  support and all use the little-endian byte ordering.  Certain Alpha
  microprocessors and Certain Intel Itanium processors can be configured
  to operate in big-endian mode.

  With little-endian byte order, the least significant byte is always
  the first byte; the byte at the lowest address.  With big-endian
  byte ordering, the byte storage order in memory is dependent on the 
  size of the data (byte, word, longword) that is being referenced.

  Endian-ness is a problem has been solved many times before.  Some of
  the typical solutions include htonl/htons and ntohl/ntohs in the
  standard C library and the TCP/IP Services XDR (eXternal Data
  Representation) libraries.  One of the more recently introduced network
  formats, and one that is seeing extensive press and marketing coverage,
  is XML.

PROG23.   How to resolve LINK-I-DATMISCH errors?

  The message LINK-I-DATMISCH is informational, and indicates that the
  version of the specified shareable image found in the system shareable
  image directory does not match the version of the shareable image that
  was originally loaded into IMAGELIB.OLB, one of the OpenVMS libraries
  typically searched by the LINKER.

  From a privileged username, you can usually completely repair this via
  the following DCL command:


  This command assumes that the shareable image that was found in the
  SYS$SHARE: area is valid and upward-compatiable, and that the image
  has simply replaced an older version without also updating IMAGELIB.

[End of Part 3/5]

 --------------------------- pure personal opinion ---------------------------
   Hoff (Stephen) Hoffman   OpenVMS Engineering

Inferno Solutions
Hosting by

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру