home *** CD-ROM | disk | FTP | other *** search
/ ftp.pasteur.org/FAQ/ / ftp-pasteur-org-FAQ.zip / FAQ / dec-faq / vms / part3 < prev    next >
Encoding:
Text File  |  2001-10-03  |  82.9 KB  |  1,914 lines

  1. Path: senator-bedfellow.mit.edu!bloom-beacon.mit.edu!newsfeed.stanford.edu!paloalto-snf1.gtei.net!news.gtei.net!news.compaq.com!news.cpqcorp.net!not-for-mail
  2. Newsgroups: comp.os.vms,comp.sys.dec,vmsnet.alpha,vmsnet.misc,comp.answers,news.answers
  3. Distribution: world
  4. X-Newsreader: mxrn 6.18-32B
  5. References: <92irts$f4j$1@mailint03.im.hou.compaq.com> <qmqu7.958$YP.25685@news.cpqcorp.net>
  6. From: hoffman@xdelta.zko.dec.nospam (Hoff Hoffman)
  7. Reply-To: hoffman@xdelta.zko.dec.nospam
  8. Followup-To: poster
  9. Approved: news-answers-request@mit.edu
  10. Expires: 2 Dec 2001 00:00:00 GMT
  11. Subject: OpenVMS Frequently Asked Questions (FAQ), Part 3/5
  12. Summary: This posting contains answers to frequently asked questions about
  13.         the OpenVMS operating system from Compaq Computer Corporation, and
  14.         the computer systems on which it runs.
  15. Lines: 1892
  16. Message-ID: <8oqu7.959$YP.25678@news.cpqcorp.net>
  17. Date: Tue, 02 Oct 2001 21:32:52 GMT
  18. NNTP-Posting-Host: 16.32.80.251
  19. X-Complaints-To: abuse@Compaq.com
  20. X-Trace: news.cpqcorp.net 1002058372 16.32.80.251 (Tue, 02 Oct 2001 14:32:52 PDT)
  21. NNTP-Posting-Date: Tue, 02 Oct 2001 14:32:52 PDT
  22. Organization: Compaq Computer Corporation
  23. Xref: senator-bedfellow.mit.edu comp.os.vms:311563 comp.sys.dec:89398 vmsnet.alpha:11483 vmsnet.misc:6281 comp.answers:47272 news.answers:216435
  24.  
  25. Archive-name: dec-faq/vms/part3
  26. Posting-Frequency: quarterly
  27. Last-modified: 2 Oct 2001
  28. Version: VMS-FAQ-3.TXT(7)
  29.  
  30. This is the OpenVMS Frequently Asked Questions Part 3/5. 
  31. Please see Part 1/5 for administrivia, indexing, archiving, etc.
  32.  
  33.  
  34. ------------------------------------------------------------
  35. MGMT60. Changing the OpenVMS Version Number?
  36.  
  37.   Fool your friends, baffle your enemies, run the OpenVMS version of
  38.   your choice!
  39.  
  40.   OpenVMS Alpha:
  41.     $ SET DEFAULT SYS$COMMON:[SYS$LDR]
  42.     $ RUN SYSVER
  43.     REPLACE V9.9
  44.     WRITE
  45.     $ EXIT
  46.  
  47.   OpenVMS VAX:
  48.     $ set default SYS$COMMON:[SYS$LDR]
  49.     $ copy SYS.EXE SYS.EXE_IN-CASE-I-FAIL
  50.     $ patch SYS.EXE
  51.     define sys$gq_version=800044b8
  52.     set mode ascii
  53.     !examine sys$gq_version
  54.     !examine sys$gq_version+4
  55.     deposit sys$gq_version   = "V9.9"
  56.     deposit sys$gq_version+4 = "    "
  57.     update
  58.     exit
  59.     $ Exit
  60.  
  61.   Then reboot the system at your leisure.
  62.  
  63. ------------------------------------------------------------
  64. MGMT61. Explain disk (or tape) allocation class settings?
  65.  
  66.   The allocation class mechanism provides the system manager with a way 
  67.   to configure and resolve served and direct paths to storage devices 
  68.   within a cluster.  Any served device that provides multiple paths 
  69.   should be configured using a non-zero allocation class, either at the 
  70.   MSCP (or TMSCP) storage controllers, at the port (for port allocation
  71.   classes), or at the OpenVMS MSCP (or TMSCP) server.  All controllers
  72.   or servers providing a path to the same device should have the same
  73.   allocation class (at the port, controller, or server level).
  74.  
  75.   Each disk (or tape) unit number used within a non-zero disk (or tape) 
  76.   allocation class must be unique, regardless of the particular device 
  77.   prefix.  For the purposes of multi-path device path determination, any 
  78.   disk (or tape) device with the same unit number and the same disk (or
  79.   tape) allocation class configuration is assumed to be the same device.
  80.  
  81.   If you are reconfiguring disk device allocation classes, you will want 
  82.   to avoid the use of allocation class one ($1$) until/unless you have 
  83.   Fibre Channel storage configured.  (Fibre Channel storage specifically 
  84.   requires the use of allocation class $1$.  eg: $1$DGA0:.)
  85.  
  86. ------------------------------------------------------------
  87. MGMT62. How to prevent users from choosing obvious passwords?
  88.  
  89.   To prevent users from selecting obvious passwords on OpenVMS, you
  90.   will want to use the reserved password (password screening) mechanism.
  91.   Effectively, you merge your list of reserved passwords into the
  92.   existing reserved words database maintained by OpenVMS.  (You can
  93.   also then require all users to reset their passwords -- via the
  94.   pre-expired password mechanism -- thus forcing users to select new
  95.   passwords.)  For details on the password screening mechanism, of the
  96.   reserved password database (VMS$PASSWORD_DICTIONARY.DATA), and details
  97.   of how to merge your list of prohibited passwords into the database,
  98.   please see the associated chapter in the OpenVMS security manual.
  99.   For details of the password expiration mechanism, see the AUTHORIZE
  100.   command qualifier /PWDEXPIRED.
  101.  
  102.   You can also implement a site-specific password filter with the
  103.   information provided in the back of the OpenVMS Programming Concepts
  104.   manual.  The password filter permits you to establish particular
  105.   and site-specific password requirements.  For details, please see
  106.   the system parameter LOAD_PWD_POLICY and the programming concepts
  107.   manual, and see the examples in SYS$EXAMPLES:.  (Examples and
  108.   documentation on V7.3 and later reflect both platforms, the examples
  109.   are found only on OpenVMS VAX kits on earlier releases.  The
  110.   capabilities have existed on both the VAX and Alpha platforms for
  111.   some time now.)
  112.  
  113.   To verify current passwords, you can also use a technique known to
  114.   system crackers as the "dictionary attack" -- the mechanism that makes
  115.   this attack somewhat more difficult on OpenVMS is the hashing scheme
  116.   used on OpenVMS, and the file protections used for the SYSUAF
  117.   authorization database.  Given a dictionary of words and the
  118.   unprotected contents of the SYSUAF file, a search for obvious
  119.   passwords can be performed.  Interestingly, a "dictionary attack"
  120.   also has the unfortunate side-effect of exposing the password to
  121.   the user -- while this is clearly the goal of a system cracker,
  122.   authorized privileged and non-privileged system users should not
  123.   know nor have access to the (cleartext) passwords of other users.
  124.  
  125.   Accordingly, OpenVMS does not store the cleartest password.  Further,
  126.   OpenVMS uses a password hashing algorithm, not an encryption algorithm.
  127.   This means that storage of a cleartext password is deliberated avoided,
  128.   and the cleartext value is deliberately very difficult to obtain.
  129.   The hash is based on a Purdy Polynomial, and the hash itself
  130.   includes user-specific values in addition to the password, values
  131.   that make the results of the password hash unique to each user.
  132.  
  133.   Regardless of the use of a password hashing scheme, if a copy of
  134.   your password file should become available to a system cracker, you
  135.   will want to force all users to use new passwords immediately.
  136.  
  137.   If you should require a user to verify a password, use the username,
  138.   the user's salt value (this value is acquired via $getuai) and the
  139.   user's specified cleartext password, and compare the resulting hashed
  140.   value (using a call to $hash_password) against the saved hashed password
  141.   value (this value also acquired via $getqui).  For reasons of security,
  142.   avoid saving a cleartext password value in any data files, and do not
  143.   maintain the cleartext password in memory longer than required.
  144.  
  145.   Kerberos authentication (client and server) is available on OpenVMS
  146.   V7.3 and later.  Integration of Kerberos support into various Compaq
  147.   and into third-party products is expected.
  148.  
  149.   If you are simply looking for OpenVMS access and the SYSTEM and all
  150.   other privileged passwords are forgotten or otherwise unavailable,
  151.   please see section MGMT5 and/or the OpenVMS documentation set.
  152.  
  153.   Also please see the C2 guidelines in the OpenVMS security manual.
  154.  
  155. ------------------------------------------------------------
  156. MGMT63. Volume Shadowing MiniCopy vs MiniMerge?
  157.  
  158. Mini-Merges have been supported for many years on VMS, as long as you
  159. had MSCP controllers (i.e. HSC, HSJ, or HSD) which supported the
  160. Volume Shadowing Assist called 'Write History Logging'.
  161.  
  162. If you want mini-merges on HSG80 (Fibre Channel) controllers, the
  163. latest info I've seen (the "Fibre Channel in a Disaster-Tolerant
  164. OpenVMS Cluster System" whitepaper at
  165. http://www.openvms.compaq.com/openvms/fibre/fc_hbvs_dtc_wp.pdf)
  166. indicates that this will require ACS 8.7 and VMS 7.3-1, assuming
  167. things go according to plan.
  168.  
  169. Since there have already been responses in this thread referring to
  170. the Mini-Copy capability, and I don't know if you really meant
  171. Mini-Merge or Mini-Copy, it might be helpful to describe the
  172. difference between Mini-Merge and Mini-Copy.
  173.  
  174. A Shadowing Full Copy occurs when you add a disk to an existing
  175. shadowset using a MOUNT command; the entire contents of the disk are
  176. effectively copied to the new member (using an algorithm that goes
  177. through in 127-block increments and reads one member, compares with
  178. the target disk, and if the data differs, writes the data to the
  179. target disk and loops back to the read step, until the data is equal
  180. for that 127-block section).
  181.  
  182. If you warn VMS ahead of time (at dismount time) that you're planning
  183. to remove a disk from a shadowset but re-add it later, VMS will keep a
  184. bit-map tracking what areas of the disk have been modified while the
  185. disk was out of the shadowset, and when you re-add it later with a
  186. MOUNT command VMS only has to update the areas of the returned disk
  187. that the bit-map indicates are now out-of-date.  VMS does this with a
  188. read source / write target algorithm, which is much faster than the
  189. shenanigans the Full Copy does, so even if 100% of the disk has
  190. changed, a Mini-Copy is faster than a Full Copy.
  191.  
  192. A Shadowing Merge is initiated when a VMS node in the cluster (which
  193. had a shadowset mounted) crashes or otherwise leaves unexpectedly,
  194. without dismounting the shadowset first.  In this case, VMS must
  195. ensure that the data is identical, since Shadowing guarantees that the
  196. data on the disks in a shadowset will be identical.  In a regular
  197. Merge operation, Shadowing uses an algorithm similar to the Full Copy
  198. algorithm (except that it can choose either of the members' contents
  199. as the source data, since both are considered equally valid), and
  200. scans the entire disk.  Also, to make things worse, for any read
  201. operations in the area ahead of what has been merged, Shadowing will
  202. first merge the area containing the read data, then allow the read to
  203. occur.
  204.  
  205. A Merge can be very time-consuming and very I/O intensive, so some
  206. controllers have Shadowing Assists to make it faster.  If the
  207. controllers support Write History Logging, the controllers record the
  208. areas (LBNs) that are the subject of Shadowing writes, and if a node
  209. crashes, the surviving nodes can query the controllers to find out
  210. what exact areas of the disk the departed node was writing to just
  211. before the crash, and thus Shadowing only needs to merge just those
  212. few areas, so this tends to take seconds as opposed to hours for a
  213. regular Merge.
  214.                                          [Keith Parris]
  215.  
  216. ------------------------------------------------------------
  217. MGMT64. Why is BACKUP not working as expected?
  218.  
  219.   First, PLEASE READ THE BACKUP MANUAL.
  220.  
  221.   Second, PLEASE GET THE CURRENT BACKUP ECO KIT.
  222.  
  223.   BACKUP has a very complex interface, and there are numerous command
  224.   examples and extensive user documentation available.  For a simpler
  225.   user interface for BACKUP, please see the documentation for the
  226.   BACKUP$MANAGER tool.
  227.  
  228.   As for recent BACKUP changes, oddities, bugs, etc:
  229.  
  230.   o A change made in OpenVMS V6.2 WILL cause more files to be included into
  231.     a file-based BACKUP saveset using /SINCE=BACKUP as all files underneath
  232.     any directory with a sufficiently recent (selected) date will be included
  233.     in the saveset.  This change was deliberate and intentional, and was
  234.     mandated by the need to provide a functional incremental restoration.
  235.  
  236.     Without the inclusion of these apparently-extra files, an incremental
  237.     saveset can NOT be reliably restored.
  238.  
  239.   o As part of the OpenVMS V6.2 change, the /SINCE command -- without the
  240.     specification of the =BACKUP keyword -- selected more files than it
  241.     should have.  This is a bug.  This bug has been remedied  in the
  242.     OpenVMS BACKUP source code and in some of (all of?) the BACKUP ECO kits.
  243.  
  244.   When working with BACKUP, you will want to:
  245.  
  246.   o Get the current BACKUP ECO kit and install it BEFORE you attempt to
  247.     troubleshoot any problems.
  248.  
  249.   o Learn about the /NOINCREMENTAL (new) and /NOALIAS (V6.2 and later)
  250.     command qualifiers.  The former qualifier returns to the pre-V6.2
  251.     behaviour of the /SINCE file selection mechanism, while the latter
  252.     (specified with /IMAGE) reduces the replication of files on system
  253.     disks and other disks with file alias and directory alias entries.
  254.     Both of these can reduce the numbers of files that will be selected
  255.     and thus included into the saveset.
  256.  
  257.   When working with the BACKUP callable API:
  258.  
  259.   o Build your applications with the most current BACKUP API available.
  260.     Changes made to the V7.1-2 and V7.2 API were incompatible with the
  261.     V7.1 and V7.2-1 and later APIs, and this incompatibility was
  262.     repaired via a BACKUP ECO kit.  Do NOT build your application with
  263.     the versions of the BACKUP API that shipped with V7.1-2 and V7.2,
  264.     as these are incompatible with the BACKUP API constants that were
  265.     used on other versions.
  266.  
  267.    
  268. ------------------------------------------------------------
  269. MAIL1.  How do I send Internet mail?
  270.  
  271. The simplest answer on most OpenVMS V6.2 and later systems: just enter the 
  272. Internet (SMTP) address at the "to" prompt in MAIL.  On most such systems,
  273. this will send your email to the specified recipient.
  274.  
  275. That said, there is no one answer to this question.  Internet mail is built 
  276. upon the TCP/IP protocols, which are not directly supported by OpenVMS -- 
  277. support requires the installation of a package that understands TCP/IP and 
  278. specifically one that provides the Simple Mail Transport Protocol (SMTP). 
  279.  
  280. A number of implementations of TCP/IP are available for OpenVMS -- from Compaq, 
  281. from third parties, and even a free "support it yourself" form.   The MAIL
  282. program  that comes with OpenVMS does not directly support the mail protocol
  283. used on the  Internet (though it does recognize SMTP addresses in V6.2 and
  284. later), but various  programs have been written that use MAIL's "foreign
  285. protocol" facility to provide  such support -- these tools are called
  286. transports.  To send mail through a transport,  place the transport specifier
  287. at the front, and (typically) quote the address.  
  288.  
  289. For example, IN%"hoffman@bogushost.compaq.com" -- you *must* include the
  290. quotation  marks -- indicates that IN transport will be used to send the mail
  291. to the address  hoffman@bogushost.compaq.com.  Common names for the transport
  292. are IN%, MX%, and SMTP%. (MX is a widely used, free, mail handler; see question 
  293. SOFT1.  SMTP% is used by  Compaq's TCP/IP Services product.)  Other systems may
  294. use some other name.  If none  of these prefixes work, please ask your system
  295. manager for assistance.
  296.                     [leichter@lrw.com]
  297.                     [Stephen Hoffman]
  298.  
  299. See also MAIL2.
  300.  
  301. ------------------------------------------------------------
  302. MAIL2.  How do I get IN% or MX% added automatically to Internet addresses?
  303.  
  304. For older OpenVMS releases, you can acquire the MAILSHR_PATCH package
  305. (there's one each for VAX and Alpha) from the WKU FILESERV server 
  306. (see question SOFT1.).
  307.  
  308. As of OpenVMS V6.2, this is not necessary -- simply enter the SMTP email
  309. address directly.  If the address specified to MAIL contains an embeded "@"
  310. character in it (a quoted string is not needed), MAIL will look to see if 
  311. the logical name MAIL$INTERNET_TRANSPORT is defined.  If it is, then MAIL
  312. will use the translation as the transport protocol, otherwise it will use 
  313. the SMTP transport as is used by TCP/IP Services for OpenVMS.  
  314.  
  315. To alter this, for example, if you wanted IN% added, you'd define 
  316. MAIL$INTERNET_TRANSPORT as "IN".
  317.  
  318. ------------------------------------------------------------
  319. MAIL3.  How do I automatically append a signature file to my mail messages?
  320.  
  321. OpenVMS 7.0 adds the ability to automatically append signature files - in
  322. MAIL, use the SET SIGNATURE command to specify a signature file name.
  323. For earlier versions, see the following paragraphs.
  324.  
  325. The basic MAIL utility which is shipped with VMS does not have an intrinsic
  326. mechanism for adding signature files.  If you're using an enhanced mail
  327. handling package (e.g PMDF), however, it may have provisions for adding
  328. signature files to all messages it handles - check the documentation for
  329. details.  In addition, it's common practice to use an editor to handle
  330. addition of `quotation marks' (e.g. >) and signature files to mail messages
  331. and news postings.  There are several implementations of this for different
  332. editors available on the net; for one example, see the MAIL_EDIT package.
  333.   ftp://ftp.process.com/vms-freeware/narnia/
  334.  
  335.                     [bailey@genetics.upenn.edu]
  336.  
  337. Define the logical MAIL$EDIT to a COM-file, which looks something like
  338. the following:
  339.  
  340. $ IF P1 .NES. ""
  341. $ THEN
  342. $    COPY 'P1',<signaturefile> 'P2'
  343. $ ELSE
  344. $    COPY <signaturefile> 'P2'
  345. $ ENDIF
  346. $ DEFINE/NOLOG SYS$INPUT SYS$COMMAND
  347. $ <editorname> 'P2'
  348. $ EXIT
  349.  
  350. Where <signaturefile> is the name of the signature-file (including directory
  351. and disk) and <editorname> is EDIT/EDT or EDIT/TPU (or your favorite editor).
  352.                     [Arne Vajh°j]
  353.  
  354. ------------------------------------------------------------
  355. MAIL4.  Do I have to use VMS MAIL?  I like my Unix mailer better.
  356.  
  357. Several Unix mailers have been ported to VMS, some by the vendors of specific
  358. TCP/IP packages, some by users who have made them freely available.  See the
  359. documentation for your TCP/IP package, and refer to question SOFT1 for
  360. information about the availability of the free ports.
  361.                     [Jerry Leichter]
  362.  
  363. ------------------------------------------------------------
  364. MAIL5.  How can I forward my mail?  Can I forward it to an Internet address?
  365.  
  366. You can use the SET FORWARD command within MAIL to specify where you want all
  367. your mail forwarded to.  Use SHOW FORWARD to see your current forwarding.  To
  368. cancel all forwarding, type SET NOFORWARD.
  369.  
  370. You can forward your mail to an Internet address, but you have to be careful
  371. because of the way MAIL handles special characters, such as quotation marks.
  372. First, determine the address you would use to send mail to the place you want
  373. to forward to - say, IN%"fred@fred-host.xxx.com".  Take that string and
  374. *double all the quotation marks*, producing IN%""fred@fred-host.xxx.com"".
  375. Finally, wrap quotation marks around the outside and use the the result with
  376. SET FORWARD:
  377.  
  378.     MAIL>SET FORWARD "IN%""fred@fred-host.xxx.com"""
  379.  
  380. If you do SHOW FORWARD, you should now see:
  381.  
  382.     Your mail is being forwarded to IN%"fred@fred-host.xxx.com".
  383.                     [leichter@lrw.com]
  384.  
  385. Note that the MAIL$INTERNET_TRANSPORT feature doesn't yet work with
  386. SET FORWARD in that you'll still have to use the syntax above with the
  387. quotation marks.
  388.  
  389. ------------------------------------------------------------
  390. MAIL6.  How can I forward my mail to a list of addresses?
  391.  
  392. VMS MAIL does not support forwarding a message to more than one address.
  393. (Older versions of MAIL allowed you to specify such forwarding, but it never
  394. worked correctly.)
  395.  
  396. Many of the TCP/IP mail packages support forwarding to mailing lists, as does
  397. the free MX mail handling system and the DELIVER mail "extender".  See the
  398. documentation of your TCP/IP package and question SOFT1.
  399.                     [leichter@lrw.com]
  400.  
  401. ------------------------------------------------------------
  402. MAIL7.  MAIL keeps saying I have new messages, but I don't.  What do I do?
  403.  
  404. The count of new mail messages is kept separately from your mail folder
  405. in SYS$SYSTEM:VMSMAIL_PROFILE.DATA.  It sometimes happens that this count
  406. differs from what's in your mail folder.  If this happens, go into MAIL
  407. and repeat the READ/NEW command until you see no new mail messages.  Then
  408. enter the command one more time.  This will resynchronize the counters.
  409.  
  410. ------------------------------------------------------------
  411. MAIL8.  How do I move all of my mail messages to another system?
  412.  
  413. If you are moving to another OpenVMS system, perhaps the best way is to select
  414. each folder and do (in MAIL) a:
  415.  
  416.     EXTRACT/APPEND/ALL/MAIL mymail.mai
  417.  
  418. Move MYMAIL.MAI to the other system, then do this (in MAIL):
  419.  
  420.     SET FILE mymail.mai
  421.     COPY/ALL foldername MAIL.MAI
  422.  
  423. This will place a copy of all of your messages in the given folder.  If
  424. you wanted to maintain the separate folders, do separate EXTRACT commands
  425. (above) specifying different .mai files, then repeat the SET FILE, COPY
  426. for each one.
  427.  
  428. If you are moving to a non-OpenVMS system, the EXTRACT command above can
  429. be used to create a file which you can then copy - how you import it into
  430. your mailer is an exercise left to the reader.
  431.  
  432. ------------------------------------------------------------
  433. MAIL9.  How do I send or read attachments in VMS MAIL?
  434.  
  435. Is there any way to send or read mail with files as attachments from VMS?
  436.  
  437. Not directly with the OpenVMS MAIL facility, but there are several 
  438. other options:
  439.  
  440. 1. Install PINE, available commercially from Innosoft or free from Andy 
  441.    Harper.  With PINE you can both send and receive MIME messages, if 
  442.    you have the appropriate viewers available.
  443.      http://www.innosoft.com/
  444.      http://www.agh.cc.kcl.ac.uk/files/vms/pine-vms/
  445.      ftp://ftp2.kcl.ac.uk/pub/vms/pine-vms/
  446.  
  447. 2. If you're working from an X11 server use the OpenVMS version of Netscape
  448.    Navigator.  This option is ok for sending mail, but is not optimal for
  449.    reading it, since Netscape will use POP and remove messages entirely 
  450.    the OpenVMS MAIL system, which is not generally what you want.
  451.  
  452. 3. MPACK/MUNPACK.  To send a MIME mail, construct the message with
  453.    attachments manually using MPACK.  You cannot send the resulting file
  454.    directly through MAIL because an extra  blank header line will be
  455.    inserted between your message and the OpenVMS MAIL headers, which will
  456.    cause the message to appear as plain text in most mail programs.  Some
  457.    TCP/IP stacks provide a work around for this problem, and if that
  458.    doesn't work, you should generally be able to force the message directly
  459.    into the SMTP port of your mail machine.  Examples of both methods are
  460.    in: 
  461.      http://seqaxp.bio.caltech.edu/pub/SOFTWARE/mmail.com 
  462.  
  463.    To read a MIME mail message, open it in MAIL, extract it to a file, then
  464.    use MUNPACK to break out and decode the attachments.    
  465.  
  466.    MPACK/MUNPACK tools are also available on OpenVMS Freeware V5.0:
  467.       http://www.openvms.compaq.com/freeware/freeware50/mpack15/
  468.  
  469.                     [David Mathog]
  470.  
  471. 4. With OpenVMS V7.2 and later, use the supplied MIME tool.
  472.  
  473.  
  474. ------------------------------------------------------------
  475. MAIL10.  How can I block SMTP mail relay spam?
  476.  
  477.   Use the anti-spam capabilities present in the TCP/IP Services V5.1 
  478.   and later SMTP servers.
  479.  
  480.   Use a firewall.
  481.  
  482.   On earlier TCP/IP Services releases, some simple DCL can reportedly
  483.   prevent relay SMTP spam.  Use the UCX command SHOW SERVICE SMTP/FULL 
  484.   to find the directory containing the UCX$SMTP_RECV_STARTUP.COM file, 
  485.   and insert the following DCL:
  486.  
  487. $       !
  488. $       ! Block spam.
  489. $       !
  490. $       MY_ADDRESS_LONG[0,32]=F$INTEGER(F$TRNLNM("SYS$REM_NODE")-"::")
  491. $       MY_ADDRESS=F$FAO("!UB.!UB.!UB.!UB",F$CVUI(0,8,MY_ADDRESS_LONG),-
  492.          F$CVUI(8,8,MY_ADDRESS_LONG),F$CVUI(16,8,MY_ADDRESS_LONG),-
  493.          F$CVUI(24,8,MY_ADDRESS_LONG))'"
  494. $       MY_ADDRESS_REVERSE=F$FAO("!UB.!UB.!UB.!UB",-
  495.          F$CVUI(24,8,MY_ADDRESS_LONG),F$CVUI(16,8,MY_ADDRESS_LONG),-
  496.          F$CVUI(8,8,MY_ADDRESS_LONG),F$CVUI(0,8,MY_ADDRESS_LONG))'"
  497. $       WRITE SYS$OUTPUT F$TIME()+" "+F$TRNLNM("SYS$REM_NODE")+MY_ADDRESS
  498. $       UCX SHOW HOST 'MY_ADDRESS_REVERSE'.INPUTS.ORBS.ORG
  499. $       IF $STATUS.EQ.1
  500. $       THEN
  501. $         WRITE SYS$OUTPUT "SPAM from relay rejected"
  502. $         EXIT
  503. $       ENDIF
  504. $       UCX SHOW HOST 'MY_ADDRESS_REVERSE'.SPAMSOURCES.ORBS.ORG
  505. $       IF $STATUS.EQ.1
  506. $       THEN
  507. $         WRITE SYS$OUTPUT "SPAM source relay rejected"
  508. $         EXIT
  509. $       ENDIF
  510. $       !
  511. $       ! Run receiver.
  512. $       !
  513. $       run sys$system:ucx$smtp_receiver.exe
  514. $       goto exit
  515.  
  516.                                     [Henry Juengst]
  517.  
  518. ------------------------------------------------------------
  519. UTIL1.  How do I play an audio CD on my workstation?
  520.  
  521. If you've installed the DECwindows examples, you'll find
  522. DECW$CDPLAYER.C, .DAT, .EXE, .UIL, and .UID.  Copy the .UID and .DAT
  523. files to DECW$USER_DEFAULTS: (typically SYS$LOGIN:), define the logical name
  524. DECW$CD_PLAYER to be the device name of your CD-ROM drive (eg. DKA400:),
  525. give yourself PHY_IO and DIAGNOSE privileges, and run the .EXE.  (These
  526. privileges are required, as the access to the CD-related extensions will
  527. require the use of the privilege-protected IO$_DIAGNOSE I/O function code.)
  528. You can also install the image with these privileges.  See the source for
  529. additional details - note that the comments regarding the need for
  530. SYSGEN CONNECT are no longer applicable (at least as of VMS V5.5-2).
  531.  
  532. There's also SYS$EXAMPLES:CDROM_AUDIO.C and .EXE, a non-Motif program,
  533. available on OpenVMS VAX, and DECW$EXAMPLES:DECW$CDPLAYER.* on OpenVMS
  534. VAX and OpenVMS Alpha.
  535.  
  536. The standard OpenVMS IDE DQDRIVER does not support the necessary 
  537. IO$_DIAGNOSE function required for access to audio CD media (on OpenVMS 
  538. versions prior to V7.3), but an updated DQDRIVER device driver (source 
  539. code and all) with this capability and with the source code of an updated 
  540. CD audio player is available on the OpenVMS Freeware website 
  541. (www.openvms.compaq.com/freeware/dqdriver/), and these updates are also 
  542. expected to be included on Freeware V5.0 and later.
  543.  
  544. ------------------------------------------------------------
  545. UTIL2.  How do I access a MS-DOS floppy disk from OpenVMS?
  546.  
  547. The Compaq Advanced Server (formerly known as PATHWORKS) for OpenVMS 
  548. product includes an unsupported and undocumented utility called PCDISK,
  549. and this tool can read and write various MS-DOS format diskettes.
  550.  
  551. ProGIS in Germany sells a product called VMove which supports DOS files 
  552. on many different device types.  For more information, send mail to
  553. info@progis.de.
  554.  
  555. Engineering Software has a product called VAKSAT which will read, write,
  556. and erase files on DOS diskettes.  Available for both VAX and Alpha.
  557. Contact ed@cityscape.co.uk for more information.
  558.  
  559. MadGoat PC Exchange (PCX) is a utility for copying files to and from
  560. MS-DOS (FAT) format diskettes under VMS, using an RX23 (3.5"), RX26 
  561. (3.5"), or RX33 (5.25") diskette drive.  For 3.5" diskettes, high-density
  562. disks can be read or written; double-density disks are read-only. Only
  563. high-density disks are supported on the RX33.
  564.  
  565.   http://www.madgoat.com/
  566.  
  567. ------------------------------------------------------------
  568. UTIL3.  How do I play sound files on an AlphaStation?  DECsound doesn't work
  569.  
  570. The new AlphaStation systems use a different sound board (Microsoft Sound
  571. System) than the earlier DEC 3000 AXP systems, and DECsound, as supplied by
  572. DECwindows Motif, doesn't support this board.  Compaq offers an optional
  573. product, Multimedia Services for OpenVMS:
  574.  
  575.   http://www.compaq.com/info/spd/
  576.   
  577. which provides a replacement DECsound for this card as well as many other 
  578. features (an AVI and MPEG player, video capture support, etc.)
  579.  
  580. Ensoniq sound support is also available.
  581.  
  582. ------------------------------------------------------------
  583. UTIL4.  Why is DECmigrate not working with Fortran?
  584.  
  585. OTS-F-INDATCOR internal data corrupted in Run-time Library
  586.  
  587. This error can arise with Fortran programs if you are running a 
  588. recent version of OpenVMS Alpha, and are using DECmigrate to
  589. translate Fortran applications.  The DECmigrate Run-Time Library 
  590. attempts to support mixed translated-native I/O to the same unit 
  591. by sharing the native Fortran RTL's internal data structures, and
  592. in OpenVMS 7.2 these structures changed and the translated RTL
  593. was not updated accordingly.
  594.  
  595. You can copy DEC$FORRTL.EXE from OpenVMS 7.1, copying it to some 
  596. spare directory, and then defining the logical name DEC$FORRTL to 
  597. point to it before running your translated application.  Or rebuilding 
  598. the application to use the available native Fortran compiler.  Or
  599. you can apply the current Fortran RTL kit, which has a fix for this.
  600.  
  601. See SOFT13.
  602.                                     [Steve Lionel]
  603.  
  604. ------------------------------------------------------------
  605. UTIL5.  How do I read IBM EBCDIC tapes on OpenVMS?
  606.  
  607. IBM boxes can read ANSI-labeled ASCII magtapes.  Fixed-length records and
  608. the DCL COPY command can be used to transfer text files around.  Check the
  609. IBM documentation for details.
  610.  
  611. There exists various freeware around (TAPECOPY, ETAPE, TCOPY, MTEXCH) that 
  612. can read and write EBCDIC tapes.  Visit the DECUS website software archives
  613. search engine (via http://www.decus.org/), and search for "EBCDIC".
  614.                                     [Steve Hoffman]
  615.  
  616. One source for ETAPE is:
  617.  
  618.   http://www.ualr.edu/ftp/vms/ETAPE_SRC/
  619.  
  620. OpenVMS Freeware V5.0 is expected to include this tool.
  621.                                     [Fletcher Hearns]
  622.                                     [Dale Miller]
  623.  
  624. ------------------------------------------------------------
  625. UTIL6.  How can I patch an OpenVMS Alpha image?
  626.  
  627.   Using the OpenVMS Freeware tool ZAP:
  628.  
  629.     www.openvms.compaq.com/freeware/rms_tools/
  630.  
  631.   tell ZAP to read a block (bucket) of information based on the
  632.   virtual block number (VBN), using X for hexadecimal.  Dump
  633.   yourself into the OpenVMS debugger with R2 pointing into the 
  634.   buffer, EXAMINE/INSTRUCTION as needed, alter the buffer as
  635.   required, GO to get out of the debugger and back into ZAP, and
  636.   use the ZAP W command to write the updated block.
  637.  
  638.   OpenVMS Freeware V5.0 is expected to have an updated version
  639.   of the ZAP tool.
  640.  
  641.  
  642. ------------------------------------------------------------
  643. DCL1.   How do I run a program with arguments?
  644.  
  645. The RUN command does not accept arguments.  To pass arguments to a program,
  646. you must use what is called a "foreign command".  For example:
  647.  
  648.     $ unzip :== $disk:[dir]unzip.exe
  649.     $ unzip -?
  650.  
  651. The leading $ in the equivilence name for the symbol definition is what 
  652. makes the DCL symbol a foreign command. If the device and directory are
  653. omitted, SYS$SYSTEM: is assumed.
  654.  
  655. Under OpenVMS V6.2 and later, DCL supports automatic foreign command
  656. definition via the logical name DCL$PATH:.  An example of a definition 
  657. of this logical name is:
  658.  
  659.     $ DEFINE DCL$PATH SYS$DISK:[],ddcu:[mytooldir],SYS$SYSTEM:
  660.  
  661. DCL will first look for a command in the DCL command table, and if no match is
  662. found and if DCL$PATH is defined, it will then look for command procedures and
  663. executable images with filenames matching the command specified, in the
  664. directories specified via DCL$PATH.  The first match found is invoked, and
  665. under OpenVMS, the DCL$PATH support will cause a command procedure to be
  666. activated in preference to an executable image.
  667.  
  668. For more information on foreign commands or on automatic foreign command
  669. support, see the OpenVMS User's Manual.
  670.  
  671. See also question PROG2.
  672.  
  673. If you want to create a detached process that takes arguments from a command
  674. line, it must be run under the control of a command line interpreter (CLI)
  675. (typically DCL).  This is done by placing the command line in a file,
  676. specifying SYS$SYSTEM:LOGINOUT.EXE as the image to run and the command file as
  677. the input.  For example:
  678.  
  679.     $ OPEN/WRITE CMD TEMP_INPUT.COM
  680.     $ WRITE CMD "$ MYCOMMAND arguments"
  681.     $ CLOSE CMD
  682.     $ RUN/DETACHED SYS$SYSTEM:LOGINOUT /INPUT=TEMP_INPUT.COM
  683.  
  684. Various OpenVMS library calls (such as lib$spawn(), cli$dcl_parse(), and the C
  685. library system() call) require access to a command line interpreter such as
  686. DCL to perform requested actions, and will not operate if a CLI is not
  687. available.
  688.  
  689. When a CLI is not available, these calls typically return the error status
  690. SS$_NOCLI.  And as mentioned above, invoke the image LOGINOUT to cause a CLI
  691. (such as DCL) to be mapped into and made available in the context of the
  692. target process.
  693.  
  694. For examples of how TCP/IP Services sets up its foreign commands (which
  695. includes tools such as uuencode and uudecode), please see the DCL command
  696. procedure SYS$STARTUP:TCPIP$DEFINE_COMMANDS.COM.
  697.  
  698. Also see DCL11.
  699.                     [Stephen Hoffman]
  700.  
  701. ------------------------------------------------------------
  702. DCL2.   How can I redefine control keys in DCL?
  703.  
  704. The DCL DEFINE/KEY command allows you to define function and keypad
  705. keys, but not control keys.  Also, keys you define with DEFINE/KEY are
  706. not recognized inside applications.  Many applications which use the
  707. SMG$ routines for input have a similar DEFINE/KEY feature.
  708.  
  709. The terminal driver line-editing control keys, including the use of DEL
  710. for delete, are not modifiable.
  711.  
  712. ------------------------------------------------------------
  713. DCL3.   How can I clear the screen in DCL?
  714.  
  715. The simplest way is the TYPE/PAGE NLA0: command.
  716.  
  717. You can set up a symbol to clear the screen in your LOGIN.COM:
  718.  
  719. $ CLS :== TYPE/PAGE NLA0:
  720.  
  721. ------------------------------------------------------------
  722. DCL4.   Using REPLY/LOG from DCL?  Disabling Console OPCOMs?
  723.  
  724. Your terminal must be enabled as an operator terminal before the
  725. REPLY/LOG command can be used, but a DCL procedure (batch command
  726. file, system startup, etc) does not have an associated terminal.
  727. To make this work, use the following sequence to enable the OPA0: 
  728. console as the operator terminal, then the REPLY/LOG command will 
  729. be accepted:
  730.  
  731.   $ DEFINE/USER SYS$COMMAND _OPA0:
  732.   $ REPLY/LOG
  733.   $ DEFINE/USER SYS$COMMAND _OPA0:
  734.   $ REPLY/ENABLE
  735.  
  736. To disable the system console terminal (OPA0:) as an operator terminal, 
  737. use the following command:
  738.  
  739.   $ DEFINE/USER SYS$COMMAND _OPA0:
  740.   $ REPLY/DISABLE
  741.  
  742. Also see SYLOGICALS.COM (and SYLOGICALS.TEMPLATE) for information
  743. on configuring the behaviour of OPCOM, including the (default) use 
  744. of the system console (OPA0:) as an operator terminial and the 
  745. specific contents and behaviour of the system operator log file 
  746. OPERATOR.LOG.
  747.                         [Arne Vajh°j]
  748.                         [Stephen Hoffman]
  749.  
  750. ------------------------------------------------------------
  751. DCL5.   How do I generate a random number in DCL?
  752.  
  753. Here's my random number generator for inclusion into the OVMS FAQ;
  754. just do a GOSUB RAND and the global symbol RANDOM will contain a
  755. randomly generated number.  The user/programmer can feed the generator
  756. a ceiling value (__CEIL) or a new seed (__SEED).
  757.  
  758. $! RAND - returns a positive random number ("RANDOM") between 0 and 
  759. $!        __CEIL - 1.
  760. $ RAND:
  761. $
  762. $ IF F$TYPE(__SEED) .EQS. ""
  763. $ THEN
  764. $     ! seed the random number generator, ...
  765. $     __NOW = F$CVTIME()
  766. $     __HOUR = 'F$EXTRACT(11,2,__NOW)'
  767. $     __MINUTE = 'F$EXTRACT(14,2,__NOW)'
  768. $     __SECOND = 'F$EXTRACT(17,2,__NOW)'
  769. $     __TICK = 'F$EXTRACT(20,2,__NOW)'
  770. $
  771. $     __SEED == __TICK + (100 * __SECOND) + (6000 * __MINUTE) + -
  772.          (360000 * __HOUR)
  773. $     ! the generator tends to do better with a large, odd seed, ...
  774. $     __SEED == (__SEED .OR. 1)
  775. $     ! clean up, ...
  776. $     DELETEX/SYMBOL __NOW
  777. $     DELETEX/SYMBOL __HOUR
  778. $     DELETEX/SYMBOL __MINUTE
  779. $     DELETEX/SYMBOL __SECOND
  780. $     DELETEX/SYMBOL __TICK
  781. $ ENDIF
  782. $
  783. $ IF F$TYPE(__CEIL) .EQS. "" THEN __CEIL = %X3FFFFFFF
  784. $
  785. $ __SEED == __SEED * 69069 + 1
  786. $
  787. $ RANDOM == (__SEED.AND.%X3FFFFFFF)/(%X40000000/__CEIL)
  788. $
  789. $ RETURN
  790.                     [sharris@sdsdmvax.fb3.noaa.gov]
  791.  
  792. ------------------------------------------------------------
  793. DCL6.   What does the MCR command do?
  794.  
  795. The MCR command runs the specified image, with a default filespec of
  796. SYS$SYSTEM:.EXE, and passes any (optional) command line arguments in the
  797. same manner as a foreign command.  In other words:
  798.  
  799.     $ MCR FOO BAR
  800.  
  801. is equivalent to:
  802.  
  803.     $ FOO :== $FOO
  804.     $ FOO BAR
  805.  
  806. It derives from the RSX operating system from which VMS evolved and is
  807. still often used as a shortcut for activating images.  The MCR command is
  808. different from the MCR command line interpreter, which is provided as part
  809. of the optional VAX-11 RSX product that provides RSX emulation under VMS.
  810.  
  811. ------------------------------------------------------------
  812. DCL7.   How do I change the OpenVMS system prompt?
  813.  
  814. You can use the SET PROMPT command for this purpose.  SET PROMPT sets the DCL
  815. prompt to the specified string.
  816.  
  817. When you want to display variable information, you will need to establish a
  818. tie-in that provides the information to the SET PROMPT command as required.
  819.  
  820. If you wish to display the default directory for instance, you will have to
  821. establish a tie between the SET DEFAULT command and the SET PROMPT commands,
  822. as there is no direct way to get the default directory as the DCL prompt.  You
  823. can easily acquire or create a set of DCL command procedures that perform the
  824. SET DEFAULT and SET PROMPT for you.  These DCL command procedures often use a
  825. command such as:
  826.  
  827.   $ set prompt='f$env("default")'
  828.  
  829. More advanced users could implement a system service or other intercept, and
  830. use these tools to intercept the directory change and reset the prompt
  831. accordingly.  (This approach likely involves some kernel-mode programming, and
  832. requires write access to various undocumented OpenVMS data structures.)
  833.  
  834. There are related tools available from various sources, including the
  835. following web sites:
  836.  
  837.   o ftp://ftp.hhs.dk/pub/vms/setpmt/
  838.  
  839.   o ftp://ftp.tmesis.com/sys_service_hook.src
  840.  
  841.   o James F. Duff has also made available a Macro32 tool known as
  842.     TIME_PROMPT, a tool that sets the prompt to the current system time.
  843.  
  844.   o Many folks have contributed DCL procedures to perform this task.
  845.     Visit the newsgroup archives for information and examples.
  846.  
  847. Information in this section has been acquired from various postings that
  848. have discussed this topic in the comp.os.vms newsgroup in the past, and
  849. examples from Arne Vajhoej, Brian Schenkenberger, James Duff, and others.
  850.  
  851.                 [Stephen Hoffman]
  852.  
  853. ------------------------------------------------------------
  854. DCL8.   Can I do DECnet task-to-task communication with DCL?
  855.  
  856. Yes, you can do this with DCL.
  857.  
  858. The OpenVMS DECnet documentation shows various simple examples using the
  859. task object and the TYPE command to trigger the execution of a DCL command
  860. procedure on a remote node.  A slightly more advanced example of using DCL
  861. for DECnet task-to-task -- a procedure that acts as both the client and as
  862. the server as appropriate, and that uses a basic form of half-duplex
  863. communications -- is included:
  864.  
  865.         $! x.com
  866.         $
  867.         $! This procedure must be in the user's login directory.
  868.         $! Requires a self-referential (not reverential :-) proxy:
  869.         $!    UAF> add/prox <LocalNode>::<CurrentUser> <CurrentUser>/default
  870.         $! Author: Stephen Hoffman, OpenVMS Engineering, Compaq
  871.         $
  872.         $ goto 'f$mode()'
  873.         $INTERACTIVE:
  874.         $ open/read/write chan 0::"task=x"
  875.         $ write chan "Hello"
  876.         $ read chan parameter
  877.         $ close chan
  878.         $ write sys$output parameter
  879.         $ exit
  880.         $BATCH:
  881.         $OTHER:
  882.         $NETWORK:
  883.         $ open/read/write chan sys$net
  884.         $ read chan parameter
  885.         $ write chan "''parameter' yourself!"
  886.         $ close chan
  887.         $ exit
  888.  
  889.   An example of a run of the above procedure:
  890.  
  891.         $ @x
  892.         Hello yourself!
  893.         $
  894.  
  895.  
  896. DCL does not include support asynchronous I/O, thus a predetermined protocol
  897. or a predetermined "turn-around" command sequence must be implemented in
  898. order to avoid protocol deadlocks -- cases where both tasks are trying to
  899. write or both tasks are trying to read.  The task that is writing messages
  900. to the network must write (or write and read) a predetermined sequence of
  901. messages, or it must write a message that tells the reader that it can now
  902. start writing messages.  (This is the essence of a basic half-duplex network
  903. protocol scheme.)
  904.                     [Stephen Hoffman]
  905.  
  906. ------------------------------------------------------------
  907. DCL9.   How can I get the width setting of a terminal?
  908.  
  909.   $ width = f$getdvi(terminal,"DEVBUFSIZ")
  910.  
  911. ------------------------------------------------------------
  912. DCL10.  How can I substitute symbols in a PIPE?
  913.  
  914.   Use ampersand substitution, not apostrophe substitution.
  915.  
  916.     $ pipe show system | search sys$input opcom | (read sys$input pid ;
  917.            pid=f$element(0," ",pid) ; define/system opcom_pid &pid)
  918.     $ show log opcom_pid
  919.        "OPCOM_PID" = "0000020B" (LNM$SYSTEM_TABLE)
  920.                                            [Norm Lastovica]
  921.  
  922. ------------------------------------------------------------
  923. DCL11.  Use of RUN/DETACH, LOGINOUT, and logical names?
  924.  
  925.   With a command to create a detached process such as:
  926.  
  927.     $ RUN/DETACHED SYS$SYSTEM:LOGINOUT /INPUT=TEMP_INPUT.COM
  928.  
  929.   If you are trying to use a logical name as the /INPUT, /OUTPUT or
  930.   /ERROR on a RUN/DETACH command, then you must translate the logical
  931.   name specifications to physical references before passing them, or
  932.   the definitions must reside in a logical name table that is visible 
  933.   to the newly-created process.
  934.  
  935.   Also note that LOGINOUT only creates the SYS$LOGIN, SYS$LOGIN_DEVICE, 
  936.   and SYS$SCRATCH logical names if it is processing a login that is based 
  937.   on the contents of a SYSUAF record -- without access to the associated
  938.   SYSUAF record, this information is not available to LOGINOUT.  (If you 
  939.   want to see these particular logical names created, then please specify
  940.   the /AUTHORIZE qualifier on the RUN/DETACHED command.)
  941.  
  942.   If you do not specify LOGINOUT as the image, then there is no easy way 
  943.   to get these logical names.  Also, any logical names that are used in the 
  944.   target image file specification must also be in a logical name table 
  945.   accessable (by default) by the newly-created detached process.  Shared 
  946.   tables include the group (if the process is in the same UIC group) and 
  947.   the system table.  (If the target process is to be in another UIC group, 
  948.   a suitablly privileged user or application can create the necessary 
  949.   logical name(s) directly in the other group logical name table.)
  950.  
  951.   When in doubt, create a short DCL command file as input, and use a
  952.   SHOW LOGICAL and similar commands to examine the context.  (And use
  953.   physical device and directory references on the RUN/DETACH of the
  954.   LOGINOUT image, when specifying this command file as /INPUT.)  Also
  955.   remember to check both security auditing and system accounting when 
  956.   troubleshooting problems with the RUN/DETACH.
  957.  
  958.   Also see DCL1.
  959.  
  960. ------------------------------------------------------------
  961. DCL12.  How to use escape and control characters in DCL?
  962.  
  963.   To write a message and then the bell character, use:
  964.  
  965.     $ bell[0,7] = 7
  966.     $ write sys$output "Hello''bell'"
  967.  
  968.   To write blinking text, use:
  969.  
  970.     $ esc[0,7] = 27
  971.     $ text = "Blinking Text"
  972.     $ write sys$output "''esc'[5m''text'''esc'[m"
  973.  
  974.   Also see sections DECW9, MISC2.
  975.  
  976. ------------------------------------------------------------
  977. FILE1.  How can I undelete a file?
  978.  
  979. OpenVMS doesn't have an "undelete" function.  However, if you are quick
  980. to write-protect the disk (or if you can guarantee that no new files get
  981. created or existing files extended), your data is still on the disk
  982. and it may be possible to retrieve it.  The FLORIAN tool available from
  983. the WKU Fileserver claims to be able to do this (see question SOFT1.)
  984. Other alternatives here include the DFU tool, available on the OpenVMS
  985. Freeware CD-ROM distribution.
  986.  
  987. If you are setting up a user environment for yourself or for others, it
  988. is quite easy to use DCL to intercept the DELETE command, using a symbol:
  989.  
  990.   $ DEL*ETE :== @SYS$LOGIN:MYDELETE.COM
  991.  
  992. The DELETE symbol will cause the procedure to be invoked whenever the user
  993. enters the DELETE command, and it can copy the file(s) to a "trashcan"
  994. subdirectory before issuing a "real" DELETE on the files.  Other procedures
  995. can retrieve the file(s) from the "trashcan" subdirectory, and can (and
  996. should) clean out the "trashcan" as appropriate.  (Realize that this DELETE
  997. symbol can interfere with DELETE/GLOBAL and other similar DCL commands.)
  998.                     [Stephen Hoffman]
  999.  
  1000. ------------------------------------------------------------
  1001. FILE2.  Why does SHOW QUOTA give a different answer than DIR/SIZE?
  1002.  
  1003. DIR/SIZE doesn't take into account the size of file headers which are
  1004. charged to your quota.  Also, unless you use DIR/SIZE:ALL, you'll see only
  1005. the "used" size of the file, not the allocated size which is what gets
  1006. charged against your quota.  Also, you may have files in other directories.
  1007.                     [Steve Lionel]
  1008.  
  1009. $ DIR/SIZ=ALL/GRAND [username...]
  1010.  
  1011. Grand total of D1 directories, F1 files, B1/B2 blocks.
  1012.  
  1013. $ DIR/SIZ=ALL/GRAND [-]username.DIR
  1014.  
  1015. Grand total of 1 directory, 1 file, B3/B4 blocks.
  1016.  
  1017. $ SHOW QUOTA
  1018.   User [username] has B5 blocks used, B6 available,
  1019.   of B7 authorized and permitted overdraft of B8 blocks on disk
  1020.  
  1021. If the user has no files in other directories and all file-headers are
  1022. only 1 block, then the following should apply:
  1023.  
  1024.   B5=B2+B4+F1+1
  1025.  
  1026. If the diskquota is out of synch, then the system-manager can make a rebuild.
  1027.                     [Arne Vajh°j]
  1028.  
  1029. Also be aware that the DIRECTORY/SIZE command can report larger values 
  1030. than might otherwise be expected when used to evaluate files and/or 
  1031. directories that are alias links -- such as the system roots on OpenVMS 
  1032. system disks -- as the command reports a total that is cumulative over 
  1033. all of the files and directories examined, without regard for which ones 
  1034. might be alias entries and which are not.  (In other words, a DIRECTORY/SIZE 
  1035. of an entire OpenVMS system disk will report a disk useage value larger than 
  1036. the (usually more accurate) value reported by the SHOW DEVICE command.  This
  1037. as a result of the alias entries linking each SYS$SYSDEVICE:[SYSCOMMON]SYS*.DIR 
  1038. directory file and the SYS$SYSDEVICE:[000000]VMS$COMMON.DIR file together.)
  1039.  
  1040. ------------------------------------------------------------
  1041. FILE3.  How do I make sure that my data is safely written to disk?
  1042.  
  1043. If your application must absolutely guarantee that data is available,
  1044. no matter what, there's really no substitute for RMS Journaling and
  1045. host- or controller-based shadowing.  However, you can achieve a good 
  1046. degree of data integrity by issuing a SYS$FLUSH RMS call at appropriate 
  1047. times (if you're using RMS, that is.)  If you're using a high-level 
  1048. language's I/O system, check that language's documentation to see if 
  1049. you can access the RMS control blocks for the open file.  In C you can 
  1050. use fflush followed by fsync.  Note that fsync, which was undocumented 
  1051. for VAX C but is documented for DEC C, takes a file descriptor as an 
  1052. argument, not a *FILE.
  1053.  
  1054. For details on disk bad block handling on MSCP and on SCSI disk devices, 
  1055. please see Ask The Wizard (ATW) topic (6926).
  1056.  
  1057. ------------------------------------------------------------
  1058. FILE4.  What are the limits on file specifications and directories?
  1059.  
  1060. A file specification has an aggregate maximum size of 255 characters at
  1061. present.  The node and device specification may be up to 255 characters each -
  1062. file name and file types may be up to 39 characters each.  File versions are
  1063. from 1 through 32767, though 0 (latest version), -0 (oldest version) and -n
  1064. (n'th previous version) can be used in most contexts.  A file specification
  1065. may not have more than 8 directories and subdirectories - while it is possible
  1066. to create subdirectories of greater depth, accessing them is problematic in
  1067. most cases and this should be avoided. 
  1068.  
  1069. Application developers should use OpenVMS-supplied routines for parsing
  1070. file specifications - this ensures that changes in what is allowable will
  1071. not tend to break your application.  Consider that various parts of the
  1072. file specification may contain quoted strings with embedded spaces and
  1073. other punctuation!  Some routines of interest are SYS$FILESCAN, SYS$PARSE
  1074. and LIB$TRIM_FILESPEC.  For further information, see the OpenVMS Guide to
  1075. File Applications.
  1076.  
  1077. Performance of larger directory files improves (greatly) with OpenVMS 
  1078. V7.2 and later -- operations on directory files of 128 blocks and larger 
  1079. were rather slower on earlier OpenVMS releases due to the smaller size
  1080. of the directory cache and due to the directory I/O processing logic.
  1081.  
  1082. For fastest directory deletions, consider a reverse deletion -- delete
  1083. from the last file in the directory to the first.  This reversal speeds 
  1084. the deletion operation by avoiding unnecessary directory I/O operations
  1085. as the files are deleted. Tools such as DFU can be used for this purpose,
  1086. as can various available reverse-DELETE DCL command procedures.
  1087.  
  1088. ------------------------------------------------------------
  1089. FILE5.  What is the largest disk volume size OpenVMS can access?
  1090.  
  1091. One Terabyte (TB; 2**31 blocks of 2**9 bytes).  Prior to the release of 
  1092. V6.0, the OpenVMS file system was limited to disk volumes of 8.38 GB
  1093. (2**24 blocks, 16777216 blocks) or less.
  1094.  
  1095. On some systems, there are restrictions in the console program that limit the
  1096. size of the OpenVMS system disk.  Note that data disks are not affected by
  1097. console program limits.  For example, all members of the VAXstation 3100
  1098. series are limited to a system disk to 1.073 GB or less due to the console,
  1099. though larger data disks are possible.
  1100.  
  1101. Some SCSI disks with capacities larger than 8.58 gigabytes (GB) will 
  1102. require the use of an OpenVMS ECO kit (eg: ALPSCSI04_062 or later) for 
  1103. new SCSI device drivers.  Failure to use this ECO can cause "rounding 
  1104. errors" on the SCSI disk device capacity -- OpenVMS will not use nor 
  1105. display the full capacity of the drive -- and  "%sysinit-e-error mounting 
  1106. system device status equals 000008C4" (8C4 -> "%SYSTEM-?-FILESTRUCT, 
  1107. unsupported file structure level") errors during bootstrap.  (One 
  1108. workaround for the bootstrap when the bitmap is located far into the 
  1109. disk is the use of INIT/INDEX=BEGIN.)  The problem here involves the
  1110. particular extensions and fields used for larger capacity disks within 
  1111. the SCSI specifications and within the various intepretations of same.
  1112.                     [Stephen Hoffman]
  1113.  
  1114. For IDE disk drives:
  1115.  
  1116.   o Versions of DQDRIVER *BEFORE* X-15 topped out at 8.455 GB.
  1117.     Fixed drivers (>="X-15") were shipped in:
  1118.  
  1119.       OpenVMS Alpha V7.2-1, and later
  1120.       V7.2 UPDATE V1.0 ECO, and later
  1121.       V7.1-2 UPDATE V1.0 ECO, and later
  1122.       V7.1-2 UPDATE V3.0 ECO, and later
  1123.  
  1124.   o The newer DQDRIVER driver operates to disks up to 33 GB 
  1125.     without (known) problems, and effectively works with rather
  1126.     larger disks (up to circa 137 GB?) but is known to report an 
  1127.     incorrect number of "cylinders" with disks above 33 GB.
  1128.  
  1129.   See ALPHA23 for additional IDE DQDRIVER information.
  1130.  
  1131. Be aware that a known restriction in certain older versions of the 
  1132. Alpha SRM Console prevents booting most IDE drives larger than 
  1133. 8.455 GB, depending on exactly where the various files are located 
  1134. on the volume.  Updated SRM consoles for systems with SRM and IDE 
  1135. drive support are (will be) available.  (OpenVMS Engineering has 
  1136. successfully bootstrapped 20GB IDE disks using the appropriate 
  1137. SRM console version.)
  1138.  
  1139. NOTE: All IDE-related disk sizes listed in this section are stated 
  1140. in units of "disk (base ten) gigabytes" (1 GB = 10^9 bytes) and NOT 
  1141. in units of "software (base two) gigabytes" (1 GB = 2^30 (1073741824.) 
  1142. bytes.   See MISC21.
  1143.                                           [Atlant Schmidt]
  1144.  
  1145. Be aware that larger disks that are using an extension of SCSI-2 -- 
  1146. disks that are using a mode page field that the SCSI specifications 
  1147. normally reserved for tape devices -- to permit a larger disk volume 
  1148. size will require a SCSI driver update for OpenVMS, and this change 
  1149. is part of V7.1-2 and later, and also part of ALPSCSI07_062 and later.
  1150. (These larger disks disks will typically report a DRVERR, or will see 
  1151. the volume size "rounded down".)  SCSI disks larger than 16777216 blocks 
  1152. cira 8.455 GB (base ten); 8GB (base two) require this ECO, or require 
  1153. the use of OpenVMS Alpha V7.1-2 or later.
  1154.  
  1155. Also see VAX5, MISC21.
  1156.  
  1157. ------------------------------------------------------------
  1158. FILE6.  What is the maximum file size, and the RMS record size limit?
  1159.  
  1160. RMS can store individual files of a size up to the maximum supported
  1161. volume size.  Under OpenVMS V6.0 and later, the volume size and the RMS
  1162. maximum file size limit is 2**31 * 512 bytes -- one terabyte (1 TB).
  1163.  
  1164. "Use a volume set to provide a large, homogeneous public file space.
  1165. You must use a volume set to create files that are larger than a single
  1166. physical disk volume. (The file system attempts to balance the load on
  1167. the volume sets, for example, by creating new files on the volume that
  1168. is the least full at the time.)"
  1169.  
  1170. "You can add volumes to an existing volume set at any time. The maximum
  1171. number of volumes in a volume set is 255."
  1172.  
  1173. The RMS formats -- sequential, relative, and indexed -- are limited by
  1174. the one terabyte maximum volume size.  RMS relative files are further
  1175. limited to a number of records that will fit in 32 bits -- 4 billion
  1176. records.   Sequential and indexed formats do not have a record limit.
  1177.  
  1178. Also see PROG14, MISC21.
  1179.                     [Stephen Hoffman]
  1180.  
  1181. ------------------------------------------------------------
  1182. FILE7.  How do I write recordable CD media (CD-R) on OpenVMS?
  1183.  
  1184. At its simplest: get LDDRIVER from the Freeware.  Get CDRECORD or CDWRITE.
  1185. (CDRECORD and CDWRITE are freely available, though versions are not on the
  1186. Freeware V5.0 distribition; the URLs are referenced later in this section).
  1187. Build the contents of the disk on the LD device partition.  Then use the 
  1188. CDRECORD or CDWRITE tool to record the contents of the LD partition directly 
  1189. onto the CD-R or CD-RW media.  
  1190.  
  1191. While folks have had success getting PC-based CD-R/CD-RW tools to work with 
  1192. OpenVMS partitions, it is far easier and more reliable to use the 
  1193. OpenVMS-based versions of the tools.
  1194.  
  1195. More details: Creation of CD-ROMs using CD-Recordable media (CD-R) under 
  1196. OpenVMS typically involves one of two approaches: the use of the optional
  1197. CD-R (`Scribe') capabilities available for the InfoServer or other 
  1198. "offline" hardware packages (PC-based packages will be included in this), 
  1199. or the use of a host-based package such as the CDWRITE13_VMS utility, an 
  1200. OpenVMS port of a Linux tool.
  1201.  
  1202. OpenVMS presently has no integrated support for recording CD-R media.
  1203.  
  1204. OpenVMS can read both ODS2 and ISO9960 format CD-ROMs.
  1205.  
  1206. InfoServer hardware configurations are no longer availble from Compaq,
  1207. but may potentially be acquired through other means.
  1208.  
  1209. The CDWRITE13_VMS package is one example of a host-based package that
  1210. can be used to create CD-R media.  The contact for CDWRITE13_VMS is
  1211. Dr. Eberhard Heuser-Hofmann.  One website that discusses this package
  1212. is located at:
  1213.  
  1214.   http://www.geocities.com/SiliconValley/Lakes/9999/vmscdwri.html
  1215.  
  1216. Also see the newest linux-cdwrite package, XCDROAST.
  1217.  
  1218. Additional information is available via David J. Dachtera at:
  1219.  
  1220.   http://www.djesys.com/vms/cdrom.html
  1221.  
  1222. Also see:
  1223.  
  1224.   http://www.cd-info.com/CDIC/Technology/CD-R/vms.html
  1225.  
  1226.   http://www.faqs.org/faqs/cdrom/cd-recordable/part1/preamble.html
  1227.  
  1228.   http://www.tmesis.com/CDrom/
  1229.  
  1230.   http://www.tditx.com/~odsiso/
  1231.  
  1232.                                           [Stephen Hoffman]
  1233.  
  1234. U.S. Design offers a package that includes the tools necessary to 
  1235. create a CD or DVD-R with either 9660 or ODS-2 format, for standalone 
  1236. CD-R or DVD-R drives, for recent OpenVMS versions.  Details are 
  1237. available at:
  1238.  
  1239.   http://www.usdesign.com/
  1240.                                            [Harry Garonzik]
  1241.  
  1242.  
  1243. ------------------------------------------------------------
  1244. FILE8.  What I/O transfer size limits exist in OpenVMS?
  1245.  
  1246. The maximum transfer size is an attribute of the particular I/O device,
  1247. controller and driver combination; there is no inherent limit imposed
  1248. by OpenVMS (other than the fact that, today, byte counts and LBNs are
  1249. generally limited to 32 bits).
  1250.  
  1251. The maximum size of a device I/O request is limited by the value in
  1252. UCB$L_MAXBCNT, which is set by the device driver based on various
  1253. factors.  (Also check the setting of the MAXBUF system parameter for
  1254. buffered I/O transfers, and check the process quotas.)
  1255.  
  1256. Currently, SCSI drivers limit I/O transfers to FE00(16) bytes, 65024
  1257. bytes (decimal).  The reasons for this transfer size limitation are largely
  1258. historical.  Similarly, DSSI devices are limited to the same value,
  1259. this for hardware-specific reasons.  Transfers to HSC and HSJ device
  1260. controllers via the CI are limited to 1,048,576 bytes.  Client MSCP-served
  1261. devices are limited to 65535 bytes -- to help ensure that the I/O
  1262. fragmentation processing happens on the client and not on the server
  1263. system.
  1264.  
  1265. Parts of the OpenVMS I/O subsystem are optimized for data transfers less
  1266. than 64KB, because (obviously) most I/O operations are (substantially)
  1267. less than that.  OpenVMS can handle larger transfers, if the driver and
  1268. the device can handle it.
  1269.  
  1270. Also see FILE4, FILE5
  1271.  
  1272.                                         [John Croll]
  1273.  
  1274. ------------------------------------------------------------
  1275. FILE9.  Can I use ODBC to connect to OpenVMS database files?
  1276.  
  1277. Yes, you can use various available third-party packages that
  1278. permit remote ODBC clients to access RMS files and various 
  1279. commercial databases via the network.
  1280.  
  1281. For RMS, consider acquiring one of the packages available from 
  1282. EasySoft, Attunity Connect (formerly known as ISG Navigator), 
  1283. Oracle (DB  Integrator), SolutionsIQ, and Synergex. 
  1284.  
  1285. For specific commercial databases (other than RMS), contact 
  1286. the database vendor directly for assistance.
  1287.  
  1288.  
  1289. ------------------------------------------------------------
  1290. PROG1.  How do I call <routine_name> from <language_name>?
  1291.  
  1292. Most OpenVMS system services and RTL routines pass string arguments by
  1293. descriptor.  Languages which support native string data types create
  1294. descriptors automatically; those which do not (eg., C) require that you set
  1295. them up explicitly.
  1296.                     [eric@tardis.HQ.ileaf.com]
  1297.  
  1298. There is a lot of information available on how to call system services
  1299. and Run-Time Library routines, including examples in numerous languages.
  1300. The best references are:
  1301.  
  1302.     Your language's User Manual
  1303.     OpenVMS Programming Environment Manual
  1304.     OpenVMS Programming Concepts Manual
  1305.     OpenVMS Programming Interfaces: Calling a System Routine
  1306.     OpenVMS Calling Standard
  1307.  
  1308. In addition, if you are a subscriber to the Compaq Software Information
  1309. Network (available to those with a software support contract), the support
  1310. database contains hundreds of worked examples of calling system services
  1311. and RTL routines, including the one that seems to trip up almost everyone,
  1312. SMG$CREATE_MENU.
  1313.                     [Steve Lionel]
  1314.  
  1315. Arne Vajh°j has put together a collection of OpenVMS example programs.
  1316. It can be found at:
  1317.   ftp://ftp.hhs.dk/pub/vms/
  1318.                     [Arne Vajh°j]
  1319.  
  1320. Additional information and examples for OpenVMS are available via:
  1321.  
  1322.   http://www.openvms.compaq.com/wizard/
  1323.   http://www.openvms.compaq.com/freeware/
  1324.  
  1325.                     [Stephen Hoffman]
  1326.  
  1327. ------------------------------------------------------------
  1328. PROG2.  How do I get the arguments from the command line?
  1329.  
  1330. If you're writing a program and want to accept arguments from a foreign
  1331. command, you can use LIB$GET_FOREIGN to get the command line and parse
  1332. it yourself, or if you're programming in C, use the normal argc/argv
  1333. method.
  1334.  
  1335. To write an application which uses the normal DCL verb/qualifier/parameter
  1336. syntax for invocation, see the description of the CLI$ routines in the
  1337. OpenVMS Callable Utility Routines Reference Manual.
  1338.  
  1339. It is possible to write an application which can be used both ways; if a 
  1340. DCL verb isn't used to invoke the image, the application parses the command 
  1341. line itself.  One way to do this is to call CLI$GET_VALUE for a required
  1342. parameter.  If it is not present (or you get an error), call 
  1343. LIB$GET_FOREIGN to get the command line and do the manual parse.
  1344.  
  1345. See also question DCL1.
  1346.  
  1347. ------------------------------------------------------------
  1348. PROG3.  How do I get a formatted error message in a variable?
  1349.  
  1350. Use the SYS$PUTMSG system service with an action routine that stores
  1351. the message line(s) in the variable of your choice.  Be sure the action
  1352. routine returns a "false" (low bit clear) function value so that SYS$PUTMSG
  1353. doesn't then try to display the message (unless you want it to.)  See the
  1354. description of $PUTMSG in the System Services Reference Manual for an
  1355. example of using an action routine.
  1356.  
  1357. ------------------------------------------------------------
  1358. PROG4.  How do I link against SYS$SYSTEM:SYS.STB on an Alpha system?
  1359.  
  1360. LINK/SYSEXE is the OpenVMS Alpha equivalent of linking against SYS.STB.
  1361.  
  1362. Also see PROG11, particularly for pointers to the details on shareable 
  1363. images and shareable image creation.
  1364.  
  1365. ------------------------------------------------------------
  1366. PROG5.  How do I do a SET DEFAULT from inside a program?
  1367.  
  1368. The problem is that SYS$SETDDIR only changes the default directory - NOT
  1369. the default disk. The default disk is determined by the logical SYS$DISK.
  1370. If you want to change the default disk within a program, then call
  1371. LIB$SET_LOGICAL to change the logical SYS$DISK. You will need to call both
  1372. LIB$SET_LOGICAL and SYS$SETDDIR to change both default disk and the default
  1373. directory!
  1374.                     [Arne Vajh°j]    
  1375.  
  1376. ------------------------------------------------------------
  1377. PROG6.  How do I create a shareable image transfer vector on an Alpha system?
  1378.  
  1379. This is something that was greatly simplified for OpenVMS Alpha.  You don't
  1380. need to create a separate transfer vector module; just use the SYMBOL_VECTOR
  1381. statement in a linker options file.  For example, if your shareable image
  1382. has two routines named FOO and BAR, the linker options file should contain
  1383. the following line:
  1384.  
  1385.     SYMBOL_VECTOR=(FOO=PROCEDURE, BAR=PROCEDURE)
  1386.  
  1387. The Linker manual has more details on this.
  1388.  
  1389. ------------------------------------------------------------
  1390. PROG7.  How do I turn my Fortran COMMON into a shareable image on Alpha?
  1391.  
  1392. You need to add SYMBOL_VECTOR=(<common-name>=PSECT) to your options file.  On
  1393. OpenVMS VAX all OVR/REL/GBL psects were automatically exported into the
  1394. shareable image's Global Symbol Table.  On OpenVMS Alpha you have to tell the
  1395. linker that you want this done by means of the PSECT keyword in the
  1396. SYMBOL_VECTOR options file statement.
  1397.  
  1398. This has several advantages over OpenVMS VAX.  First, you don't have to worry 
  1399. about the address of the psect when you try to create a new, upwardly 
  1400. compatible version of the shareable image. Second, you can control which
  1401. psects, if any, are made visible outside the shareable image.
  1402.  
  1403. By default, COMMON PSECTs in DEC Fortran for OpenVMS Alpha (as well as most
  1404. other OpenVMS Alpha compilers) are NOSHR.  On VAX, the default was SHR which
  1405. required you to change the attribute to NOSHR if you wanted your COMMON
  1406. to be in a shareable image but not write-shared by all processes on the
  1407. system.  If you do want write-sharing, use: 
  1408.     CDEC$ PSECT common-name=SHR
  1409. in the Fortran source code (the CDEC$ must be begin in column 1) or a linker 
  1410. options file PSECT_ATTR statement to set the COMMON PSECT attribute to SHR.
  1411.  
  1412. For further information, see the Linker manual.
  1413.  
  1414. ------------------------------------------------------------
  1415. PROG8.  How do I convert between IEEE and VAX floating data?
  1416.  
  1417. In OpenVMS V6.1 and later, the routine CVT$CONVERT_FLOAT is documented 
  1418. in the LIB$ Run-Time Library Reference Manual, and can perform floating
  1419. point conversions between any two of the following floating datatypes: 
  1420. VAX (F,D,G,H), little-endian IEEE (single, double, quad), big-endian IEEE 
  1421. (single, double, quad), CRAY and IBM System\370, etc.
  1422.  
  1423. DEC Fortran (all platforms) has a feature which will perform automatic
  1424. conversion of unformatted data during input or output.  See the DEC Fortran
  1425. documentation for information on "non-native data in I/O" and the
  1426. CONVERT= OPEN statement keyword.
  1427.  
  1428. There are floating-point conversion source code packages available
  1429. for various platforms.
  1430.  
  1431. For further floating-point related information, see:
  1432.  
  1433.   http://www.hhs.dk/anonymous/pub/vms/collection/ieee.zip
  1434.  
  1435.  
  1436. ------------------------------------------------------------
  1437. PROG9.  How do I get the argument count in a Fortran routine?
  1438.  
  1439. On VAX, many programmers would use a MACRO routine which accessed the
  1440. AP register of the caller to get the address of the argument list and
  1441. hence the argument count.  This was not guaranteed to work on VAX, but
  1442. usually did.  However, it doesn't work at all on OpenVMS Alpha, as there
  1443. is no AP register.  On Alpha systems, you must use a language's built-in
  1444. function to retrieve the argument count, if any.  In Fortran this is
  1445. IARGCOUNT, which is also available in DEC Fortran on OpenVMS VAX.
  1446.  
  1447. Note that omitting arguments to Fortran routines is non-standard and is
  1448. unsupported.  It will work in many cases - read the DEC Fortran release
  1449. notes for additional information.
  1450.  
  1451. ------------------------------------------------------------
  1452. PROG10. How do I get a unique system ID for licensing purposes?
  1453.  
  1454. Many software developers desire to use a unique hardware ID to "lock" a
  1455. given copy of their product to a specific system.  Most VAX and Alpha 
  1456. systems do not have a unique hardware-set "system ID" that can be used 
  1457. for this purpose.  Compaq does not use hardware IDs in its licensing
  1458. methods and many users consider a hardware-based licensing scheme to be
  1459. a negative attribute when considering software purchases.
  1460.  
  1461. Compaq OpenVMS uses a software-based system called the License Management 
  1462. Facility (LMF).  This provides for software keys (Product Authorization 
  1463. Keys or PAKS) which support capacity and user-based license checking.  
  1464. Compaq offers an LMF PAK Generator to CSA members -- see ALPHA4.
  1465.  
  1466. However, if a hardware-based method is required, the most common method is
  1467. based on an Ethernet adaptor hardware address.  Sample source code for
  1468. implementing this is available at:
  1469.  
  1470.   http://www.openvms.compaq.com/wizard/
  1471.  
  1472. ------------------------------------------------------------
  1473. PROG11. What is an executable, shareable, system or UWSS image?
  1474.  
  1475.    Executable code in OpenVMS typically resides in an image -- an
  1476.    image is a file -- the file extension is typically .EXE -- that
  1477.    contains this code.  Common types of images include executable
  1478.    images, shareable images, system images, and protected (UWSS)
  1479.    images.
  1480.  
  1481.    Executable images are programs that can be directly executed.
  1482.       These images can grant enhanced privileges, with an INSTALL
  1483.       of the image with /PRIVILEGE, or can grant enhanced access
  1484.       with the specification of a subsystem identifier on the ACL
  1485.       associated with the image.
  1486.  
  1487.    Shareable images contain code executed indirectly, these images
  1488.        are referenced from executable images and/or from other
  1489.        shareable images.  These images can not grant enhanced
  1490.        privileges, even with the use of INSTALL with /PRIVILEGE
  1491.        or a subsystem identifier.  These shareable images can be
  1492.        dynamically activated (a LINK that occurs at run-time) via
  1493.        the LIB$FIND_IMAGE_SYMBOL run-time library (RTL) routine.
  1494.        (See `protected images' for information on `privileged
  1495.        shareable images'.)
  1496.  
  1497.    System images are intended to run directly on the VAX or Alpha
  1498.        hardware -- these are normally used for the kernel code
  1499.        that comprises an operating system. 
  1500.  
  1501.    Protected images -- also refered to as User-Written System Services
  1502.        (UWSS), or as privileged shareable images -- are similiar in
  1503.        some ways to a standard shareable images, but these images
  1504.        include a `change mode' handler, and execute in an `inner'
  1505.        processor mode (privileged mode; executive or kernel), and
  1506.        code executing in inner modes has implicit SETPRV privilege.
  1507.        Must be INSTALLed with /PROTECT.  Note that inner-mode code
  1508.        has restrictions around calling library routines, around
  1509.        calling various system services, and around calling code
  1510.        located in other protected or shareable images.
  1511.  
  1512.    Loadable images and device drivers are images that can be used
  1513.    to add code into the OpenVMS kernel.  Pseudo-device drivers
  1514.    are a particularly convenient way to add executable code, with
  1515.    associated driver-defined data structures, into the kernel.
  1516.    The pseudo-device driver includes the UCB and DDB data structures,
  1517.    and a calling interface with support for both privileged and
  1518.    unprivileged access to the driver code via sys$qio[w] calls.
  1519.  
  1520.    A cookbook approach to creating OpenVMS shareable images is
  1521.    available at the (admittedly overly long) URL:
  1522.  
  1523.      http://www.openvms.compaq.com/wizard/
  1524.  
  1525.                     [Stephen Hoffman]
  1526.  
  1527. ------------------------------------------------------------
  1528. PROG12. How do I do a file copy from a program?
  1529.  
  1530. There are several options available for copying files from within a program. 
  1531. Obvious choices include using lib$spawn(), system(), sys$sndjbc() or
  1532. sys$creprc() to invoke a DCL COPY command.  Other common alternatives include
  1533. using the callable convert routines and the BACKUP application programming
  1534. interface (V7.1 and later).
  1535.  
  1536.                     [Stephen Hoffman]
  1537.  
  1538. ------------------------------------------------------------
  1539. PROG13.  What is a descriptor?
  1540.  
  1541. A descriptor is a data structure that describes a string or an array.  Each
  1542. descriptor contains information that describes the type of the data being
  1543. referenced, the size of the data, and the address of the data.  It also
  1544. includes a description of the storage used for the data, typically static
  1545. or dynamic.   Descriptors are passed by reference.
  1546.  
  1547. The following are examples of creating and using descriptors in C, with
  1548. the use of the angle brackets normally expected by the C include statements 
  1549. deliberately altered in deference to HTML:
  1550.  
  1551.     #include {descrip.h}
  1552.     #include {lib$routines.h}
  1553.     #include {stsdef.h}
  1554.     int RetStat;
  1555.     char TxtBuf[TXTSIZ]
  1556.     struct dsc$descriptor StaticDsc =
  1557.       { 0, DSC$K_DTYPE_T, DSC$K_CLASS_S, NULL };
  1558.     struct dsc$descriptor DynDsc = 
  1559.       { 0, DSC$K_DTYPE_T, DSC$K_CLASS_D, NULL };
  1560.     int DynDscLen = 255;
  1561.     $DESCRIPTOR( ConstDsc, "This is a string" );
  1562.  
  1563.     /* finish setting up a static descriptor */
  1564.     StaticDsc.dsc$w_length      = TXTSIZ;
  1565.     StaticDsc.dsc$a_pointer     = (void *) TxtBuf;
  1566.  
  1567.     /* finish setting up a dynamic descriptor */
  1568.     RetStat = lib$sget1_dd( &DynDscLen, &DynDsc );
  1569.     if ( !$VMS_STATUS_SUCCESS( RetStat ) )
  1570.       return RetStat;
  1571.  
  1572.     /* release the dynamic storage */
  1573.     RetStat = lib$sfree1_dd( &DynDsc );
  1574.     if (!$VMS_STATUS_SUCCESS( RetStat ))
  1575.       return RetStat;
  1576.  
  1577. Static descriptors reference storage entirely under application program
  1578. control, and the contents of the descriptor data structure can be modified
  1579. as required (by the application).  OpenVMS routines do not modify the
  1580. contents of a static descriptor, nor do they alter the address or length
  1581. values stored in the static descriptor.  (The term "static" refers to the
  1582. descriptor data structure, and not necessarily to the storage referenced
  1583. by the descriptor.)
  1584.  
  1585. Dynamic descriptors reference storage under the control of the run-time
  1586. library, and the contents of a dynamic descriptor data structure -- once
  1587. initialized -- can only be modified under control of run-time library
  1588. routines.  The dynamic storage referenced by the dynamic descriptor is
  1589. allocated and maintained by the run-time library routines.  Various
  1590. OpenVMS routines do alter the contents of the descriptor data structure,
  1591. changing the value for the amount and the address of the storage associated
  1592. with the dynamic descriptor, as required.  Routines can obviously access
  1593. and alter the contents of the storage referenced by the descriptor.
  1594.  
  1595. OpenVMS languages that include support for strings or arrays are expected
  1596. to use descriptors for the particular structure.  Most OpenVMS languages,
  1597. such as Fortran and BASIC, use descriptors entirely transparently.  Some, 
  1598. like DEC C, require the programmer to explicitly create and maintain the
  1599. descriptor. 
  1600.  
  1601. For further information on string descriptors, see the _OpenVMS Programming
  1602. Concepts_ manual, part of the OpenVMS documentation set.
  1603.  
  1604.                     [Stephen Hoffman]
  1605.  
  1606. Fortran defaults to passing integers by reference and characters by
  1607. descriptor.  The following sites discuss mixing Fortran and C source
  1608. code in the same application:
  1609.  
  1610.   http://www.hhs.dk/anonymous/pub/vms/misc/FORTRAN_C_CALL.COM
  1611.   ftp://ftp.hhs.dk/pub/vms/misc/FORTRAN_C_CALL.COM
  1612.                                         [Arne Vajhoej]
  1613.  
  1614. ------------------------------------------------------------
  1615. PROG14.  How many bytes are in a disk block?
  1616.  
  1617. A disk block is the minimum unit of disk storage allocation in OpenVMS.
  1618.  
  1619. Under OpenVMS VAX and OpenVMS Alpha, the disk volume block size is
  1620. consistent, with each block containing 512 bytes.
  1621.  
  1622. The minimum disk allocation granularity actually permissible (in the
  1623. ODS-2 and ODS-5 volume structures commonly used on OpenVMS) is determined
  1624. on a per-volume basis, and is typically based on a combination of the
  1625. total number blocks on the disk volume and the total size of the volume
  1626. storage bitmap.  The allocation granularity is known as the volume cluster
  1627. factor -- the cluster factor is the number of blocks in a disk cluster,
  1628. and it is the smallest number of blocks that can be allocated on a
  1629. particular disk volume.
  1630.  
  1631. Prior to OpenVMS V7.2, the  maximum permissible size of the bitmap
  1632. requires larger cluster factors as volume sizes increase.  Starting
  1633. with V7.2, the bitmap can be larger, and cluster factors as small as
  1634. one block can be used.
  1635.  
  1636. The number of bytes in a file can be determined by multiplying the
  1637. number of blocks allocated for the file times the number of bytes in
  1638. a block.  For sequential files (only), the FFB (XAB$W_FFB, in the
  1639. File Header XAB) value can be used to find out how much of the last
  1640. (XAB$L_EBK) block is used.  FFB and EBK are meaningful only for
  1641. sequential files, and only in a limited context -- partial block
  1642. allocations are not permitted.  For other file formats, the EOF marker
  1643. is not meaningful.
  1644.  
  1645. Disk allocations always occur only in units of the cluster factors,
  1646. which can be from one block up to (potentially) clusters of eighteen
  1647. blocks or more, depending on the volume cluster factor.
  1648.  
  1649. OpenVMS assumes that the device driver and the underlying storage device
  1650. will present the file system with addressable units of storage of 512
  1651. bytes in size, or the appearance of same.  Various third-party CD-ROM
  1652. devices, for instance, support only 2048 byte blocks, and such devices
  1653. are incompatible with the standard OpenVMS device drivers.
  1654.  
  1655. To determine the number of bytes required for a file from DCL, one
  1656. option uses the f$file_attributes item EOF, multiplied by the size
  1657. of a block in bytes (512).  This does not account for the unused
  1658. space in the last block of a sequential file, but it also does not
  1659. have to differentiate sequential files from other files.
  1660.  
  1661.                     [Stephen Hoffman]
  1662.  
  1663. ------------------------------------------------------------
  1664. PROG15. How many bytes are in a memory page?
  1665.  
  1666. A memory page is the minimum unit of memory allocation in OpenVMS.
  1667. With OpenVMS VAX, the memory page size matches the disk block size:
  1668. it is always 512 bytes.
  1669.  
  1670. With OpenVMS Alpha, the memory page size is variable, and it can range
  1671. from 8192 bytes (8 kilobytes) up to 64 kilobytes.  The current system
  1672. page size can be determined using the sys$getsyi or f$getsyi PAGE_SIZE
  1673. item.  Programs with hardcoded constants for the memory page size (or
  1674. page alignment) should always assume a page size of 64 kilobytes.
  1675.  
  1676. On OpenVMS Alpha, a 512 byte area of memory -- equivilent in size to
  1677. an OpenVMS VAX memory page -- is refered to as a pagelet.
  1678.  
  1679.                     [Stephen Hoffman]
  1680.  
  1681. ------------------------------------------------------------
  1682. PROG16. How do I create a process under another username?
  1683.  
  1684. Many server processes can operate within the context of the target user
  1685. using privileges, using calls such as sys$chkpro and (more commonly in
  1686. this context) sys$check_access as needed to determine if access would be
  1687. permitted for the specified user within the current security model.
  1688.  
  1689. With OpenVMS V6.2 and later, the persona system services (SYS$PERSONA_*)
  1690. can be used to assume the persona of the specified user -- these allow the
  1691. server to operate as the specified user, in a controlled fashion.  The
  1692. persona services can be used as a "wrapper" around a sys$creprc process
  1693. creation call, as well -- this will create a seperate process entirely
  1694. under the assumed persona.
  1695.  
  1696. Information on the persona system services is included in the OpenVMS
  1697. V6.2 new features documentation, and in the OpenVMS V7.1 and later system
  1698. services documentation.  These system services exist and are supported in
  1699. OpenVMS V6.2 and later releases.
  1700.  
  1701. Typical mechanisms for creating a process under another username include:
  1702.  
  1703.     o personna services around a sys$creprc call.  See above.
  1704.     o via DECnet task-to-task, using explicit specification of
  1705.       username and password, or using a DECnet proxy.
  1706.       This creates a network-mode job under the target user.
  1707.       The network-mode job might do little more than a RUN/DETACH
  1708.       of an image passed in via task-to-task -- task-to-task
  1709.       communications are fully available using strictly DCL-to-DCL
  1710.       processing, or using a compiled language and DCL, etc.)
  1711.     o SUBMIT/USER, or the username argument on the sys$sndjbc call.
  1712.       This creates a batch-mode job under the specified username.
  1713.       The batch-mode job might do little more than a RUN/DETACH
  1714.       of an image passed in via a parameter.
  1715.     o the UIC argument on the sys$creprc call.
  1716.       This mimics the UIC of the target user, and is certainly not
  1717.       the prefered mechanism for this task.
  1718.     o Via pseudo-terminals...
  1719.  
  1720. There are likely a few other mechanisms around...  There are various tools
  1721. available from DECUS and other sources that allow various forms of user
  1722. impersonation, as well.  These tools will require version-dependent kernel
  1723. code and enhanced privileges for some of (or all of) their operations.
  1724.  
  1725.                     [Stephen Hoffman]
  1726.  
  1727. ------------------------------------------------------------
  1728. PROG17.  Why do lib$spawn, lib$set_symbol fail in detached processes?
  1729.  
  1730. The processing within run-time library (RTL) calls such as lib$attach,
  1731. lib$disable_ctrl, lib$do_command, lib$enable_ctrl, lib$get_symbol,
  1732. lib$run_program, lib$set_symbol, lib$set_logical, and lib$spawn, is
  1733. dependent on and requires the presence of a command language interpreter
  1734. (CLI), such as DCL.  Without a CLI present in the current process, these
  1735. calls will fail with a "NOCLI, no CLI present to perform function" error.
  1736.  
  1737. Detached processes typically do not have a CLI present.
  1738.  
  1739. In place of lib$spawn, sys$creprc can often be used.  The context of the
  1740. parent process (symbols and logical names) will not be propogated into
  1741. the subprocess when sys$creprc is used, though when there is no CLI
  1742. present in the process this (lack of) propogation is moot.
  1743.  
  1744. To create a detached process with a CLI, you must specify LOGINOUT as the
  1745. target image as discussed elsewhere in the FAQ, or only use these calls
  1746. (and any other calls requiring a CLI) from images that are running in an
  1747. "interactive", "batch", or "other" mode process.
  1748.  
  1749.                     [Stephen Hoffman]
  1750.  
  1751. Also note that the lib$spawn and the C system call will fail in a CAPTIVE
  1752. login environment.  The lib$spawn call can be gotten to work in this
  1753. environment with the specification of the TRUSTED flag.  
  1754.  
  1755. ------------------------------------------------------------
  1756. PROG18.  Where can I obtain Bliss, and the libraries and supporting files?
  1757.  
  1758. The Bliss language compilers and documentation are available
  1759. on the OpenVMS Freeware distributions.
  1760.  
  1761. Bliss language source code that contains the following statement:
  1762.  
  1763.   LIBRARY 'SYS$LIBRARY:STARLET.L32';
  1764.  
  1765. or similar requires the presence of the Bliss libraries.  These
  1766. libraries are created on the target system using the Bliss require
  1767. files, and are built using the following Bliss commands:
  1768.  
  1769.   STARLET.L32 contains the public interfaces to OpenVMS:
  1770.  
  1771.     $ BLISS /LIBRARY=SYS$COMMON:[SYSLIB]STARLET.L32 -
  1772.         SYS$LIBRARY:STARLET.REQ
  1773.  
  1774.   LIB.L32 contains both the public and private interfaces to OpenVMS:
  1775.  
  1776.     $ BLISS /LIBRARY=SYS$COMMON:[SYSLIB]LIB.L32 -
  1777.         SYS$LIBRARY:LIB.REQ+SYS$LIBRARY:STARLET.REQ
  1778.  
  1779.   The equivilent files for Bliss64 are created with:
  1780.  
  1781.     $ BLISS/A64/LIBRARY==SYS$COMMON:[SYSLIB]LIB.L64 -
  1782.         SYS$LIBRARY:LIB.R64+STARLET.REQ+STARLET.R64
  1783.     $ BLISS/A64/LIBRARY==SYS$COMMON:[SYSLIB]STARLET.L64 -
  1784.         SYS$LIBRARY:STARLET.R64
  1785.  
  1786. Some Bliss code may also require the OpenVMS VAX architecture flags.
  1787. The following is the equivilent of the Alpha ARCH_DEFS.BLI module:
  1788.  
  1789.   !
  1790.   ! This is the OpenVMS VAX version of ARCH_DEFS.BLI, and
  1791.   ! contains the architectural definitions for conditionally
  1792.   ! compiling OpenVMS Bliss sources for use on VAX systems.
  1793.   !
  1794.   MACRO VAXPAGE = 1%;
  1795.   MACRO BIGPAGE = 0%;
  1796.  
  1797.   MACRO VAX =                     ! = 1 if compiled BLISS/VAX
  1798.           %BLISS(BLISS32V)%;      ! = 0 if not compiled BLISS/VAX
  1799.  
  1800.   MACRO EVAX =                    ! = 1 if compiled BLISS/E*
  1801.   !
  1802.   ! A more appropriate definition can only be used with versions
  1803.   ! of the Bliss compilers that understand the 32E/64E flags.
  1804.   !       %BLISS(BLISS32E) OR %BLISS(BLISS64E)%; ! = 0 if compiled /VAX
  1805.           NOT %BLISS(BLISS32V)%;  ! = 0 if compiled /VAX
  1806.  
  1807.   MACRO ADDRESSBITS =
  1808.           %BPADDR%;               ! = 32 or 64 based on compiler used
  1809.  
  1810.  
  1811.  
  1812.                     [Stephen Hoffman]
  1813.  
  1814. ------------------------------------------------------------
  1815. PROG19. How can I open a file for shared access?
  1816.  
  1817.   When creating a file, it is often useful to allow other
  1818.   applications and utilities -- such as TYPE -- to share
  1819.   read access to the file.  This permits you to examine the
  1820.   contents of a log file, for instance.
  1821.  
  1822.   A C source example that demonstrates how to do this is
  1823.   available in topic (2867) in the OpenVMS Ask The Wizard
  1824.   area:
  1825.  
  1826.     http://www.openvms.compaq.com/wizard/
  1827.  
  1828.   Depending on the environment, you may need to use C calls
  1829.   such as fsync and fflush, and -- in specific cases -- the
  1830.   setvbuf(_IONBF) call.
  1831.  
  1832.                     [Stephen Hoffman]
  1833.  
  1834. ------------------------------------------------------------
  1835. PROG20. How can I have common sources for messages, constants?
  1836.  
  1837.   Use the GNM tools on the OpenVMS Freeware to have common sources
  1838.   for MSG (message) files and SDML (Document) documentation files.
  1839.   Use the DOCUMENT command to convert the SDML documentation into
  1840.   the necessary formats (Text, Postscript, HTML, etc).  Use the
  1841.   MESSAGE/SDL tool (latent in OpenVMS) to create an SDL file based 
  1842.   on the messages.  Then use the SDL tool (available on the OpenVMS 
  1843.   Freeware) to convert the SDL file into language-specific definitions.
  1844.   (There is also a converter around to convert SDL into SDML, if you 
  1845.   want to get pictures of the data structures for your documentation.)
  1846.  
  1847. ------------------------------------------------------------
  1848. PROG21. How do I activate the OpenVMS Debugger from an application?
  1849.  
  1850. #include <lib$routines.h>
  1851. #include <ssdef.h>
  1852. #include <string.h>
  1853.  
  1854. main()
  1855.     {
  1856.     char ascic_debug_commands[128];
  1857.     char *dbgcmd = "*show calls;go;exit";
  1858.  
  1859.     strcpy( ascic_debug_commands, dbgcmd );
  1860.     ascic_debug_commands[0] = (char) strlen( dbgcmd ) - 1;
  1861.  
  1862.     lib$signal(SS$_DEBUG,1,ascic_debug_commands);
  1863.  
  1864.     return 1;
  1865.     }
  1866.  
  1867. ------------------------------------------------------------
  1868. PROG22.   Dealing with Endian-ness?
  1869.  
  1870.   OpenVMS on VAX, OpenVMS on Alpha and OpenVMS on Intel IA-64 platforms
  1871.   (as well as all Microsoft Windows implementations and platforms) all
  1872.   support and all use the little-endian byte ordering.  Certain Alpha
  1873.   microprocessors and Certain Intel Itanium processors can be configured
  1874.   to operate in big-endian mode.
  1875.  
  1876.   With little-endian byte order, the least significant byte is always
  1877.   the first byte; the byte at the lowest address.  With big-endian
  1878.   byte ordering, the byte storage order in memory is dependent on the 
  1879.   size of the data (byte, word, longword) that is being referenced.
  1880.  
  1881.   Endian-ness is a problem has been solved many times before.  Some of
  1882.   the typical solutions include htonl/htons and ntohl/ntohs in the
  1883.   standard C library and the TCP/IP Services XDR (eXternal Data
  1884.   Representation) libraries.  One of the more recently introduced network
  1885.   formats, and one that is seeing extensive press and marketing coverage,
  1886.   is XML.
  1887.  
  1888.  
  1889. ------------------------------------------------------------
  1890. PROG23.   How to resolve LINK-I-DATMISCH errors?
  1891.  
  1892.   The message LINK-I-DATMISCH is informational, and indicates that the
  1893.   version of the specified shareable image found in the system shareable
  1894.   image directory does not match the version of the shareable image that
  1895.   was originally loaded into IMAGELIB.OLB, one of the OpenVMS libraries
  1896.   typically searched by the LINKER.
  1897.  
  1898.   From a privileged username, you can usually completely repair this via
  1899.   the following DCL command:
  1900.  
  1901.   $ LIB/REPLACE/SHARE SYS$LIBRARY:IMAGELIB.OLB SYS$SHARE:LIBRTL.EXE
  1902.  
  1903.   This command assumes that the shareable image that was found in the
  1904.   SYS$SHARE: area is valid and upward-compatiable, and that the image
  1905.   has simply replaced an older version without also updating IMAGELIB.
  1906.  
  1907.  
  1908. [End of Part 3/5]
  1909.  
  1910.  
  1911.  --------------------------- pure personal opinion ---------------------------
  1912.    Hoff (Stephen) Hoffman   OpenVMS Engineering   hoffman#xdelta.zko.dec.com
  1913.  
  1914.