The Minimum You Need to Know to Be an OpenVMS Application Developer
-
Upload
roland-hughes -
Category
Documents
-
view
342 -
download
1
description
Transcript of The Minimum You Need to Know to Be an OpenVMS Application Developer
to Be an OpenVMS Application Developer
By Roland Hughes
Logikal Solutions
The Minimum You Need to Know
Copyright © 2005 by Roland Hughes
All rights reserved
Printed and bound in the United States of America
ISBN 0-9770866-0-7
This book was published by Logikal Solutions for the author. Neither Logikal Solutions
nor the author shall be held responsible for any damage, claim, or expense incurred by a
user of this book and its accompanying CD-ROM as a result of its use or reliance upon the
contents contained in either the book or the CD-ROM.
These trademarks belong to the following companies:ACUCOBOL Acucorp, Inc.CDD Oracle CorporationCMS Hewlett Packard CorporationDEC Digital Equipment CorporationDEC BASIC Hewlett Packard CorporationDEC COBOL Hewlett Packard CorporationDEC C Hewlett Packard CorporationDECSET Hewlett Packard CorporationFMS Hewlett Packard CorporationHP Hewlett Packard CorporationKeaTerm Attachmate CorporationIBM International Business Machines, Inc.LSE Hewlett Packard CorporationOpenVMS Hewlett Packard CorporationORACLE Oracle CorporationPurify Pure Software, Inc.Reflections WRQ, Inc.RMS Hewlett Packard CorporationRDB Oracle CorporationWindows Microsoft CorporationWordPerfect Corel CorporationUNIX The Open Group
All other trademarks inadvertently missing from this list are trademarks of their respective owners. A besteffort was made to appropriately capitalize all trademarks which were known at the time of this writing.Neither the publisher nor the author can attest to the accuracy of this information. Use of a term in this bookshould not be regarded as affecting the validity of any trademark or service mark.
Acknowledgments
A book of this nature comes about as a result of a nearly 20-year journey through
the career of software development. During the course of that journey your knowledge
and skill are honed by the countless individuals you come in contact with either personally
or electronically. Some of them you don’t remember as time goes on, yet you do remember
the things they taught you.
One definitely must thank their family for allowing them to pursue a passion and
dream even though they didn’t really understand the passion or the dream. At some point
it is possible that I didn’t fully understand it myself.
In particular I would like to thank Mr. Ken Olsen, the founder of Digital
Equipment Corporation. Your company put out the greatest operating system known to
mankind. Thanks for the memories.
Source Code Licence
Any person owning a copy of this book may use the source code from this book and
accompanying CD-ROM freely when developing software for their personal use, their
company’s use, or their client’s use. Such persons may include the source code either
modified or unmodified provided that the source delivered makes reference to the original
author and is delivered as part of a fully functional application. It is expressly forbidden
for anyone to post this software on any bulletin board system, internet Web site, or other
electronic distribution medium without the express written consent of the author. It is
also expressly forbidden to sell this source as part of a library or shareware distribution
of source.
Users of the source code contained within this book and on the accompanying CD-
ROM agree to hold harmless both the author and the publisher for any errors, omissions,
losses, or other financial consequences which result from the use of said source. This
software is provided “as is” with no warranty of any kind expressed or implied.
Table of Contents
Introduction.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-1
I.1 Purpose of This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-1
I.2 What You Need to Know to Read This Book. . . . . . . . . . . . . . . . . . . . . . . . I-1
I.3 Who Should Read This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-1
I.4 How to Read This Book. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-2
I.5 Our Sample Application.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-2
I.6 Why OpenVMS?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-4
I.7 The Definition of Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . I-5
Chapter 1
Fundamentals of OpenVMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
1.1 Hardware. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-1
1.2 Logging In. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-3
1.3 Symbols. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-5
1.4 Editor Choices. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-9
1.5 EDT Exercises. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-14
1.6 TPU and EVE Configuration. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-18
1.7 LSE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-20
1.8 Logicals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-21
1.9 ACLs and the UAF.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-28
1.10 Logical Name Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-38
1.11 Foreign Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-40
1.12 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1-41
Chapter 2
DCL and Utilities We Need.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.1 DCL for Application Development. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.2 FDL and Our Indexed Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-1
2.3 Indexed File Lore. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-5
2.4 Lexical Functions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-12
2.5 The Import Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-14
2.6 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2-20
Chapter 3
DEC BASIC. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.1 Goals. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.2 Language Data Types. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-1
3.3 Magic Numbers. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-3
3.4 Group vs. Record. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-6
3.5 Creating Our Statistics Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-7
3.6 Data File Reporting. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-21
3.7 Other BASIC Language Features.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-28
3.8 BASIC Features to Never Use. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-33
3.9 The Zero Element. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-34
3.10 Where Do We Go From Here?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-35
3.11 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3-35
Chapter 4
FMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
4.1 What is FMS?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-1
4.2 Creating a Data Entry Screen in FMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-2
4.3 FMS Object vs. Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-5
4.4 Stand Alone Data Entry. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-6
4.5 An FMS Browse Program. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-20
4.6 An FMS Menu. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-27
4.7 FMS Functions to Never Use. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
4.8 FMS Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-38
4.9 FMS Function and Subroutine Summary. . . . . . . . . . . . . . . . . . . . . . . . . 4-39
4.10 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4-53
Chapter 5
CMS Theory and Practice. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
5.1 Code Management System. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-1
5.2 Logical Environment for CMS Based Development. . . . . . . . . . . . . . . . . . 5-1
5.3 Creating Our CMS Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-9
5.4 Putting Our Application in the Library. . . . . . . . . . . . . . . . . . . . . . . . . . . 5-10
5.5 Deleting an Element From the Library. . . . . . . . . . . . . . . . . . . . . . . . . . . 5-11
5.6 Classes and Deletions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-12
5.7 Modifying Elements Once They Are in CMS. . . . . . . . . . . . . . . . . . . . . . . 5-12
5.8 Productionizing the Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-13
5.9 Legacy Build Procedure.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-16
5.10 Additional CMS Commands. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-18
5.11 Promotion Between Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-20
5.12 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5-29
Chapter 6
CDD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
6.1 What is CDD?.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-1
6.2 Some Definitions You Need to Know. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-2
6.3 The Different Camps of CDD Configuration. . . . . . . . . . . . . . . . . . . . . . . . 6-3
6.4 Creating a Repository. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-5
6.5 Defining Our Logicals and Directories. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-6
6.6 Creating Our Fields and Records. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-8
6.7 Converting Our Include File. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-12
6.8 Using Variants and Dates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-14
6.9 Nuking the CDD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-20
6.10 Full Build Modification. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-22
6.11 CDD Usage Summary. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24
6.12 Mass Changes Due to CDD. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-24
6.13 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6-29
Chapter 7
Object and Text Libraries. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.1 What We Know About Libraries So Far. . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-1
7.2 Application Logicals We Need.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
7.3 Creating Our Text Library. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-2
7.4 Converting Our Application to a Single EXE. . . . . . . . . . . . . . . . . . . . . . . 7-3
7.5 Programming Assignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-23
7.6 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7-24
Chapter 8
MMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.1 The Purpose of MMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.2 The Correct Way to Use MMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-1
8.3 Putting It All Together. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-8
8.4 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8-12
Chapter 9
Message Utility, Mail and Phone. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
9.1 Message File Definition. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-1
9.2 VMSMAIL Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-2
9.3 Sending Mail From Inside Server Applications. . . . . . . . . . . . . . . . . . . . . . 9-5
9.4 Programming Assignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
9.5 VMSPhone Overview.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-10
9.6 Creating Your Own Messages.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-12
9.7 Testing Your Messages. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-14
9.8 Programming Assignment 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
9.9 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9-21
Chapter 10
FORTRAN. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1
10.1 Yes, It’s Still Out There. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-1
10.2 Basics of Fortran. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-2
10.3 Our Sample Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-7
10.4 Programming Assignment 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-53
10.5 Using Message Files. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-53
10.6 Our Quadword Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-54
10.7 Sending Mail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-56
10.8 Programming Assignment 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-60
10.9 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10-60
Chapter 11
COBOL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1
11.1 Overview.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-1
11.2 Interview Questions That Are Red Flags. . . . . . . . . . . . . . . . . . . . . . . . . 11-2
11.3 The Myth of the COBOL SORT Verb. . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4
11.4 The DCL SORT Command. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-4
11.5 Our Sample Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-6
11.6 Programming Assignment. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-58
11.7 The Rest of the Language. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-59
11.8 Our Quadword Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-61
11.9 Sending Mail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-62
11.10 Programming Assignment 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-67
11.11 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11-68
Chapter 12
C/C++. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1
12.1 Overview.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-1
12.2 Some Differences on OpenVMS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-6
12.3 Our Sample Application in C. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-9
12.4 C++ Philosophy and Terminology.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-69
12.5 Our Sample Application in C++. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-71
12.6 C/C++ Follow Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-139
12.7 Debugging Notes for C/C++.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-146
12.8 Sending Mail. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-147
12.9 D_FLOAT Example. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-152
12.10 Programming Assignments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-156
12.11 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12-156
Chapter 13
MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1
13.1 Why MySQL?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-1
13.2 Getting and Installing MySQL. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-4
13.3 Our Application Database. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-9
13.4 Creating the Tables. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-10
13.5 Compiling and Linking With MySQL.. . . . . . . . . . . . . . . . . . . . . . . . . . 13-13
13.6 Our Sample Application. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-17
13.7 MySQL Follow-up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-65
13.8 Programming Assignments. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-67
13.9 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13-69
Chapter 14
RDB. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1
14.1 Why RDB?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-1
14.2 What’s in the Book and What’s on Disk. . . . . . . . . . . . . . . . . . . . . . . . . . 14-4
14.3 Table and Database Definitions. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-5
14.4 The Drawbacks. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-14
14.5 Our SQLMOD Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-15
14.6 Programming Assignment 1. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-29
14.7 SQLMOD Follow Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-37
14.8 EXEC SQL Implementation. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-38
14.9 RDB Follow Up. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-54
14.10 Programming Assignment 2. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-55
14.11 Exercises.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14-55
Chapter 15
Ruminations and Observations. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
15.1 Overview.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
15.2 What Do You Do?. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-1
15.3 Keep Your Eye on the Sparrow.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-5
15.4 Have You Ever Wondered Why Y2K Happened?. . . . . . . . . . . . . . . . . . 15-6
15.5 Optimal Technology.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-9
15.6 The Self-Defeating Business Model. . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-11
15.7 Offshore Computing – The Death Knell of IT in the U.S. . . . . . . . . . . 15-14
15.8 Avoiding a Hell-Hole. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15-17
Introduction
I.1 Purpose of This Book
The purpose of this book is to be an aid for developers switching platforms to
OpenVMS. It is also designed to be useful to college level students who have had at least
one of the programming languages covered in this book as course work. Anyone who is
currently successful at writing applications on the lesser platforms, namely Windows and
UNIX, should be able to use this book and in a relatively short period of time become
productive on the much more robust and stable platform of OpenVMS.
There are quite a few third party books which have been written over the years
on/about the OpenVMS platform. Those books go into great detail about very specific
areas of this platform. What you should glean from this book is a very broad
understanding of development tools and techniques you will encounter when working on
the OpenVMS platform. While we will delve into some of the obscurities a developer
needs to be aware of as we cover each topic, we will not cover all of the minutiae.
This book is not intended to be the last and final word on OpenVMS development, nor
is it intended to replace the dozens upon dozens of manuals written for OpenVMS by its
owners. (Currently HP at the time of this writing.) You should know enough when you
finish with this book to both not be afraid of development, and know where to look for
further information. Upon completion of this book you will have more than enough
knowledge and skills to become a maintenance programmer at many shops running
OpenVMS.
I.2 What You Need to Know to Read This Book
This book is intended to be used by applications developers, consultants, and to some
extent systems analysts. You should have had at least one course in logic and be
comfortable with at least one of the programming languages covered in this book or a
language very similar to it. Managers will find much of the information useful when
making technical direction decisions. Those developers whose only language is “Visual
something or other” didn’t learn a language and will flounder miserably with this book.
I.3 Who Should Read This Book
Anyone who plans to become employed or a consultant using the OpenVMS platform
should both own and read this book. No matter how seasoned you are on a platform, even
if OpenVMS is your current platform, it is nice to have a cheat-sheet to flip through when
the mind gets a little foggy. As I get older, I find I cheat more when having to go back and
maintain some of the really old stuff at client sites. Hence, it was part of the incentive to
write this book.
I-2 Introduction
I.4 How to Read This Book
This book is meant to be read from front to back initially, then serve as a reference
manual on your desk. Each chapter builds upon the previous chapter. Once we talk about
DCL in Chapter 2 we use it and talk about it throughout much of the book. Likewise, once
we talk about BASIC, we will continue talking about it most of the way through the book.
Some books cover only one topic like a single language. They bombard you with the
mass of the syntax in such a general way as to be useless when taken in the context of any
single platform. This book is not a dry and sterile treatise on the syntax of languages.
This book starts you out with the minimum you need to know just to log on and use the
platform. Then it builds one application teaching many different aspects of the platform
as you need to know them during the course of the development. Where appropriate, the
historical reasons for the way things are get passed along as well.
It is the hope of the author that using a single application which requires all of the
basic skills needed to be a maintenance developer on this platform with each of the
languages covered will teach you more than just those skills. Following the journey
through to the end will also give you an idea of the trade offs you make using each tool.
There is no one tool which is perfect for all jobs. There are many reasons you will find
shops using 4 or more languages. Sometimes they bought a package written in a language
they currently weren’t using, other times they wrote the package themselves in that
language or tool because it was the best tool for the job even if they had to encounter a
learning curve to make it work.
At the end of your journey is a reward. The chapter entitled “Ruminations and
Observations” is a series of essays about IT topics and life in general. This chapter is my
reward for writing this book. Some of the sections there may offend you beyond any scope
of reason — good. Others may provoke thoughts which keep you lying awake at night
trying to figure out a solution — also good. The topics I choose to cover in this chapter are
problems and concepts which must be addressed in IT for the good of the industry. How
they actually get addressed will be up to you the reader, and you the voting shareholder
of corporations. There are sections in that chapter covering information gathering,
optimal technology, the reason Y2K happened and off shore computing.
I.5 Our Sample Application
We will have a single sample application redeveloped in all languages. I’m not going
to bore you to tears with a contrived and hokey inventory or order entry system which
seems to be the bane of academia. Let’s face it, we have all read books like that, and we
never spent any time after we finished the book playing with the application because it
was boring. I’m also not going to create a useless paint application which you will find
touted in almost every GUI platform book on the market.
Introduction I-3
Our sample application will track the Mega-Zillionare lottery. No, that is not its
official name. There are several different multi-state lotteries with similar rules and
official web sites where you can download data. The test data for this application will be
provided on the CD-ROM and be called DRAWING_DATA.TXT. Once you are comfortable
with using the various editors you can download and format your own bulk data file for
import.
Initially we will use RMS indexed files to store the data. One for the drawing data,
and two for statistical data. Don’t get nervous; we will only be doing some crude stats on
the data. Mainly we will count the number of hits, percentage of hits, sequence of hits,
average and maximum of misses between hits. Calling it statistics is probably being too
grandiose.
The input data file is a CSV (comma separated values) formatted file. It contains one
record per line in the format: drawing date, number 1, number 2, number 3, number 4,
number 5, and the mega number. The primary indexed file will be laid out in much the
same way.
We will have the following main components in each application:
• Import program to create a new data file from a bulk import file.
• Stats generation program to create two new indexed statistics files.
• Report programs to print off numbers based upon their statistical ranking.
• A form of data entry to add additional drawing data on a single record basis.
• A browse program to scroll through the drawing data.
As you can see this little application will encompass all of the core functionality you
need to know to begin being productive with each tool set described. By redeveloping the
same application with different languages and different tools you will get a feeling for the
design tradeoffs each tool set has. When we get to the relational database chapters the
indexed files will be replaced by tables. Hopefully you will experiment yourself with each
of the tool sets to find improvements to make the application more to your liking. As I
said, I’ve chosen an application you might actually wish to play with if for no other reason
than the new data is available every week.
As stated, we will have 3 indexed files for this application. The first will be an indexed
file containing the drawing data, the second will contain stats for the main drawing
numbers, and the third will contain stats for the mega/power number. Below are the file
layouts. The tag of “k0” to the right of a field is my way of flagging the primary key.
Drawing_DataDraw_dt char[8] k0
No_1 integer
No_2 integer
No_3 integer
No_4 integer
No_5 integer
Mega_no integer
I-4 Introduction
Drawing_Stats Mega_StatsElm_no integer k0 Elm_no integer k0
Hit_count integer Hit_count integer
Last_draw_no integer Last_draw_no integer
Since_last integer Since_last integer
Curr_seq integer Curr_seq integer
Longest_seq integer Longest_seq integer
Pct_hits double Pct_hits double
Max_btwn integer Max_btwn integer
Ave_btwn double Ave_btwn double
I.6 Why OpenVMS?
Many of you reading this will be coming from other platforms you are comfortable
with and believe they can be used to do anything. Most of these platforms haven’t existed
as long as OpenVMS. Few, if any, had the number of operating systems and hardware
changes which culminated with OpenVMS. Near the dawn of the computer age (you know
you are really old if you can remember the dawn of an age) some of the first platforms
made by Digital Equipment Corporation (DEC) were the DEC-10 and DEC-20 time
sharing computers. I never had the privilege of working on those platforms but have
talked with some that did. They performed exceptionally well for their era running
TOPS-10 and TOPS-20 operating systems.
Later DEC came out with the PDP line of computers. These computers ran various
operating systems: RSTS/E, RSX-11 and RT-11 among them. (Those coming from the
UNIX side of life may also remember that UNIX was originally developed on the PDP
hardware platform.) Each of the previously mentioned OS’s still have their followers
today. Though the job opening advertisements for those operating systems may be few
and far between now, you will still find some PDP hardware running today. There are
even some manufacturers making PDP-11 emulators to use inside various other boxes.
Each of the operating systems was designed to handle some niche applications incredibly
well; so well, some companies have opted not to replace them as long there is some method
of keeping them running.
When DEC came out with the VAX platform they had over a decade of seasoning and
think tanking by some incredible minds behind them. Both the platform and the
operating system were designed from the ground up to create a seamless network. Today,
with the Internet available to the masses for a fee, most would say “so what.” OpenVMS,
however, wasn’t designed today; it was originally laid out in the late 1970’s for platforms
selling in the early 1980’s. With OpenVMS came the original definition of clustering.
Many operating systems today claim clustering capabilities and many application
packages claim to be “cluster aware” on many platforms, but once you become accustomed
to the power, stability and flexibility of clustering in an OpenVMS environment, you will
see just how hollow those claims really are. We won’t cover much on clustering in this
book, not because there isn’t much to cover, but because once a system manager sets up
a cluster, the application developer really doesn’t care where the nodes are. When a
system manager chooses to mount a disk drive on one node as available to the cluster it
looks just like a local disk drive to the application developer no matter what node they are
Introduction I-5
working on. By “nodes” I’m not just talking about servers in the same building. These
machines can be anywhere in the world. I have personally consulted for companies that
had nodes scattered across the US, England, Ireland, Germany and other countries. From
time to time you may see some lag accessing one of the drives due to congestion on the
network, but you don’t access them any differently.
Batch queues, print queues, and ACMS (Application Control and Management
System) applications can be defined so that any node in the cluster can use them without
the faintest idea of where they are. Admittedly, you might want to know where the
printer actually is which is servicing a print queue, but you don’t have to. More
importantly, that printer could very well be on a different continent from the cluster node
servicing it. Indexed, sequential and other file types can be shared by multiple users from
any node in the cluster.
The Records Management System (RMS) on OpenVMS provides a feature developers
can choose to use called RMS Journaling. This works in unison with a component/product
called DTM (Distributed Transaction Manager). DTM keeps everything in sync and rolls
partial transactions back. This allows a developer a great amount of both freedom and
security. You can have a single transaction which encompasses multiple RMS Journalled
files and multiple RDB tables and know profoundly that nothing will be updated until you
actually commit the DTM transaction. If the power grid drops on your machine while
your program is running, when the OS comes back up and starts the DTM portion, DTM
cleans itself up. If you develop your application correctly, you can simply restart the
application once the system has come up and rejoined the cluster.
OpenVMS doesn’t suffer from the e-mail and other viruses which plague other
platforms. It has passed numerous DOD security tests. Some hacker conferences have
even declared the OS unhackable. While I would never go so far as to make that claim
about any OS, coming from groups like that it is quite a statement.
A concept which was pioneered on the PDP platform has become a force of
unprecedented power - logicals. We will cover logicals in Chapter 1. They are a truly
amazing creation which provide security, simplicity and complexity all at the same time.
A person could write almost an entire book just covering the concept and implementation
of logicals. This book will give you enough understanding about them to both use and
respect them.
I.7 The Definition of Application
For the purposes of this book and the possible follow up book I am defining application
as a single hosted program or set of programs running on a single cluster. While many
people would call these “systems”, I do not. In my view, “systems” development requires
a data interface to the outside world.
I-6 Introduction
While one could make the argument that an application which gets tapes loaded via
“sneaker net” is a system using a tape interface, in today’s world those types of systems
don’t usually exist. (Sneaker net refers to operators wearing sneakers running around a
computer room gathering print outs and handling tapes.) Systems in today’s world
interface via a communications library (MQ Series, Tibco, DECNET, Tuxedo, and if
desperate, TCP/IP) to non homogenous platforms. They feed each other in real time or
batch mode. Their function and failure is visible outside the company. Application failure
is only visible inside the company.
Chapter 1
Fundamentals of OpenVMS
1.1 Hardware
Covering all the hardware produced by DEC and third party companies over the years
would be a book of massive size and provide you with little information needed by an
application developer. What an application developer really needs to be aware of is the
terminals they will log in with. Occasionally you will need to know how to hit the
OFF-LINE button on a system printer, hit FORM FEED a few times, then hit OFF-LINE
again to put the printer back on-line, but those buttons are clearly marked on all printers
so I think you can figure it out.
Many types of terminals exist. The DEC series of terminals are referred to as VT
terminals for Video Terminal. (Some say it stands for Video Tube as all such devices were
called “tubes”; others say it stands for Video Text but many of these terminals handle
graphics.) Today all standard terminal models have 3-digit model numbers. The 4-digit
numbers are generally VXT terminals for multi-session X window type interfaces. The
granddaddy of them all is the VT-52. This was a massive black and white (monochrome)
terminal normally communicating at a whopping 150 or 300 baud working in upper case
all of its life. Yes, they could communicate faster, but the cable length had to be very
short. There were older terminals and paper consoles (yes, a printer with a keyboard built
into it) but the VT-52 seems to be when things were finally catching on. The VT-52
definition for the most part is the ANSI TTY definition with added formatting controls for
cursor movement. It's replacement, the VT-100, became the ANSI standard terminal and
is supported by a plethora of non-DEC operating systems. My first exposure to it was on
a PDP-11/70 running RSTS/E. This was also my first exposure to DEC equipment.
Today, regardless of the VT model, it will generally support VT-100 escape sequences
and functionality. Some newer models only go back as far as VT-220 which was one of the
first models supporting the enhanced keyboard used by later DEC terminals. Below is a
picture of the DEC style keyboard attached to my Alpha machine.
Of special interest
to us is the numeric
keypad on the right
hand side. When we
get to the section on
u sing the variou s
editors available on
OpenVMS you will see
that they are the
primary interface.
1-2 C h a pter 1 - Fundamentals of OpenVMS
Terminals are going the way of the abacus though. Most places today purchase a VT
terminal emulation package for a personal computer. I use one almost exclusively on my
notebook computer when traveling to client sites. The advantages of the emulator are
many. Most notably you can communicate over the office network at full network speed.
You can have multiple sessions opened on multiple machines and use your mouse to paste
between terminal windows. Emulators also give us the ability to paste to/from PC based
applications into the terminal. Above all, you can customize the colors almost anyway you
wish to make your computing experience enjoyable.
Notice the keyboard
layout. The numeric
keypad on the right has 4
PF keys across the top and
3 keys down the right side
below them. PC based
keyboards are short one
key in this area which can
make for some interesting
problems. The numeric
k e y p ad is h ow yo u
navigate through the
different text editors
available on OpenVMS.
When we get to the section
on using the EDT version
of the editor we will cover
this in significant detail.
Another point worthy of note are the [HELP] and [DO] keys at the top. In the TPU
version of the editor (and many OpenVMS applications) these two keys are used heavily.
The keys [F1]. [F2], [F3], and [F5] are quite significant. [F1] is the Hold key. This
stops the terminal scroll. You hit it again to turn scrolling back on. It does not stop an
application that is running or turn off output. This key is also mimicked by <ctrl><S>
(hold) and <ctrl><Q> (end hold) combinations. [F2] is the screen print key. If your
terminal has a printer attached to the back of it (or a network printer setup via the
SETUP key) when you hit this key it causes the contents of the screen to be dumped to the
printer. You can turn on a scrolling print by pressing <ctrl>[F2] and turn it off by hitting
the same key combination again. [F3] is known as the SETUP key. When you hit it, one
or more menus will pop up that you can navigate through setting all the possible
configuration parameters for your terminal. There are too many to go into here and they
vary terminal to terminal. Basically all aspects of how the terminal communicates with
the outside world and appears to you are controlled here.
[F5] is a key of special importance. Unless your terminal is hooked up to a LAT or is
a multi-session enabled terminal you should NEVER hit this key. When the terminal is
hardwired as the console for many systems (central terminal used by operators on a
Chapter 1 - Fundamentals of OpenVMS 1-3
special port on the machine) hitting the BREAK key can halt the entire system for all
users. You will know you have done this when you see the following prompt: >>>. If you
do not type RES and hit <return> before an internal time-out occurs on the box you will
have crashed the entire system for all users. Don't play with this key unless you know
what you are doing. On old paper terminals hooked up as system consoles the
combination of <ctrl><p> used to duplicate this function. More than one operator went
to hit <ctrl><o> to turn output off for something and accidentally hit <ctrl><p>.
The combination of <ctrl><o> is used to turn output off. This is not like “hold” which
simply stops the scrolling so you can read it. This combination routes the output to the
bit bucket until the command interpreter regains control.
Most of the remaining function keys across the top are available for application usage.
Their function will vary based upon what program you are running.
1.2 Logging In
The first terms you need to become familiar with are “Logging On” and its counterpart
“Logging Off.” (Also called “Logging In” and Logging Out.”) “Logging In” is the process
of getting “Logged In”. (Sorry, I couldn't resist doing a Webster on you.) We will start
with the easy scenario assuming you have a single session terminal hooked up via a serial
connection. We will also assume that you have been assigned a user ID of FRED with a
password of MY_PASSWORD. (Neither user names nor passwords are case sensitive in
the OpenVMS environment.) Your password will not be displayed while it is typed.
<return>
Username: FRED
Password:
Welcome to ....yada yada yada
$
The “$” is the default prompt on a OpenVMS system. Most system managers will
have changed the prompt to be the name of the node you are logged into followed by
“->.” So you see something like
Kirk->
instead of the $ prompt. In fact let me show you how to change the prompt so it shows
your node name instead of the default $. Doing this requires the use of a lexical function
which we will talk about later on. If you are exploring on your own for a while you can
type HELP LEX at your command prompt to display the lexical functions available to you.$ set prompt='f$getsyi(“nodename”)->
LGKL1->
Once logged into a system you should take a few moments and explore the HELP
command. This command will bring up a wealth of system help information and allow you
to navigate through it. Help is very intuitive. When you want out of HELP just keep
hitting <return> until you get back to your system prompt.
1-4 C h a pter 1 - Fundamentals of OpenVMS
After you have finished (or gotten tired of) going through HELP take a few moments
and get familiar with the disk structure on your system. To do this use the SHOW
DEVICE D command. The command will respond with a list of all devices starting with
the letter D attached to your system. Both disk drives and CD-ROM drives will be
reported.
$ show dev d
Device Device Error Volume Free Trans Mnt
Name Status Count Label Blocks Count Cnt
LGKL1$DKA1000: Mounted 0 SYS 15184692 467 1
LGKL1$DKA1200: Mounted 0 DEV 16248006 1 1
LGKL1$DKB0: Online wrtlck 0
LGKL1$DVA0: Online 0
Many different configurations exist for DEC equipment. You can have “shadowed”
drives, logical drives, etc. The topic fills an entire chapter in OpenVMS systems
management guides so we won't go into it any further. From the application developer
standpoint a disk is a disk (as long as it is mounted and write enabled).
Error count is the number of soft or hard errors a drive has logged since system boot.
Drives under OpenVMS should be error free. When a bad spot is encountered it is
mapped out by the disk subsystem and logs a soft error. If a drive starts logging a lot of
errors it is going bad and needs to be replaced. You should get everything you have on it
backed off to tape so the drive can be swapped out.
Had we chosen to look at devices starting with “m” instead of “d” the error count could
be anything. While many types of devices can start with an “m,” traditionally you will see
the tape drives at the top of the listing. A tape drive will log an error any time it
encounters a dirty or bad spot on the tape and has to skip over it. Back in the days of mag
reel tapes it was not uncommon to see this count be well up into the thousands. Even
when we cleaned the tape drive heads every day there was still enough paper dust floating
around the computer room to cause issues. Keep in mind that up time for OpenVMS
boxes is measured in years, not days. The error count isn’t cleared until the system
reboots.
Volume label is the name the disk was initialized with. Normally sites label drives
for their intended purpose. SYS is obviously the system boot disk. Similarly, drives with
labels DEV would be for developers use, WARHSEn would be for warehouse use, etc. As
an application developer you need to be aware of such things only if your systems
manager hasn't already created a directory on a drive for you to use when testing your
application.
Free blocks is the number of blocks remaining for use on the drive. A block on disk
is 512 bytes. On VAX systems a disk block was equal to a page size in memory. On alpha
systems the page size can be any number of pagelets that your system manager specifies.
A pagelet, however, is still 512 bytes.
Every disk drive has a “root” directory [000000]. Under OpenVMS directory
information is enclosed in square brackets. OpenVMS also has a concept foreign to most
Chapter 1 - Fundamentals of OpenVMS 1-5
computing environments known as versioning. The full file specification for your
LOGIN.COM file could well be like:
DUA1:[FRED]LOGIN.COM;4
DUA1 is the disk where your directory resides; [FRED] is the directory; LOGIN.COM
is the file name; and 4 is the version. If you were to edit this file and save it, the new file
specification would be the same, but the version would be 5. In order to get rid of older
file versions, you can use the PURGE command. (Please refer to the information in HELP
on the PURGE command.) File versioning is an incredibly powerful tool and one of the
many reasons OpenVMS (RMS) has thrived for so long. (RMS = Records Management
System.) Every time you create a file, it gets a version number attached to it. If it is the
first time that file has been created at that current location (no other file exists with the
same name), it gets a version of 1. If you are executing a directory command and only
want the top most level of files, you do as follows:
LGKL1->dir
Directory DKA1200:[HUGHES.MEGA_ZILLIONARE]
DRAWING_DATA.TXT;1 DRAWING_NUMBERS.TXT;1 ILLINOIS_MEGA.FDL;1
ILLINOIS_MEGA.IDX;5 ILLINOIS_MEGA.IDX;4 ILLINOIS_MEGA.IDX;3 IMPORT_MEGA_CSV_FILE.C;30
IMPORT_MEGA_CSV_FILE.DIA;6 IMPORT_MEGA_CSV_FILE.EXE;20
IMPORT_MEGA_CSV_FILE.EXE;19 IMPORT_MEGA_CSV_FILE.OBJ;18
IMPORT_MEGA_CSV_FILE.OBJ;17 MEGA_IDX_FILE.IDX;1 M_ZILLIONARE.H;2
Total of 14 files.
LGKL1->dir *.*;0
Directory DKA1200:[HUGHES.MEGA_ZILLIONARE]
DRAWING_DATA.TXT;1 DRAWING_NUMBERS.TXT;1 ILLINOIS_MEGA.FDL;1
ILLINOIS_MEGA.IDX;5 IMPORT_MEGA_CSV_FILE.C;30 IMPORT_MEGA_CSV_FILE.DIA;6
IMPORT_MEGA_CSV_FILE.EXE;20 IMPORT_MEGA_CSV_FILE.OBJ;18
MEGA_IDX_FILE.IDX;1 M_ZILLIONARE.H;2
When you want to get rid of older versions of files, you can specifically delete those
versions or you can use the PURGE command. You can purge entire directories, trees of
directories or single files. There are qualifiers which can be used on the PURGE
command; the most commonly used is /KEEP=n. This allows you to specify how many
versions to leave lying around. Some directories get set up by the system manager to have
no version limit which means you could get many thousands of the same file name in the
directory. Most system managers tend to set the version limit to 3 when creating
directories for developers, since we tend to be the ones creating the most files and the ones
most likely not to purge.
1.3 Symbols
One of the simplest concepts under OpenVMS is symbols. A symbol is much like a
program variable name in other languages. A symbol can store either string text or
integer values. Symbols are declared when they are first assigned and have either local
or global scope. Regular symbols which contain string values should have those values
1-6 C h a pter 1 - Fundamentals of OpenVMS
assigned in quotes (more on this to follow shortly). A symbol can be assigned another
symbol value without putting the other symbol in quotes. Some examples:$ a = 255
$ a :== edit/edt a.lst
$ show symbol a
A = 255 Hex = 000000FF Octal = 00000000377
$ show symbol/global a
A == “EDIT/EDT A.LST”
Notice that the same symbol name was used but the values are stored separately?
That is because a single “=” means local scope while a double “==” means global scope.
You can view the scope as being two separate boxes we put things in. These boxes also
have two different lifespans. The local symbol dies with the command file that created it.
The global symbol exists for the life of the parent process and can be accessed by any child
process. If there are symbols you want every user to have on your system then you need
to put their creation in the command file SYS$MANAGER:SYLOGIN.COM
$ show symbol/global a
A == “EDIT/EDT A.LST”
$ show symbol a
A = 255 Hex = 000000FF Octal = 00000000377
$ delete/symbol a
$ show symbol a
A == “EDIT/EDT A.LST”
$ show symbol/global a
A == “EDIT/EDT A.LST”
What happened? When OpenVMS is asked to retrieve a symbol value it first looks
through the local box, then the global box and returns as soon as it finds the first
definition. When we deleted the local symbol 'a' that left only the global definition. In
other words, our local definition of 'a' hid the global definition of 'a' from the command
interpreter. BE VERY CAREFUL when mixing global and local symbols. A single typo
can render the definition you want invisible.
Let's explore another example before we get into the other difference you should have
noticed above.
$ c = “This is my text”
$ d := This is my text
$ e = c
$ f = d
$ show symbol c
C = “This is my text”
$ show symbol d
D = “THIS IS MY TEXT”
$ show symbol e
E = “This is my text”
$ show symbol f
F = “THIS IS MY TEXT”
There are lots of little information nuggets to be mined from this example. The line
assigning a value to the symbol 'c' creates a local symbol storing text as does the line
assigning 'd', but my! aren't they different? Notice when we display their values with the
SHOW command one is exactly as it was entered and the other is converted to upper case.
Even odder is the fact that these values were directly assigned to the 'e' and 'f' symbols
Chapter 1 - Fundamentals of OpenVMS 1-7
created below, or is it?
OpenVMS does not alter the case of text found within quotation marks. (Keep in mind
the EXACT phrasing of that when looking at examples to come later.) When := is used
instead of = for the assignment this tells OpenVMS to treat all values following the := to
end of line as literal text characters. When OpenVMS interprets the values supplied to
such an assignment it converts the literal text characters to uppercase and does not
perform any symbol substitution.
What is “symbol substitution?” The assignments into the symbols 'e' and 'f' caused one
form of symbol substitution to happen. We will discuss some others in later examples.
The technical definition of symbol substitution is when the “value” of a symbol (be it
integer or text) is substituted in place of the symbol.
$ f := d
$ show symbol f
F = “D”
See the difference in the second assignment of 'f'? Use of the := instead of the = caused
OpenVMS to interpret the character d as literal text and perform no symbol substitution.
Let's try a few more examples of symbol substitution.
$ x = “blue”
$ y = “red”
$ z = “green”
$ sen1 = “my favorite color is ''x' “
$ sen2 = “my favorite color is ''y' “
$ sen3 := “ my favorite color is ''z' “
$ sen4 := my favorite color is 'x'
$ show symbol sen1
SEN1 = “my favorite color is blue”
$ show symbol sen2
SEN2 = “my favorite color is red”
$ show symbol sen3
SEN3 = “ my favorite color is green”
$ show symbol sen4
SEN4 = “MY FAVORITE COLOR IS BLUE”
Your first question probably revolves around ''x'. Even though it may look like a
double quote in front of x it is really two single quote characters (i.e. ' ' x ' without any
intervening spaces). When the command interpreter encounters two single quote marks
(also called a tick) inside of a fully quoted text string it tries to interpret the following
value as a symbol and perform symbol substitution for it. On many new releases of
OpenVMS the trailing tick (single quote) is not required, but I highly recommend you use
it for both readability and portability back to older OpenVMS versions.
The last two examples were given to stress operation of the := operator. You can put
quotes around the literal string following this operator to tell OpenVMS not to convert its
case. If you don't put the quotes as the last example shows, the text gets converted to
upper case. Why were there only single ticks around x in the last assignment? Because
we weren't inside of quotation marks. When doing a straight symbol to symbol
assignment you can put the tick marks around the source symbol, but they aren't
required.
1-8 C h a pter 1 - Fundamentals of OpenVMS
$ k = sen4
$ show symbol k
K = “MY FAVORITE COLOR IS BLUE”
$ l = sen1 sen2 sen3
%DCL-W-EXPSYN, invalid expression syntax - check operators and operands
$ l = sen1 + sen2 + sen3
$ show symbol l
L = “my favorite color is bluemy favorite color is red my favorite color is green”
I give this example to show that OpenVMS doesn't perform concatenation by default.
You can, however, concatenate string symbols with the + operator. The following example
should astound you.
$ k = k - “favorite”
$ show symbol k
K = “MY FAVORITE COLOR IS BLUE”
$ k = k - “FAVORITE”
$ show symbol k
K = “MY COLOR IS BLUE”
Yes, OpenVMS allows you to do string subtraction. As this example shows, however,
the string must match exactly, including case. This makes it handy to build symbols
which can be used to define logicals pointing to specific directories, such as follows:
$ J = F$DIRECTORY()
$ K = J - “]” + “.DATA]”
$ SHOW SYMBOL J
J = “[ROLAND]”
$ SHOW SYMBOL K
K = “[ROLAND.DATA]”
For now, just keep the above example in the back of your mind. We will discuss lexical
functions, et al. later in this book. At this point I need to give numeric symbols a once-
over lightly.
$ a = 3
$ b = 2
$ c = a / b
$ d = b / a
$ show symbol c
C = 1 Hex = 00000001 Octal = 00000000001
$ show symbol d
D = 0 Hex = 00000000 Octal = 00000000000
You can only do INTEGER math. That means there is no rounding or decimal point
values stored.
$ pi = 3.414
%DCL-W-IVOPER, unrecognized operator in expression - check spelling and syntax \.414\
The standard math symbols of * (multiplication), - (subtraction), / (division), and +
(addition) are supported, but be careful about trusting your results from division, as it is
integer math. Values are assumed to be decimal but can be hex or octal. You can
explicitly force a representation by preceding the value with % and the base letter D =
decimal, X = hex, O = octal.
Chapter 1 - Fundamentals of OpenVMS 1-9
$ j = %d32
$ k = %x32
$ l = %o32
$ show symbol j
J = 32 Hex = 00000020 Octal = 00000000040
$ show symbol k
K = 50 Hex = 00000032 Octal = 00000000062
$ show symbol l
L = 26 Hex = 0000001A Octal = 00000000032
We do need to make a brief mention of binary symbols at this point. They are quite
different from “numeric.” Please examine the following:
$ normal_bell = %x07
$ bell[0,7] = %x07
$ write sys$output normal_bell
7
$ write sys$output bell
When you type the above 4 lines in you will notice that the warning bell beeps after
you hit return on the last line, but the line above it printed out a “7”. The subscript told
OpenVMS which bits to stuff the value of hex 7 into. If you were lucky enough to have
been forced through a COBOL course during your education then this concept is not
unfamiliar to you. It is the difference between PIC 9 and PIC 9 USAGE IS COMP. The
first is a character representation restricted to numeric values and spaces, while the
second is a platform specific binary representation. Both hold a number, yet they are in
completely different forms.
The “bell” symbol is one you will put in almost every production command file you
write. I almost wish OpenVMS would make it a constant symbol. Normally when
providing your own error handling you will wrap the display of error messages within a
specific series of bells to obtain the user’s attention.
You can do many wonderful things with OpenVMS symbols once you have mastered
the creation of command files. We will cover many more symbol capabilities later. First
we must show you the tools that will be used to create both command files and text files.
1.4 Editor Choices
There are quite a few editors available on the OpenVMS platform. Depending upon
whether you are developing on a VAX or an Alpha platform your system default editor will
either be EDT or TPU. A third editor LSE is a phenomenal programmers editor. If your
company has installed the DECSet product which includes MMS and CMS it should be
available to you. You may have to declare a symbol to invoke it though as some
installations don’t define the LSE symbol. If you type LSE at the command line and get
an error, then type LSE :== $LSEDIT. (colon followed by 2 equal signs). If it has been
installed on your system you should then be able to invoke LSE by typing LSE.
1-10 C h a pter 1 - Fundamentals of OpenVMS
EDT is one of the editors which has existed since the days of PDP running RSTS/E.
It was/is a line editor originally designed for use with paper terminals. Don’t worry, it has
a very powerful screen mode. Years ago EDT used to look for an initialization file called
EDTINI.EDT. Somewhere along the way this has changed to be a logical called EDTSYS
then a fall back logical called EDTINI. Since I’m an old timer we will set it up the old
way.
Hopefully nobody did you a favor when setting up your account as I am going to take
you through setting up your LOGIN.COM and EDTINI files. EDT was the default system
editor for the longest time on OpenVMS, but most newer releases seem to make TPU the
default editor. While TPU can handle much larger files and many more file types, its
name comes from Text Processing Utility. Those of us who grew up with EDT don’t like
TPU, only using it when we have to. LSE is the pride of the line for developing software,
but EDT still has a few features which LSE either lacks or has so hidden I have never
found them. Log into your account and type the following:
$EDIT/EDT EDTINI.EDT
If nobody set anything up for you there will be a “*” prompt which appears. At that
prompt type the letter C and hit <return>. Doing so will take you to screen mode. If you
came up in screen mode then you probably already have a few lines in this file. Just
follow along and add what you feel is missing from your INI file. If you get an error
saying EDT is unavailable on your system please skip down to where we start setting up
TPU. I like to have the following lines in my EDTINI.EDT file:
set mode change
set screen 132
set tab 4
Once entered hit <ctrl>-Z on your keyboard to bring up the “*” prompt. At that
prompt type EX for EXIT and hit return. You may wish to skip the SET TAB 4 command
as some places don’t like you to change your TAB size from the default of 8. When
working with C and other languages I find the default TAB setting of 8 characters is just
too deep. An 80 column (the default) screen width is also just too narrow for serious
programming with lots of right margin comments.
Now, hit the up arrow on your keyboard while sitting at the prompt. You will see the
command recalled for EDT. Hit enter. If all was entered correctly your screen should
come up in screen mode and you should see the contents you chose to type.
When you first bring up EDT it looks for the logical EDTSYS. If it doesn't find
anything it will look at the logical EDTINI. Should that logical be defined it will execute
that command file; if not defined it looks for EDTINI.EDT in your current working
directory. When neither are defined it defaults to line mode which is the little “*” prompt.
The entire bunch of searching is completely overridden when the /COMMAND qualifier
is used.
Chapter 1 - Fundamentals of OpenVMS 1-11
Here is the definition of the commands you provided: “set mode change” causes the
editor to come up in change mode just as if you had typed “c” at the “*” prompt; “set
screen 132" causes the editor to change your terminal display to 132 column mode while
editing; “set tab 4" causes the editor to change the default tab fill size to 4 characters
instead of the terminal default (normally 8). A tab size of 4 makes nesting IF statements
and other logic structures much more endurable. Since EDT doesn't allow us (the
programmers) to shift the screen right and left as LSE and other editors do this is
necessary.
Now we need to set up a symbol in your LOGIN.COM file so you don't have to type so
much each time you wish to edit. Type the following:
$ EDIT/EDT LOGIN.COM
Enter the following into your LOGIN.COM file (near the top if the file isn't empty):
$ EDT :== EDIT/EDT/COMMAND=SYS$LOGIN:EDTINI.EDT
Once again hit <ctrl>-Z to obtain the “*” prompt and type EX to exit. A new version
of your LOGIN.COM has been created. Type the following:
$ SHOW SYMBOL EDT
%DCL-W-UNDSYM, undefined symbol - check validity and spelling
$ @LOGIN.COM
$ SHOW SYMBOL EDT
EDT == “EDIT/EDT/COMMAND=SYS$LOGIN:EDTINI.EDT”
@ tells OpenVMS to run a DCL command file in the current process. We will discuss
this later. Now log out of your OpenVMS system and log back in. Then type the show
symbol command again. You will see that EDT is defined now each time you log in.
EDT is your friend. You will spend many hours using it and its operation sets the tone
for many other applications on the OpenVMS platform. EDT is not without limitations.
It doesn't like record/line lengths exceeding 255 bytes and shouldn't be used for data files
with binary data. EDT has file size limits, which you will never hit writing program code,
but you can hit if you try to work with data files.
The world of EDT is opened up by the keypad. Below is the standard help screen you
get when you hit the [PF2] key on the top of the numeric keypad when using a VT
terminal. (If you are using an emulator, you will need to check your emulator keyboard
mapping.) When you look at the numeric keypad layout on the right, you read it as
follows for dual function keys: top function is default function; bottom function is used
when the GOLD key has been hit just prior to this key.
1-12 C h a pter 1 - Fundamentals of OpenVMS
Thus, to find some text in a program or command file, you would hit [PF1] followed
by [PF3] (GOLD then FIND, not together as in <ctrl>-Z). You would then be prompted
at the bottom of the screen for the text to find. If you want to search for the text
backwards from where you are, you follow the entry by hitting the [5] key on the keypad.
To search forward you hit the [4] key. If you just hit [ENTER] from the numeric keypad
(not <return> from the keyboard), then the direction you last set with the keypad will be
used.
Remember, EDT used to be a command line editor before there were Video Tubes. A
wealth of command line functions exists. You can get EDT to tell you about them by
hitting [PF1] (GOLD) and [7] from the keypad. This will give you a little “*” prompt at the
bottom of the screen. At that prompt, type HEL and hit [ENTER] from the keypad. A
short help screen giving general commands will be displayed. Regrettably, you cannot
navigate this help screen as you can the keypad help. This is due to the fact it is for the
command line interface.
You can get help on a topic by typing HELP topic. If a topic is abbreviated, HELP
displays the text for all topics that match the abbreviation. Below are the results of typing
“HELP HELP”.
HELP topic subtopic subsubtopic...
A topic can have one of the following forms:
1. An alphanumeric string (e.g. a command name, option, etc.)
2. The match-all or wildcard symbol (*)
Examples: HELP SUBSTITUTE NEXT
HELP CHANGE SUBCOMMAND
HELP CH
If a topic is abbreviated, HELP displays the text for all topics that
match the abbreviation.
Chapter 1 - Fundamentals of OpenVMS 1-13
Additional information available:
CHANGE CLEAR COPY DEFINE DELETE EXIT FILL
FIND HELP INCLUDE INSERT JOURNAL KEYPAD MOVE
PRINT QUIT RANGE REPLACE RESEQUENCE SET SHOW
SUBSTITUTE TAB TYPE WRITE
Press return to continue
Perhaps you should feel some sense of accomplishment here. You are already familiar
with some of the commands (i.e. CHANGE, EXIT, and SET). Remember when you had
to type “C” at the “*” prompt to get into screen mode? That was the CHANGE command
to get into screen editing mode. EXIT saved your file when you were done editing. (If you
want to get out without saving use QUIT.) You were also exposed to the SET command
when you created your EDTINI.EDT file. Notice that some of the command line
commands have SET synonyms? SET MODE CHANGE is the same as CHANGE at the
“*” prompt. This is not an accident. It allows you to do wonderful things with EDT from
inside of batch jobs with no terminal attached to the process.
TYPE is a command you will never use. It was there from paper terminal days and
allowed you to type out a range of lines to the display so you could use the other edit
commands to make changes to the code/text.
FIND is a command that doesn't do what you might think. EDT is a “multi-buffer”
editor. You can edit only one file at a time, but can have many files open in other buffers
which will be opened in read mode. This is extremely handy when you wish to cut and
paste between programs. If you decide you would like to save your changes from inside
another buffer you can use the WRITE command to write the contents of the buffer to a
file. (You can also just write the contents of a selected range to a file.) To bring a file into
one of these buffers you use the INCLUDE command.
SUBSTITUTE is the command you need to be most familiar with. You can do mass
text substitutions over selected ranges, to the top or bottom (REST) of the file depending
on direction set from keypad. EDT is not a case sensitive editor. When you issue either
a SUBSTITUTE command or use the [PF1] [PF3] combination to find text it finds the text
regardless of case. EDT does not convert case on a substitution. If you enter lower case
text as the replacement text, it will be put into the buffer exactly in that manner.
WRITE is an incredibly useful command. It allows you to save the entire file or a
selected range of lines to either your current file or a new file. I’m sure you have heard
the old adage “save early, save often.” Well this command allows you to do that
without exiting the editor.
INCLUDE is useful when you are using WRITE to save selected lines from one file
into a new file. The INCLUDE command inserts the contents of a file directly at the line
your cursor is on. Let us say you need to thieve a routine out of one large program to use
as the basis for a function in your new program. You open the original program in read
mode (so you don’t accidentally change it), select the lines of the routine you need, write
them to a new file (A.A), then quit out of the read mode edit session. Now you open the
program you are working on, “goto” the line where you want the routine to appear, then
1-14 C h a pter 1 - Fundamentals of OpenVMS
use INCLUDE A.A to bring the source file in.
By now your head is probably spinning from all of this. Take a few moments to go
through the HELP for command line functions. We will then begin an exercise to show
you a lot of tricks you will normally use when editing.
1.5 EDT Exercises
Let's start with some simple EDT editing. At the $ prompt (or system prompt if your
sysadmin has changed the $ prompt to be something else) type EDT TEST.COM. If you
have modified your LOGIN.COM file as instructed above this should bring up the EDT
editor in full screen mode with an [EOB] indicator at the top of the screen and “Input file
does not exist” message displayed at the bottom. Type the following so your screen looks
like this:
$ show symbol edt
[EOB]
Your cursor will be sitting after the “t” in edt. Now hit the F12 key on your keyboard.
On VT terminals this is the Backspace key and most VT emulators set the F12 key up this
way as well. If not, find out how to change your emulator to do such. (Reflections and
KeaTerm both allow you to do this via the Keyboard entry in the Options pull down
menu.) The cursor will be over the “$.” The Backspace key takes you back to the
beginning of the line. What we want to try now is selecting the text to paste it back in.
Although this example is mundane it will show you the basic skills you need. Hit the
period key on the numeric keypad. This is the Select key. Then hit the 2 key on the
numeric keypad. The 2 key is the End of Line (EOL) key. You will see the cursor jump
to the end of the line and the entire line enter some “reverse video” color state (depending
upon your emulator it will be reverse or color change). Hit the 6 key on the numeric
keypad. This is the Cut key. The line will disappear into the paste buffer and your [EOB]
will be all that is left. Now hit the “Gold” key. If you are running an emulator this should
be the Numlock key on your keypad. On a regular VT terminal this is the PF1 key.
Follow that by hitting the 6 key from the numeric keypad. The line will be pasted back
into the buffer and your cursor will be right where it was. The cursor will be at the end
of the line of text like it was.
Keypad operations in EDT are direction sensitive. When the editor is first started it
defaults to Forward or Down direction. You can change this to Reverse or Up direction
by hitting the 5 key on the keypad. Forward direction can be restored by hitting the 4 key
on the numeric keypad. Nothing visibly changes when you hit either of these keys so you
just have to remember what direction you are in. We will give an example shortly.
Nuking a line is even easier, provided you know what you are doing. Hit the F12 key
to get us back to beginning of line. Your cursor should be sitting on the “$” character of
this line. Hit the PF4 key (on most emulators this is the “-” key on the numeric keypad).
Notice how the line disappears AND the [EOB] marker moves up as opposed to just the
line disappearing when you deleted before? This is because you actually removed the line
Chapter 1 - Fundamentals of OpenVMS 1-15
including the internal indicators used by EDT/RMS to mark the end of the record. Is this
a dangerous single key? It can be if you aren't careful. But there is some relief for
“ignosecond” moments built into the editor. Hit the Gold key and the PF4 key again.
Presto, the line is back.
Undo levels are limited to one for each of the delete operations. That means one undo
for single line, selected text, single character, and single word deletions. You get these
items back by hitting the Gold key and the key used for the deletion.
Single word and single character deletions? This is where VT emulators need a little
help. The “-” key on the VT numeric keypad and the “,” are used for single word and
single character deletions respectively. They are direction sensitive as discussed above.
The PC keyboard is simply one key short. I always modify my “+” key in my emulator to
be the “,” key equivalent and the <CTRL>+ version to be the “-” key equivalent. How you
do this depends on your emulator of choice. Both KeaTerm and Reflections offer a simple
keyboard mapping interface from the Options pull down menu. While you are there you
will probably have to override the default behavior for the “backspace” key on the PC
keyboard to be Delete not Backspace. You may or may not have to set up your F12 key
to be the same as the F12 key on the VT keyboard depending upon what version of the
products you are using. Please take a few moments to do this now.
If your keyboard emulator is running in VT 220 mode or higher you will see that
the following rectangular block of PC keys are normally mapped kind of funky too:
INSERT HOME PAGEUP
DELETE END PAGEDOWN
When mapped as a 1 for 1 match against the VT keyboard they map as follows:
FIND INS REM
SEL PREV NEXT
Most VT emulators will graciously map page up and page down to be PREV and
NEXT. DEC was into document setup at the time it created the 220 keyboard layout.
PREV and NEXT mapped the way they are fit beautifully with the scenario of turning
pages in a book. The rest of the world went with page up and page down because PCs and
other systems didn't get into document processing until years after the keyboard layout
had been standardized.
REM, however it is mapped, sends the Del character as you are used to with the PC
backspace key. SEL is the equivalent of the “.” on the keypad. FIND is a key combination
we haven't covered yet, but it allows you to search for text. While these keys have become
supported in EDT they were really meant for use with All-In-One (a DEC office products
package) and the TPU editor.
By now you should have set up your keypad so the “+” key is the “,” from the VT and
the <CTRL>+ combination is the “-” from the VT. Your cursor should be sitting over the
1-16 C h a pter 1 - Fundamentals of OpenVMS
“$” in our entered text and you should be in Forward/Down mode. Hit the 1 key on the
numeric keypad twice. This should place your cursor over the top of the “s” in “symbol”.
Hit the equivalent of the “,” key on your numeric keypad. The “s” disappears. Hit the
Gold key then the “,” key. You will see the “s” reappear. Now hit the 5 key on the numeric
keypad. Then hit the “,” key. Now hit the Gold “,” combination to restore the character.
Even though keypad operations are direction sensitive the single character delete only
deletes the character which is directly under the cursor.
Now hit the “-” equivalent on your keypad. You should still be in Reverse mode. See
the word “symbol” disappear. Just like single character deletions, word deletions delete
up to the next word. A word in EDT is defined by blank space or a tab character. Other
editors like LSE and TPU allow you to define words to be punctuation characters and
other such things. Indeed, LSE defines these for you automatically depending upon what
type of source file you are editing.
There are some handy CTRL key combinations you need to know when working with
EDT. <CTRL>H takes you to the beginning of line (just like F12). <CTRL>J deletes to
the beginning of the current word. <CTRL>U deletes to the beginning of the line. There
is no undo level for these keys so use them with caution. <CTRL>J is the ASCII
equivalent of the Line Feed character. <CTRL>F will insert a Form Feed character into
your text. The form feed character is ignored by most language compilers and is useful
to break your program listings up across pages.
EDT is a single file editor, but has multi-buffer capabilities. To explore this we
need some more text to work with. Type the following lines so your text looks like this
in EDT:
$ show symbol edt
$ show logical sys$login
$ show logical sys$error
$ show default
Using your newly gained knowledge (or the arrow keys and brute force determination)
place the cursor at the “$” character of the line “$ show logical sys$error.” Select the text
(using the period key and the 2 key to go to end of line) then cut it with the 6 key. Now
hit GOLD and the 7 key from the keypad. This will drop you to the EDT line mode
prompt “*.” Type F=PASTE and hit the enter key on the numeric keypad not the
typewriter keys. You will be taken to the PASTE buffer. (EDT is not case sensitive so you
can type the above in either lower or upper case.) Whenever you FIND a buffer this way
you are taken to the top of the buffer. You can go back to the original line you were on by
ending the buffer name with the character “.”. Hit the Gold 7 combination again and type
“F=MAIN.” making sure to include the period at the end of the buffer name. The file
which you are currently editing and which will be saved upon exit is always kept in the
MAIN buffer. When you hit the ENTER key from the keypad you will be taken back to
the line you were currently on with the cursor where it was. Hit the Gold 6 combination
to paste the line back into the buffer. Hit Gold 7 again and type F=PASTE without the
period. See, the line is still in the paste buffer. This allows you to re-paste a block of text
as many times as you wish. Hit Gold 7 and find your main buffer again.
Chapter 1 - Fundamentals of OpenVMS 1-17
The multi-buffering capabilities of EDT allow for some astounding source file editing
to occur. Hit the Gold 4 combination from the keypad to go to the bottom of our text. Now
hit the Gold 7 combination and type INC SYS$LOGIN:LOGIN.COM then hit the enter key
from the keypad. You will see that EDT includes the contents of your login.com file
exactly where your cursor is. If you will be writing a new program that is really close to
an existing program you can edit a new file then use this technique to pull in the source
from the other program and begin making changes.
Say you want to only include part of a file into your new or existing file. Hit the Gold
7 combination and type INC SYS$LOGIN:LOGIN.COM =SCND then hit ENTER. Presto!
You have a shiny new read-only buffer which includes the file LOGIN.COM. You can then
use your select & cut knowledge to cut the lines you want to the PASTE buffer. Once done
you can find your MAIN buffer, then paste the contents of the PASTE buffer right where
you want them. Give it a try. If you are uncomfortable in doing it this way you can type
F=SCND to create the new buffer and then use the INC command to pull in the file. Both
methods work.
No matter which buffer you are in, if you are in write mode when you exit EDT the
contents of MAIN will be saved upon exit. If you do not wish to save the contents use
either QUIT to exit EDT. How do you exit EDT? You can type either Gold 7 or <CTRL>Z
to get to the EDT command prompt. Then type EXIT and hit ENTER from the numeric
keypad.
If you are used to GUI editors in PC environments this may seem somewhat crude.
One has to realize that EDT has been around since the days of the PDP series computers
of the 1970's. It hasn't changed much since those days either. We haven't even gotten
into how to search for text or change case or do mass substitutions yet. You can also edit
a file in Read mode which only allows you to Quit out of it so there is no chance of
accidental change to the source file. EDT also has one feature which is indispensable to
BASIC programmers. It allows you to search for a target that contains a carriage return.
Most important if you wish to search for a line number and not have to skip through all
the branches to it.
EDT also has the capability to run without a terminal. You can execute any of the line
commands from within an EDT command file. If you happen to have a bunch of files
which need several substitutions done on them for the same text you can create an EDT
command file to loop through processing all of the input files. You have already done a
small EDT command file with EDTINI.EDT when you set up your LOGIN.COM file. EDT
command files are invoked when EDT is started by adding the /COMMAND=file.name to
the edit command.
Hopefully you still have your TEST.COM file open in the editor. If not, open it now.
Arrow down and use the keypad to select two of the lines beginning with “$ show.” Once
that is done hit the Gold 7 keys on the keypad to get to the command prompt. Type the
command exactly as shown below:S|show|SH|sel
1-18 C h a pter 1 - Fundamentals of OpenVMS
You can use any separator character which is not contained in the text you are
substituting or search. I use the “|” (pipe) character because it normally doesn't occur in
source code. Many programmers use the “!” character. The syntax of this editor command
is Substitute separator search_text separator replacement_text separator range. We used
a range of “sel” to indicate we wanted the substitution to occur in only the selected range
of lines. The default is to substitute on the line you are on only. (You may remember I
mentioned before that EDT had some features LSE doesn’t. Range substitution is one of
them.) Other options are “wh” for whole and “rest” for the rest of the file. (Rest is
direction sensitive.) When you hit the ENTER key on the keypad to execute the command
you should see a report that two substitutions have occurred and be prompted to hit
return. Notice that no matter what case you used to type the “show” text in your file EDT
found it and did an EXACT replacement. EDT is a program file editor, not a document
text editor. It replaced “show” with “SH” where it found it. Other editors like TPU are
case sensitive when doing searches and unless told to do otherwise will alter the text case
to match the case which was replaced. This is a major difference between program editors
and word processing type text editors.
If you have a very large source listing or text file, and you wish to get to a specific
editor line (notice I say editor line instead of source line number) you simply hit the Gold
7 combination, at the prompt, type in the line number, then hit Enter from the keypad.
You will be taken to that line in the editor buffer.
1.6 TPU and EVE Configuration
Many of the sites you go to as a OpenVMS consultant or employee will have only the
system default editor, which is currently TPU in most versions of OpenVMS. While you
can make TPU work for you, it initially had way too many word processorisms to be useful
as a programming editor. TPU came out around the same time as an office package called
All-In-One. As an office package, for the time it came out, All-In-One was landmark. As
a programming environment, it made us old-timers grind our teeth down past the
jawbone. The keypad is/was completely different from the keypad layout for EDT. (Layout
was called WPS for Word Processing System.) TPU had word wrap automatically turned
on. TPU did case sensitive substitution and searches. Most environments that make
developers use an All-In-One environment never let them get to a dollar sign prompt.
On the upside, All-In-One did allow for true document collaboration. If the accounts
were set up correctly for the word processing group, they could all work on the same
documents. It did put a wrapper around OpenVMS mail and provide a common menu
interface with system security from which to hang both canned and homegrown
applications. For those of us old enough to remember, there was very little out there
which could do collaboration. Novell NetWare was just starting to make inroads into the
corporate world and most desktops were still running DOS on a 286 if you had a desktop
at all. On top of that, the standard ability of RMS to do file versioning and a systems
group that was doing nightly backups gave you a very reliable system. Laser printers
were just coming out and were priced high enough that they had to be amortized as a
capital asset.
Chapter 1 - Fundamentals of OpenVMS 1-19
The real killer was the menu system allowed for program development functions to
be hung off it as well. You will find advertisements from time to time asking for an
“All-In-One programmer.” Deductive reasoning will do you no good with that title. They
aren’t looking for someone to write extensions to All-In-One; they are looking for someone
that has spent their entire development life in a captive account doing all of their
development from an All-In-One menu. Someone that has never had to create a batch
queue, define their own system level logicals, and who doesn’t even know that the
AUTHORIZE utility exists, let alone what it does. (Don’t worry if some of those concepts
are strange to you; they won’t be by the time you get to the end of this chapter.) In short,
sheep have more backbone and awareness about their environment than the person they
are looking for.
TPU really isn’t an editor itself. The editor is called EVE (Extensible Versatile Editor)
and TPU is the default configuration. You will want to get it out of the default
configuration as quickly as possible. Once again, you do this with an initialization file.
EVE looks for an initialization file called EVE$INIT.EVE in the local directory, then in
your SYS$LOGIN directory, then it looks at the logical EVE$INIT. (SYS$LOGIN is the
logical defined for every process that actually logs in. It points to your home directory.)
You can override this by invoking TPU with a /INITIALIZATION=some.file. I’m an old-
timer, so my initialization file is called TPU$INIT.TPU. (If you end up working with a
very old version of OpenVMS, it will help you to remember that name; but hopefully, most
of you will work for companies that are not a full 10 years or so behind on OpenVMS
releases.)
$ EDIT SYS$LOGIN:TPU$INIT.TPU
set keypad edt
set width 132
set tabs every 4
!set tabs spaces
set tabs visible
Once you have entered the above, use <CTRL>-Z to save the file. The first line sets
the keypad to EDT compatibility mode. The second line sets the screen width to 132. The
third line sets tab spacing to 4 instead of the default 8 characters. The fourth line is
commented out. If you plan on writing code on the OpenVMS platform which will need
to be transported to other platforms you may wish to have the editor insert the
appropriate number of spaces instead of the TAB character. The fifth line is a line you
may or may not wish to use. This makes text you type in look as follows (blank spaces
preceding “...” has an H over T displayed to indicate horizontal tab):
012345678
···some new text here
··· ···even more indented text here
··· ··· ···Third level indent here
[End of file]
Remember above in the EDT section how we created the EDT symbol in our
LOGIN.COM file? Well, we are ready to create a TPU symbol. Add the following line to
your LOGIN.COM file:
1-20 C h a pter 1 - Fundamentals of OpenVMS
$ tpu :== edit/tpu/init=sys$login:tpu$init.tpu
There are quite a few differences between TPU in EDT mode and EDT itself. You
should try the EDT exercises above to see for yourself which work and which don’t. TPU
will handle much larger files that EDT. You can actually edit multiple files. TPU will
actually edit data files much better than EDT will. You can define keys for functions and
you can use LEARN to set up a series of repetitive keystrokes. If you are really into it you
can write your own extensions (look at the on-line help for EDIT and the examples in
SYS$EXAMPLES:*.TPU.) TPU has a callable interface, and is DEC WINDOWS aware
so if you are writing an application which needs the user to be able to look at or edit the
contents of a file you can call it and have all of the dirty work done for you.
1.7 LSE
In the world of editors on OpenVMS, LSE is the best at what it does. LSE (Language
Sensitive Editor) is part of the DECSet programming tool set which includes MMS
(Module Management System) and CMS (Code Management System) among other things.
LSE is aware of both old fashioned character cell terminal interfaces and DEC Windows.
If you are developing in a language supplied by HP on the OpenVMS platform, it has
built-in language sensitive help. The keypad is mostly the same as EDT so old-timers can
be highly productive with it from day one. You can even compile your code from within
the editor and review the errors. Control keys allow you to toggle between the next error,
and the line of source code that produced the error. You can even check source code out
of CMS and put it back in all from within the editor. You can split windows horizontally
editing two different locations in the same source file, or look at an entirely different file
in the other window. If you have LSE on your system, please spend a full hour now going
through both the on-line help from the OpenVMS command prompt and the help built into
the editor. No matter how many times you go through the help built into the editor it
seems there is always something useful that you overlooked in previous readings.
The first thing you will need to do is add a symbol to your LOGIN.COM file for LSE.
One oddity I have noticed is that a symbol doesn’t exist at most sites for it. Add the
following line to your LOGIN.COM file then @ the file to define the symbol.
$ LSE :== $LSEDIT
While you can override the use of the logical LSE$INITIALIZATION by using the
/INIT=some.file qualifier, with LSE I tend to use the logical. First you need to create the
initialization file.
$ EDIT SYS$LOGIN:LSEINIT.LSE
set tab 4
set screen height=30
set screen width=132
Once again use <CTRL>-Z to exit and save the file. The first line sets the TAB size
to 4 instead of 8 characters. The second line you will not be able to use if you are using
a very old VT terminal for access to OpenVMS. The very old terminals supported only 24
Chapter 1 - Fundamentals of OpenVMS 1-21
lines. When using a terminal emulator I have been known to set the screen to as much
as 50 lines so I could look at almost a full page of code. The fourth line sets the screen
width to 132.
Now you need to add the logical definition to your LOGIN.COM file. We will cover
what logicals are a little later; for now, just take it on faith and add the following line,
then @ the command file.
$ define lse$initialization sys$login:lseinit.lse
When you type LSE some.file at the command prompt it should run the file without
error. If you do get errors and have not made any typos it is because your installation set
PORTABLE as the default command language. You can try adding “set command
language VMSLSE” as the first line of the init file to see if that clears up your errors.
Some of you may wish to use the PORTABLE language version. It does have one distinct
advantage. A command exists called VIEW_FILE which allows you to type this command
followed by a file name. It will read the file into a non-modifiable new buffer. If you
already have your screen split you will see the buffer immediately. Our version of the init
file in portable looks as follows:
set command language portable
set height 30
set width 132
set tabs hard off
set buffer tab increment 4
Spend some time now and get comfortable with LSE. Try the EDT exercises and learn
for yourself which work and which do not work.
1.8 Logicals
You have read various names like SYS$LOGIN, SYS$ERROR, etc. in this book so far.
These are called logicals. OpenVMS and its file access system RMS utilize logicals
extensively. A logical is much like an alias only much more powerful. Some of them are
provided by the system and others you can create yourself as a programmer. Logicals
occur at what are called “levels.” A level is nothing more than a logical name table in your
logical search path. Your search path is defined by a logical known as LNM$FILE_DEV.
Every logged in process starts out with a default version of LNM$FILE_DEV which is
found in the logical name table LNM$SYSTEM_DIRECTORY. Various levels of
“privileges” are required to define logicals, but every process can define its own process
level logicals. If your account has sufficient privilege on your system you should be able
to execute the following command and get somewhat similar results.
1-22 C h a pter 1 - Fundamentals of OpenVMS
$ show log/table=lnm$system_directory lnm$file_dev
“LNM$FILE_DEV” = “LNM$PROCESS” (LNM$SYSTEM_DIRECTORY)
= “LNM$JOB”
= “LNM$GROUP”
= “LNM$SYSTEM”
= “DECW$LOGICAL_NAMES”
1 “LNM$SYSTEM” = “LNM$SYSTEM_TABLE” (LNM$SYSTEM_DIRECTORY)
= “LNM$SYSCLUSTER”
2 “LNM$SYSCLUSTER” = “LNM$SYSCLUSTER_TABLE” (LNM$SYSTEM_DIRECTORY)
1 “DECW$LOGICAL_NAMES” [table] = “” (LNM$SYSTEM_DIRECTORY)
That was a lot to swallow, so let's start small and work forward. Get to the “$” prompt
and type SHOW LOGICAL SYS$LOGIN. You should see something similar to the
following:
$ show log sys$login
“SYS$LOGIN” = “DKA1000:[HUGHES]” (LNM$JOB_80D0FE00)
You will notice to the right that it says this is a job level logical (LNM$JOB_jobid).
Job level logicals are passed to all child and sub-processes you create. SYS$LOGIN is
defined for each process when it is created. It points to your default drive and directory.
$ show logical sys$output
“SYS$OUTPUT” = “_LGKL1$TTA0:” (LNM$PROCESS_TABLE)
SYS$OUTPUT is a logical which gets defined for each process. It points to the default
output device for the process. Since it is a process level logical you can override it no
matter what your privileges (called privs) are set to.
Type the following at the command prompt:
$ define sys$output junk.txt
$ show dev d
$ deassing sys$output
$ type junk.txt
Device Device Error Volume Free Trans Mnt
Name Status Count Label Blocks Count Cnt
LGKL1$DKA1000: Mounted 0 SYS 15184350 468 1
LGKL1$DKA1200: Mounted 0 DEV 16248006 1 1
LGKL1$DKB0: Online wrtlck 0
LGKL1$DVA0: Online 0
You now have a file in your local working directory called JUNK.TXT which contains
the output of the SHOW DEVICE D command. Normally SYS$OUTPUT points to your
terminal device. My terminal is hooked up through a standard serial port so the device
is a TT device. You may see your device as an RT type device for a remote terminal
session through a network interface or LAT. The “_lgkl1” in front of my TT device is the
node I'm on. Even if a node isn't in a cluster it usually has a node name. While we are on
this topic type the following:
$ show log tt
“TT” = “TTA0:” (LNM$PROCESS_TABLE)
Chapter 1 - Fundamentals of OpenVMS 1-23
All terminal processes have the TT logical defined to point to their logical or physical
terminal device depending upon connection type. Many programmers use this feature to
direct output to printers which are attached to serial ports. The technique isn't that
common today as most printers on are networks, but some applications require the ability
to open a printer port and write information to it real time rather than sending output to
a file for later printing.
SYS$PRINT is another logical you need to be familiar with. In the old days when
systems had a defined main printer for all jobs this logical was set up for everybody by the
systems manager. These days with the prevalence of networked printers it is up to
individual users to define this in their LOGIN.COM. They have to find the name of a
print queue which spools to a printer close to them then define SYS$PRINT. In an effort
to maintain sanity most systems managers give print queues names based upon printer
location and type. If you are in room 510 and the printer is an HP laser you may have a
queue name like RM510$HP_LASER. Assuming you want your printouts to normally go
to this printer you would put the following in your LOGIN.COM file.
$ DEFINE SYS$PRINT RM510$HP_LASER
Then whenever you type something like PRINT LOGIN.COM it would go to that
printer automatically, unless you override the logical SYS$PRINT by putting a
/QUEUE=queue_name on the print command line. There are many qualifiers to the
PRINT command which we will go into later. My point here is that SYS$PRINT is an
important logical to understand.
I have mentioned your default logical search path here. Unless otherwise overridden,
your default logical search path will be Process Level, Job Level, Group Level and System
Level. Each of these levels is a logical name table defined on the system. Your specific
process and job tables are created each time you log in. They disappear each time you log
out. If you type SHOW LOG LNM$FILE_DEV at the command prompt you will get a long
list of all the logicals viewable by you.
Looks like there is no dancing around this topic. Fetch a caffeinated beverage of your
choice and get ready to delve into the meat of logicals.
Before, when I showed you the definition of LNM$FILE_DEV, it was a “Clinton
Truth”. You can see it if you know where to look. Type the following and you should
see similar results depending upon your system:
$ show log/table=lnm$system_directory
(LNM$SYSTEM_DIRECTORY)
“CLU$ICC_ORBS_ICC$” [table] = “”
“CLU$ICC_ORBS_LGKL1" [table] = “”
“DECW$LOGICAL_NAMES” [table] = “”
“DECW$SERVER0_TABLE” [table] = “”
“ICC$REGISTRY” = “ICC$REGISTRY_TABLE”
“ICC$REGISTRY_TABLE” [table] = “”
“LMF$LICENSE_TABLE” [table] = “”
“LNM$CLUSTER” = “LNM$CLUSTER_TABLE”
1-24 C h a pter 1 - Fundamentals of OpenVMS
“LNM$CLUSTER_TABLE” [table] = “”
“LNM$DCL_LOGICAL” = “LNM$FILE_DEV”
“LNM$DIRECTORIES” = “LNM$PROCESS_DIRECTORY”
= “LNM$SYSTEM_DIRECTORY”
“LNM$DT_FORMAT_TABLE” [table] = “”
“LNM$FILE_DEV” [super] = “LNM$PROCESS”
= “LNM$JOB”
= “LNM$GROUP”
= “LNM$SYSTEM”
= “DECW$LOGICAL_NAMES”
“LNM$FILE_DEV” [exec] = “LNM$PROCESS”
= “LNM$JOB”
= “LNM$GROUP”
= “LNM$SYSTEM”
“LNM$GROUP_000001" [table] = “”
“LNM$GROUP_000030" [table] = “”
“LNM$GROUP_000200" [table] = “”
“LNM$JOB_80D14080" [table] = “”
“LNM$JOB_80DA4FC0" [table] = “”
“LNM$JOB_80DA8540" [table] = “”
“LNM$JOB_80DAB280" [table] = “”
“LNM$JOB_80DAB9C0" [table] = “”
You will see that LNM$FILE_DEV is actually viewable in this listing. It has two
separate definitions and it is multi-pathed (has more than one translation value). How
can a single logical have two separate definitions in the same table? It can have three in
the same logical name table. Those definition levels would be USER_MODE,
SUPER_MODE, and EXECUTIVE_MODE.
A user_mode logical should never be created by you from the command line. They are
a brief life entity designed to exist only for the duration of a single executable image.
When a command file is invoked or the executable which creates them exits the logical is
deleted from existence. They do serve a legitimate purpose from a programming
perspective. Logical name tables have a maximum size defined for them based on the user
account which created the table. If you have an executable which needs to define a set of
logicals for temporary files it can call a system service routine to create those logicals. You
then don't have to pass these values to called external subroutines, they can simply know
the logical name and be coded to use it. When the program exits, all of the temporary
logicals it created are gone. Let us use a physical example to show the short life span of
this logical mode. Type the following:
$ create/dir [.junk2]
$ reca define
$ define/user junk2_dir dka1000:[guest.junk2]
$ show log junk2_dir
“JUNK2_DIR” = “DKA1000:[GUEST.JUNK2]” (LNM$PROCESS_TABLE)
$ @login
$ show log junk2_dir
%SHOW-S-NOTRAN, no translation for logical name JUNK2_DIR
In order to get the above to work you will need to substitute your default drive and
directory for the “dka1000:[guest” portion of the define statement. Notice that once you
run your LOGIN.COM the logical goes away. Also notice that unless the translation value
for a logical is entered in quotes DCL converts it to all upper case.
Chapter 1 - Fundamentals of OpenVMS 1-25
$ define/user junk2_dir “dka1000:[guest.junk2]”
$ show log junk2_dir
“JUNK2_DIR” = “dka1000:[guest.junk2]” (LNM$PROCESS_TABLE)
You can force DCL to keep the lower case value, but unless you have a reason to do
so I recommend against it.
EXECUTIVE_MODE logicals require your account have the SYSNAM privilege to
create them. (We will cover privs in the section on Authorize Basics; please bear with me.)
The logical name table where the logical gets defined must have the same or higher priv
level in order for the EXEC mode logical to be created in it. If the table does not, then
OpenVMS simply creates a SUPER_MODE logical and goes on. There are cases where
a logical needs to be in EXECUTIVE_MODE to be used. Unless you take to writing
system services or very intense systems utilities you won't need to know those cases.
From a normal programmers perspective EXEC mode logicals provide a default value
which cannot be walked on or easily deleted by an average user.
SUPERVISOR_MODE is the default mode for a logical when it is created. When you
have two logicals defined in the same table, the SUPER mode logical wins. In my previous
example of LNM$FILE_DEV found on my system you see the SUPER mode logical has
the logical name table DECW$LOGICAL_NAMES at the end of it. When I enter SHOW
LOG DECW$* I see the Decwindows logicals. If Decwindows is shut down on my system
it deletes the SUPER mode logical leaving the EXEC logical in place. As I stated before,
the primary purpose of an EXEC level logical is to provide a default value which can be
overridden by the user (or other applications) without being walked on. Only a privileged
user can delete an EXEC mode logical.
Deleting logicals is an interesting topic. One would think you could type something
like DELETE/LOGICAL my_logical and have the definition go away. That would be nice,
but it isn't the case. A logical must have its value deassigned. This is because the original
command for defining logicals was the ASSIGN command back in the days of RSTS/E and
other DEC operating systems. You may run into command files which use ASSIGN
instead of DEFINE. Get this difference down! ASSIGN is backwards from DEFINE.
$ ASSIGN DKA1000:[GUEST.JUNK2] JUNK2_DIR
$ DEFINE JUNK2_DIR DKA1000:[GUEST.JUNK2]
Both of the above accomplish the same thing. The ASSIGN command will probably
never really go away in OpenVMS. Its use and origins are too heavily rooted in DEC
operating systems past. You should never use ASSIGN in new development. There has
been a movement over the years to break away from its use so the command may
eventually disappear. Better to be safe than sorry. Besides, when you get into defining
multi-pathed logicals DEFINE looks cleaner.
$ DEFINE/TABLE=LNM$PROCESS_DIRECTORY LNM$FILE_DEV -
LNM$PROCESS, -
LNM$JOB, -
LNM$GROUP, -
LNM$SYSTEM
1-26 C h a pter 1 - Fundamentals of OpenVMS
is more readable to some than
$ASSIGN/TABLE=LNM$PROCESS_DIRECTORY -
LNM$PROCESS, -
LNM$JOB, -
LNM$GROUP, -
LNM$SYSTEM LNM$FILE_DEV
You will note the “-” at the end of each line except the last. This is how you tell the
CLI (Command Language Interpreter) to interpret a broken line as a single command.
Really old input terminals allowed for 80 characters on a line, period. You had to have a
method of breaking up long commands across lines back then and it works well today.
The above example is also how you define multi-pathed logicals. Both OpenVMS
and RMS will interpret all translations of a logical until they find what they need or
exhaust the list. When you are writing application programs which need to do more
than hand the logical off to RMS to find a file, you have to do this translation yourself.
Multi-pathed logicals work well for file opens, directory searches, etc., they do not
work well for file creations. If you have a multi-pathed logical defined as follows:
$ define my_dir1 dka1000:[guest.my_dir1]
$ define my_dir2 dka1000:[guest.my_dir2]
$ define my_dir3 dka1000:[guest.my_dir3]
$ define my_dir my_dir1, my_dir2, my_dir3
When you type EDIT MY_DIR:SOME_FILE.TXT the file will always be created in
MY_DIR1 (unless the disk is full, then it will fail). There is no good way around this. File
creation uses the first translation found. It is the responsibility of the system manager
to stage directories in such an order that file creation won't fail due to a lack of disk space.
If you are the systems developer writing a new system which uses multi-pathed logicals
it is your duty to inform the systems manager which logicals will be used for file creation
so they can allocate disk space accordingly.
OpenVMS provides quite a comprehensive piece of help for the DEFINE, ASSIGN,
and DEASSIGN commands. Take few minutes now and go through it. When in
OpenVMS and in doubt, just type HELP. It really will help if you look at that prior to the
rest of this explanation. The world of OpenVMS is completely and totally intertwined,
unlike the lesser operating systems of Windows and UNIX. It is almost impossible to
discuss logicals without discussing UIC (User Identification Code), UAF (User
Authorization File), and ACL (Access Control List). We will be covering each of these
things later, but I need to give you the fundamentals of logicals now so the other starts to
make sense. Remember this OS was designed from the ground up to be a secure
multi-user networked OS.
Logical names occur in 3 levels just like there are 3 modes: Directories, Tables and
plain old logicals. Directories contain both logicals and tables. In the earlier example
showing you the definitions for LNM$FILE_DEV you saw the directory
LNM$SYSTEM_DIRECTORY contained both multi-pathed logicals like LNM$FILE_DEV
and names that had “[table]” after them. This indicates that the item is really the name
Chapter 1 - Fundamentals of OpenVMS 1-27
of a logical name table which can contain 0-n logical names. The logical name itself is the
lowest level of this entity, but in a vicious twist of fate it could define one of the other
entities.
Hopefully you saw the DEFINE qualifiers of “/PROCESS”, “/JOB”, “/GROUP” and
“/SYSTEM” while you were going through the online help for DEFINE. In the dark old
days we programmers used to write command files which defined only process level
logicals. The previous example of the “my_dir” series of logicals is a good example of
process level logicals. End users running applications from a DCL application never
logging out all had their own copy of the logicals. While this is the most secure way it does
eat up a lot of system RAM. It was not unusual to develop on an old VAX box which had
less than 4 MEG of physical RAM and was handling 30 users simultaneously.
Thankfully, in the old days, we had “data islands.” When a user logged into their
captive account they ran one main menu all day long. This menu gave them access to the
one application they typically used, along with e-mail and a few other tidbits. A person
who did order entry all day had no access to accounting or shop floor scheduling. Likewise
the people on the shop floor only had access to the orders once they had been munched on
and handed off to the scheduling application. This environment melded perfectly with the
user account creation for OpenVMS. Every user account is a two piece code called the
UIC. Both parts of this code are octal numbers. The first part is the octal group and the
last part is the octal id. The combination of these two must be unique. System managers
then started creating separate groups for each “data island.” All users were put into the
group for their “data island.” A separate batch user ID was created under each group.
The batch account was given GROUP privilege, along with one or two users who were the
supervisors or team leaders for the group. At system startup batch jobs were submitted
under the batch ID which executed a full series of DEFINE/GROUP statements to define
all of the logicals needed for the application group. Now only one copy of the logicals
existed and all of the users for that group had access to them.
When writing batch jobs we programmers got in the habit of always defining logicals
with the “/JOB” qualifier. If your batch job was all in one stream and it didn’t need to
execute any other command files, you could get away with process level logicals, but it was
safer to use “/JOB” in case you had to create another process from within your process.
In most cases process level logicals are inherited by child processes; there are cases where
you can execute an image which is installed with its own process, but it does become part
of your job. Remember the default definition for LNM$FILE_DEV? [Process, Job,
Group, System]. There is a setting on each user account called JTQUOTA which controls
the size in bytes the users job table can reach. Users didn’t have to pester systems
managers to fix this problem, simply log out and log back in. They would get a shiny new
job level logical table. The problem only really flared up when users wanted to watch
reports get created interactively on their screen rather than submitting them off to batch
with no method of checking on them as they had captive accounts. (Perhaps the last few
paragraphs have begun to make you see how a product like All-In-One was conceived?)
1-28 C h a pter 1 - Fundamentals of OpenVMS
Companies grew, people moved around, more applications were added, and people
started needing access to more than one “data island” at a time. The old methods
employed by a good many OpenVMS shops had simply run into a wall. Thankfully, the
good people at DEC had a habit of looking 20+ years down the road when doing systems
work and before many shops started expanding exponentially enough to run aground we
turned to the pages in the manuals covering ACLs. This was the next great layer in
security, and for many shops the end of users needing multiple accounts.
1.9 ACLs and the UAF
In simple terms an Access Control List is little more than a token and a rule. The
token in this case is a “rights identifier” which gets assigned to your user ID. When a
process with your user ID attempts to access an item which has ACL security assigned to
it, the OS takes each rule in the list and looks at your process’s bag of rights identifiers
to see what kind of rights you have. When it finds a match, that is what you get for
access. Be very careful in how you define rights identifiers within an access control list.
When it comes to the list, order can be very important. I have seen instances where an
account was assigned the rights identifier for “read” access to an item and the identifier
for “write” access. When the ACL was placed on the item the “read” access rule was listed
prior to the “write” access rule. The account which had both identifiers could only read.
Confused? Sorry. I told you it is all intertwined. You have to understand a little about
ACLs, then we can look at the UAF, and finally make sense of it all.
An ACL can be attached to most things in the world of OpenVMS. Disk directories,
data files, RDB databases, tables within an RDB database, and logical name tables tend
to be among the most common places you will see ACLs used. Most shops will typically
develop a naming schema for rights identifiers. They will tend to start with what many
places call an Application System Code (ASC). This code will be 2 to 4 characters and
identify the primary system. These codes can be as simple as OE for Order Entry, SC for
supply chain, and AC for accounting or they could be something which seems to have no
meaning whatsoever to the layman. Each ASC will then get an underscore appended to
it and a 1 to 2 letter code to indicate the type of access; “_RO” for read only, “_RW” for read
write, “_S” for supervisor, etc.
I’m going to log into the SYSTEM account on my machine, create a new user, create
some rights identifiers, then create an ACL on a file in my own (not the new user’s)
directory. The new non-privileged user will not normally have access to my directory, but
the ACL will give them access to that file alone.
Chapter 1 - Fundamentals of OpenVMS 1-29
Welcome to OpenVMS (TM) Alpha Operating System, Version V7.2
Username: system
Password:
*****************************************************
* *
* WELCOME.TXT *
* *
* Welcome to the Alpha node LGKL1 run by Logikal *
* Solutions. *
*****************************************************
Last interactive login on Wednesday, 24-NOV-2004 09:14:11.07
Last non-interactive login on Thursday, 18-NOV-2004 07:33:04.27
$ set def sys$system
$ show process
29-NOV-2004 15:16:22.53 User: SYSTEM Process ID: 000000A2
Node: LGKL1 Process name: “SYSTEM”
Terminal: TNA3: (Host: 216.59.61.99 Port: 3538)
User Identifier: [SYSTEM]
Base priority: 4
Default file spec: SYS$SYSROOT:[SYSEXE]
Number of Kthreads: 1
Devices allocated: LGKL1$TNA3:
$ m c r a u t h o r i z e
U A F > s h o w * / b r i e f
O w n e r U s e r n a m e U I C A c c o u n t P r i v s P r i D i r e c t o r y
A C M S X P _ S V R [ 2 0 0 , 2 0 0 ] N o r m a l 4 [ U S E R ]
C M L $ S E R V E R D e f a u l t C M L $ S E R V E R [ 3 7 6 , 3 6 6 ] D E C N E T V N o r m a l 4 S Y S $ S P E C I F I C : [ C M L $ S E R V E R ]
D C E $ S E R V E R D C E $ S E R V E R [ 3 6 3 , 3 6 3 ] A l l 4 D i s u s e r
D E F A U L T [ 2 0 0 , 2 0 0 ] N o r m a l 4 D i s u s e r
S Y S T E M M A N A G E R H U G H E S [ 1 , 1 0 ] S Y S T E M A l l 4 D K A 1 2 0 0 : [ H U G H E S ]
M A I L $ S E R V E R D e f a u l t M A I L $ S E R V E R [ 3 7 6 , 3 7 4 ] D E C N E T V N o r m a l 4 S Y S $ S P E C I F I C : [ M A I L $ S E R V E R ]
M I R R O $ S E R V E R D e f a u l t M I R R O $ S E R V E R [ 3 7 6 , 3 6 7 ] D E C N E T V N o r m a l 4 S Y S $ S P E C I F I C : [ M I R R O $ S E R V E R ]
P H O N E $ S E R V E R D e f a u l t P H O N E $ S E R V E R [ 3 7 6 , 3 7 2 ] D E C N E T V N o r m a l 4 S Y S $ S P E C I F I C : [ P H O N E $ S E R V E R ]
R D B $ R E M O T E [ 2 0 0 , 1 6 0 ] N o r m a l 4 S Y S $ C O M M O N : [ R D B $ R E M O T E ]
R D M A I J [ 2 0 0 , 1 6 1 ] N o r m a l 1 5 S Y S $ C O M M O N : [ R D M A I J ]
R D M S T T [ 2 0 0 , 1 6 2 ] A l l 4 S Y S $ C O M M O N : [ R D M S T T ]
D E C _ S C A S C A $ D E F A U L T [ 3 7 1 , 3 4 5 ] D E C N E T N o n e 4 S Y S $ S Y S D E V I C E : [ S C A $ D E F A U L T ]
D E C _ S C A _ S E R V E R S C A $ S E R V E R [ 3 7 0 , 3 5 5 ] D E C N E T N o r m a l 4 D i s u s e r
S Y S T E M M A N A G E R S Y S T E M [ 1 , 4 ] S Y S T E M A l l 4 S Y S $ S Y S R O O T : [ S Y S M G R ]
T C P I P $ F T P T C P I P $ F T P [ 3 6 5 5 , 1 ] T C P I P N o r m a l 8 S Y S $ S Y S D E V I C E : [ T C P I P $ F T P ]
T C P I P $ T F T P T C P I P $ T F T P [ 3 6 5 5 , 2 ] T C P I P N o r m a l 8 S Y S $ S Y S D E V I C E : [ T C P I P $ T F T P ]
V P M $ S E R V E R D e f a u l t V P M $ S E R V E R [ 3 7 6 , 3 7 0 ] D E C N E T V N o r m a l 4 S Y S $ S P E C I F I C : [ V P M $ S E R V E R ]
U A F >
U A F > c o p y d e f a u l t g u e s t / u i c = [ 2 0 0 , 2 0 1 ] / p a s s = g u e s t / d e v i c e = d k a 1 2 0 0 - / d i r e c t o r y = [ g u e s t ] / f l a g = n o d i s u s e r / n o p w d e x p i r e d
% U A F - I - P W D L E S S M I N , n e w p a s s w o r d i s s h o r t e r t h a n m i n i m u m p a s s w o r d l e n g t h
% U A F - I - C O P M S G , u s e r r e c o r d c o p i e d
% U A F - I - R D B A D D M S G U , i d e n t i f i e r G U E S T v a l u e [ 0 0 0 2 0 0 , 0 0 0 2 0 1 ] a d d e d t o r i g h t s d a t a b a s e
U A F > s h o w g u e s t
U s e r n a m e : G U E S T O w n e r :
A c c o u n t : U I C : [ 2 0 0 , 2 0 1 ] ( [ G U E S T ] )
C L I : D C L T a b l e s : D C L T A B L E S
D e f a u l t : D K A 1 2 0 0 : [ G U E S T ]
L G I C M D :
F l a g s :
P r i m a r y d a y s : M o n T u e W e d T h u F r i
S e c o n d a r y d a y s : S a t S u n
N o a c c e s s r e s t r i c t i o n s
1-30 C h a pter 1 - Fundamentals of OpenVMS
E x p i r a t i o n : ( n o n e ) P w d m i n i m u m : 6 L o g i n F a i l s : 0
P w d l i f e t i m e : 9 0 0 0 : 0 0 P w d c h a n g e : 2 9 - N O V - 2 0 0 4 1 5 : 2 6
L a s t L o g i n : ( n o n e ) ( i n t e r a c t i v e ) , ( n o n e ) ( n o n - i n t e r a c t i v e )
M a x j o b s : 0 F i l l m : 1 0 0 B y t l m : 6 4 0 0 0
M a x a c c t j o b s : 0 S h r f i l l m : 0 P b y t l m : 0
M a x d e t a c h : 0 B I O l m : 1 5 0 J T q u o t a : 4 0 9 6
P r c l m : 8 D I O l m : 1 5 0 W S d e f : 2 0 0 0
P r i o : 4 A S T l m : 2 5 0 W S q u o : 4 0 0 0
Q u e p r i o : 4 T Q E l m : 1 0 W S e x t e n t : 1 6 3 8 4
C P U : ( n o n e E n q l m : 2 0 0 0 P g f l q u o : 5 0 0 0 0
A u t h o r i z e d P r i v i l e g e s :
N E T M B X T M P M B X
D e f a u l t P r i v i l e g e s :
N E T M B X T M P M B X
Notice that the first thing we did after logging in was to set default to SYS$SYSTEM.
You must be in that directory to actually update the correct database. If you are in a
directory other than SYS$SYSTEM your session will look something like the following:
$ mcr authorize
%UAF-E-NAOFIL, unable to open system authorization file (SYSUAF.DAT)
-RMS-E-FNF, file not found
Do you want to create a new file?
I told you before I was an old-timer on this platform. MCR is no longer needed to use
authorize. I could simply have used the RUN command. In the very old days you had to
use MCR to bring up authorize. It has been so many years I don’t even remember what
MCR stands for. There is no help for that command on OpenVMS any longer. I believe
it has become nothing more than a synonym for the RUN command.
Once inside of AUTHORIZE I displayed all of the accounts created on this system.
Notice the column titled UIC? This is pretty much the only place you will see it anymore.
Security and ease of human use have caused it to be replaced by the account name. If
your site is still implementing “group” strategies this is a real pain. Most sites today are
not implementing “group” strategies with account creation. When they do a full directory
on a file they want to see the name of the account that created it, not an octal number they
have to look up.
The account I chose to use as the starting point is found on most OpenVMS systems
and it is called DEFAULT. You cannot do anything with this account as it is flagged
DISUSER in the SYSUAF file. It is so much easier to copy another account changing it
than to create a completely new account from scratch. You can ADD a new user but you
have to specify every account parameter by hand. It takes a long time.
Since I chose to copy the account I had to give it a new password “/pass=guest” and a
new UIC “/UIC=[200,201]”. Remember that the UIC must be unique in the SYSUAF
(System User Authorization File). The flag had to be turned off so this user could become
active “/flag=nodisuser”. I did not wish the password to be expired which will force the
user to change their password at there very first login “/nopwdexpired”. This user will
have an actual directory for SYS$LOGIN definition “/DEVICE=dka1200
/directory=[guest]”. Note: you have to specify the drive separate from the directory.
Chapter 1 - Fundamentals of OpenVMS 1-31
Alert readers will notice that I got an information message about the password being
below system mandated minimum length. AUTHORIZE is the only place where you can
set the password on an account below the system minimum length, the SET PASSWORD
command will force the minimum length rule on the user.
Finally I showed the full details of the shiny new account we just created. Please
remember how the UIC is listed in this display. The actual UIC is listed first with the
synonym listed after it. Later, we will show you that the synonym (not the actual UIC
value) is all the system functions return. Notice that the only privileges this account has
are NETMBX and TMPMBX. This is the absolute minimum for an account to be able to
do anything. MBX is an abbreviation for “mailbox.” It will be a long time before we
mention mailboxes again, but if you want the full names they are “Network Mailbox” and
“Temporary Mailbox.”
The account is not yet ready for general use. We must create the user’s home
directory.
UAF> exit
%UAF-I-DONEMSG, system authorization file modified
%UAF-I-NAFNOMODS, no modifications made to network proxy database
%UAF-I-RDBDONEMSG, rights database modified
$ create/directory dka1200:[guest]/owner=[guest]
$ dir/own dka1200:[000000]guest.*
Directory DKA1200:[000000]
GUEST.DIR;1 1/18 29-NOV-2004 15:58:25.35 [GUEST]
Notice I had to set the owner when creating this directory. If I had not done so the
owner would be SYSTEM (the username from the process which created the file) rather
than GUEST. Since GUEST doesn’t have any privileges it wouldn’t be able to get to its
own home directory. Let’s give it a try now!
$ set host 0
Welcome to OpenVMS (TM) Alpha Operating System, Version V7.2
Username: guest
Password:
*****************************************************
* *
* WELCOME.TXT *
* *
* Welcome to the Alpha node LGKL1 run by Logikal *
* Solutions. *
*****************************************************
WooHoo! It works! If you had your own system and were playing along creating this
account you should be able to log in as well. The command “SET HOST” is a DECNET
command. If you are logged into one node on a cluster and wish to log into another node
without disconnecting your current process you issue the SET HOST command with a
node name. Using a node name of zero tells DECNET to let you log back into the same
node you are on. Though it is not generally cost effective to buy a DECNET license for a
machine which will never be part of a cluster, it can be handy to have for systems
1-32 C h a pter 1 - Fundamentals of OpenVMS
manager types.
We need to cover this UIC thing just a little bit more, then we can get on with rights
identifiers. While still logged in as GUEST I shall issue the following:
$ a = f$getjpi(“”,”UIC”)
$ show symbol a
A = “[GUEST]”
The lexical function F$GETJPI() is a function to get job process information. The first
parameter tells it the PID (Process ID) of the process you wish to find out about. Using
a pair of double quotes tells it to use the PID from the issuing process. The second
parameter is quoted text telling it what you wish to know about the process. Notice that
it returns the synonym and not the actual UIC code.
Using the editor I created a one line text file in this account.
$ dir/own
Directory DKA1200:[GUEST]
TEST_FILE_1.TXT;1 [GUEST]
Total of 1 file.
$
$ set file/own=[200,201] *.txt;0
$ dir/own
Directory DKA1200:[GUEST]
TEST_FILE_1.TXT;1 [GUEST]
Total of 1 file.
The SET FILE command allows you to change things like the owner and security of
a file. There are actually a lot of things you can change but we will only be concerned with
these two for the time being. You will note that even when you force in the numeric value
for the owner it still displays the synonym.
We must now touch on basic file security. Every file, even a directory file, has four
access paths which provide default security. These paths are: System, Owner, Group and
World. They are listed in that order when you tell the directory command to show you the
security on something. Up to four types of access can be specified for each path: Read,
Write, Execute and Delete. When a directory is created it doesn’t have delete access
turned on for any path. You need either a highly privileged account to delete a directory
file or you need enough privilege to turn delete access on for your access path. When a file
which is not a directory file is created the access path is (S:RWED, O:RWED, G:RE). Let’s
do a few examples to try and clear things up.
Chapter 1 - Fundamentals of OpenVMS 1-33
$ dir/sec
Directory DKA1200:[GUEST]
TEST_FILE_1.TXT;1 [GUEST] (RWED,RWED,RE,)
$ dir/sec dka1200:[000000]guest.dir
Directory DKA1200:[000000]
GUEST.DIR;1 [GUEST] (RWE,RWE,RE,E)
Now, let’s change the security on the directory, then use the editor to create another
one line text file.
$ set file/prot=(s:rwe,o:rwe,g,w) dka1200:[000000]guest.dir
$ dir/sec dka1200:[000000]guest.dir
Directory DKA1200:[000000]
GUEST.DIR;1 [GUEST] (RWE,RWE,,)
$ dir/sec
Directory DKA1200:[GUEST]
TEST_FILE_1.TXT;1 [GUEST] (RWED,RWED,RE,)
TEST_FILE_2.TXT;1 [GUEST] (RWED,RWED,RE,)
To remove group and world access I had to specify the identifiers without a colon or
qualifiers. If you issue the SET FILE/PROT command and leave one or more access paths
out of it they remain unchanged once the command is executed, not removed like many
think. Notice that the shiny new file (TEST_FILE_2.TXT) created after the security
change still got created with the same access path restrictions as the first file. We will
encounter a distinction before we finish talking of ACL’s.
Now comes the fun part, creating and granting a rights identifier. From my system
account I bring AUTHORIZE back up and create a rights identifier, then grant it to
GUEST.
$ set def sys$system
$ run authorize
UAF> add/ident gst_ro
%UAF-I-RDBADDMSG, identifier GST_RO value %X80010001 added to rights database
UAF> add/ident gst_re
%UAF-I-RDBADDMSG, identifier GST_RE value %X80010002 added to rights database
UAF> add/ident gst_s
%UAF-I-RDBADDMSG, identifier GST_S value %X80010003 added to rights database
UAF> grant/ident gst_ro guest
%UAF-I-GRANTMSG, identifier GST_RO granted to GUEST
UAF> grant/ident gst_re guest
%UAF-I-GRANTMSG, identifier GST_RE granted to GUEST
UAF> grant/ident gst_s guest
%UAF-I-GRANTMSG, identifier GST_S granted to GUEST
1-34 C h a pter 1 - Fundamentals of OpenVMS
UAF> show guest
Username: GUEST Owner:
Account: UIC: [200,201] ([GUEST])
CLI: DCL Tables: DCLTABLES
Default: DKA1200:[GUEST]
LGICMD:
Flags:
Primary days: Mon Tue Wed Thu Fri
Secondary days: Sat Sun
No access restrictions
Expiration: (none) Pwdminimum: 6 Login Fails: 0
Pwdlifetime: 90 00:00 Pwdchange: 29-NOV-2004 15:26
Last Login: 29-NOV-2004 16:05 (interactive), (none) (non-interactive)
Maxjobs: 0 Fillm: 100 Bytlm: 64000
Maxacctjobs: 0 Shrfillm: 0 Pbytlm: 0
Maxdetach: 0 BIOlm: 150 JTquota: 4096
Prclm: 8 DIOlm: 150 WSdef: 2000
Prio: 4 ASTlm: 250 WSquo: 4000
Queprio: 4 TQElm: 0 WSextent: 16384
CPU: (none) Enqlm: 2000 Pgflquo: 50000
Authorized Privileges:
NETMBX TMPMBX
Default Privileges:
NETMBX TMPMBX
Identifier Value Attributes
GST_RO %X80010001
GST_RE %X80010002
GST_S %X80010003
The command ADD/IDENTIFIER is used to add a new rights identifier. There are
lots of things which can be added as qualifiers on that command line which we will not
cover as they are more the domain of a systems manager than a systems developer. Once
the identifiers were added we had to grant them to the user. The results of the SHOW
command now displays the identifiers on the account. Those rights will only be available
to sessions which log in after the rights identifiers were granted. Currently logged in
sessions will not have them.
Before:
$ show process/rights
29-NOV-2004 17:10:53.13 User: GUEST Process ID: 000000A3
Node: LGKL1 Process name: “GUEST”
Process rights:
GUEST resource
INTERACTIVE
REMOTE
System rights:
SYS$NODE_LGKL1
Chapter 1 - Fundamentals of OpenVMS 1-35
After:
$ set host 0
Welcome to OpenVMS (TM) Alpha Operating System, Version V7.2
Username: guest
Password:
*****************************************************
* *
* WELCOME.TXT *
* *
* Welcome to the Alpha node LGKL1 run by Logikal *
* Solutions. *
*****************************************************
Last interactive login on Monday, 29-NOV-2004 16:05:25.63
$ show proc/rights
29-NOV-2004 17:11:32.75 User: GUEST Process ID: 000000A5
Node: LGKL1 Process name: “_RTA2:”
Process rights:
GUEST resource
INTERACTIVE
REMOTE
GST_RO
GST_RE
GST_S
System rights:
SYS$NODE_LGKL1
Now we need a directory to play in. This directory must be owned by a privileged
account so we can show the real power of ACL’s. I created a command file called
THE_WRONG_WAY.COM to add the ACL security to this directory.
$ create/dir dka1200:[acl_test]/own=hughes
$ @the_wrong_way dka1200:[000000]acl_test.dir
$ dir/sec dka1200:[000000]acl_test.dir
Directory DKA1200:[000000]
ACL_TEST.DIR;1 1/18 29-NOV-2004 17:37:24.04 [HUGHES] (RWE,RWE,RE,E)
(IDENTIFIER=[*,*],OPTIONS=DEFAULT,ACCESS=NONE)
(IDENTIFIER=GST_RO,OPTIONS=DEFAULT,ACCESS=READ)
(IDENTIFIER=GST_RE,OPTIONS=DEFAULT,ACCESS=READ+EXECUTE)
(IDENTIFIER=GST_S,OPTIONS=DEFAULT,ACCESS=READ+WRITE+EXECUTE+DELETE)
THE_WRONG_WAY.COM
$ set security /class=file -
/acl=((identifier=[*,*], option=default, access=none), -
(identifier=gst_ro, option=default, access=read), -
(identifier=gst_re, option=default, access=read+execute), -
(identifier=gst_s, option=default, access=read+write+execute+delete)) 'p1'
1-36 C h a pter 1 - Fundamentals of OpenVMS
Notice the search order of the ACL. Only the first entry will ever be used. The
command SET SECURITY/ACL pushes each identifier onto the list from the top but it
processes the list in reverse order if you put more than one identifier clause in the
command. Now we need to remove this ACL list and put on the correct list.
$ set security/acl/clas=file/delete=all dka1200:[000000]acl_test.dir
$ dir/sec dka1200:[000000]acl_test.dir
Directory DKA1200:[000000]
ACL_TEST.DIR;1 1/18 29-NOV-2004 17:37:24.04 [HUGHES]
(RWE,RWE,RE,E)
$ @the_right_way dka1200:[000000]acl_test.dir
$ dir/sec dka1200:[000000]acl_test.dir
Directory DKA1200:[000000]
ACL_TEST.DIR;1 1/18 29-NOV-2004 17:37:24.04 [HUGHES] (RWE,RWE,RE,E)
(IDENTIFIER=GST_S,OPTIONS=DEFAULT,ACCESS=READ+WRITE+EXECUTE+DELETE)
(IDENTIFIER=GST_RE,OPTIONS=DEFAULT,ACCESS=READ+EXECUTE)
(IDENTIFIER=GST_RO,OPTIONS=DEFAULT,ACCESS=READ)
(IDENTIFIER=[*,*],OPTIONS=DEFAULT,ACCESS=NONE)
THE_RIGHT_WAY.COM
$ set security /class=file -
/acl=(identifier=[*,*], option=default, access=none) 'p1'
$ set security/class=file -
/acl=(identifier=gst_ro, option=default, access=read) 'p1'
$ set security/class=file -
/acl=(identifier=gst_re, option=default, access=read+execute) 'p1'
$ set security/class=file
/acl=(identifier=gst_s,option=default, access=read+write+execute+delete) 'p1'
So now you can see the correct way. There are actually two correct ways. We could
have changed the order in the original command file to be exactly the order we wanted to
appear. If you find an ACL list on a directory where you need to just swap the order of
one item or change it slightly, there is an ACL editor you can invoke. This editor operates
much like TPU.
$ edit/acl dka1200:[000000]acl_test.dir
(IDENTIFIER=GST_S,OPTIONS=DEFAULT,ACCESS=READ+WRITE+EXECUTE+DELETE)
(IDENTIFIER=GST_RE,OPTIONS=DEFAULT,ACCESS=READ+EXECUTE)
(IDENTIFIER=GST_RO,OPTIONS=DEFAULT,ACCESS=READ)
(IDENTIFIER=[*,*],OPTIONS=DEFAULT,ACCESS=NONE)
[End of ACL]
In case you were wondering about the ‘p1’ item, it is the symbol for the first command
line parameter. You can have up to eight parameters passed on the command line (or in
the /PARAM qualifier on the SUBMIT statement). They become symbols p1 through p8.
Each symbol can contain up to 255 characters of data. All values are passed in character
form, but it is a simple matter to convert them to integers using the lexical function
F$INTEGER().
Chapter 1 - Fundamentals of OpenVMS 1-37
Now, we need a source file and an executable file to conduct our test. Many of you will
recognize the adaptation of hello_world. I created this program in my own account, then
copied it to the test directory.
#include <stdio>
#include <stdlib>
int main( int *argc, char **argv)
{
printf(“Hello World!\n”);
return 1;
}
$ cc hello_world
$ link hello_world
$ run hello_world
Hello World!
$ copy hello_world.c dka1200:[acl_test]*.*;0/log
%COPY-S-COPIED, DKA1200:[HUGHES.MEGA_ZILLIONARE]HELLO_WORLD.C;1 copied to
DKA1200:[ACL_TEST]HELLO_WORLD.C;1 (1 block)
$ copy hello_world.exe dka1200:[acl_test]*.*;0/log
%COPY-S-COPIED, DKA1200:[HUGHES.MEGA_ZILLIONARE]HELLO_WORLD.EXE;1 copied to
DKA1200:[ACL_TEST]HELLO_WORLD.EXE;1 (7 blocks)
Remember that the GUEST account currently has all of the rights identifiers. It will
be able to type out the source file and run the executable but it will not be able to issue a
directory command against that directory or create a file in that directory.
$ set host 0
Welcome to OpenVMS (TM) Alpha Operating System, Version V7.2
Username: guest
Password:
*****************************************************
* *
* WELCOME.TXT *
* *
* Welcome to the Alpha node LGKL1 run by Logikal *
* Solutions. *
*****************************************************
$ run dka1200:[acl_test]hello_world
Hello World!
$ type dka1200:[acl_test]hello_world.c
#include <stdio>
#include <stdlib>
int main( int *argc, char **argv)
{
printf(“Hello World!\n”);
return 1;
}
1-38 C h a pter 1 - Fundamentals of OpenVMS
$ dir dka1200:[acl_test]
%DIRECT-E-OPENIN, error opening DKA1200:[ACL_TEST]*.*;* as input
-RMS-E-PRV, insufficient privilege or file protection violation
$ dir/sec dka1200:[000000]acl_test.dir
Directory DKA1200:[000000]
ACL_TEST.DIR;1 insufficient privilege or object protection violation
$ dir dka1200:[acl_test]hello_world.c
Directory DKA1200:[ACL_TEST]
HELLO_WORLD.C;1
Total of 1 file.
$ dir dka1200:[acl_test]hello_world.c
Directory DKA1200:[ACL_TEST]
HELLO_WORLD.C;1
Total of 1 file.
You can see that the user must know exactly what they have access to in order to be
able to use it. Remember we are trying to access from an account with no privileges.
1.10 Logical Name Tables
We got to the discussion of ACL’s because we were discussing logicals. As was stated
before, every logical is stored in either a directory or a table. Duplicating logicals as job
level logicals within user processes consumed a lot of resources and opened up the
possibility of a logical definition getting changed in a single user environment making it
difficult to track down. The solution was to create application level logical name tables.
When everyone was in the same group that needed access to the table we simply set the
protection on the table to allow group read. Once users started needing more than one
application this left a tough choice. System managers could make the tables world read
(not very secure) or they could install ACL’s on the table.
As a general rule, logical name table creation should be done during system startup.
If you don’t put it in the site specific startup file, when the system reboots the table will
be gone. Population of the table can occur any time after startup, but is generally done
at the same time as table creation and usually all from the same command file. A logical
name table which is to be available to anyone having access to it needs to have a parent
logical directory of LNM$SYSTEM_DIRECTORY. If you create a logical name table and
don’t specify the parent directory table it w ill be placed in your
LNM$PROCESS_DIRECTORY and it will disappear when your process goes away.
Chapter 1 - Fundamentals of OpenVMS 1-39
CREATE_NAME_TABLE.COM
$ create/name_table/parent_table=lnm$system_directory my_app_tbl
$!
$ set security/class=logical/acl=(identifier=gst_re,access=read+execute) my_app_tbl
$!
$ set security/class=logical/prot=(w) my_app_tbl
$!
$ define/table=my_app_tbl first_logical sys$login
$!
$ exit
$ @create_name_table
$ show log/full/table=my_app_tbl
(MY_APP_TBL) [super] [shareable]
[Protection=(RW,RW,R,)] [Owner=[HUGHES]]
(IDENTIFIER=GST_RE,ACCESS=READ+CREATE)
“FIRST_LOGICAL” [super] = “SYS$LOGIN”
I created and performed the above from my privileged account. Notice that we took
world read access off the logical name table. We want to restrict it to only those users who
should be running the application which will need this table. The default when creating
a logical name table is to allow world read access. You should get into the habit of turning
off world read access when creating logical name tables. Admittedly in this little example
it is hard to understand why you would want to, but what if this application was payroll
or accounting you were creating the name table for? Now we need to edit the GUEST
account login so it will map onto this table.
LOGIN.COM for GUEST account
$ define/table=lnm$process_directory lnm$file_dev -
lnm$process, -
my_app_tbl, -
lnm$job, -
lnm$group, -
lnm$system
$ exit
$ @login
$ show log first_logical
“FIRST_LOGICAL” = “SYS$LOGIN” (MY_APP_TBL)
1 “SYS$LOGIN” = “DKA1200:[GUEST]” (LNM$JOB_812D2F40)
Notice that I placed the table MY_APP_TBL after the process table. You should
always place application logical tables after the process and before the job level table when
defining LNM$FILE_DEV. This allows for process level overrides of logicals by running
applications, but does not allow for job or higher level definitions to clobber one of your
logicals. The definition of LNM$FILE_DEV must be placed in the table
LNM$PROCESS_DIRECTORY if you wish it to be used.
Notice how the translation of FIRST_LOGICAL is displayed. The very first definition
shown is another logical. OpenVMS then went and found the next definition for you. It
will keep doing this until the logical is completely defined all the way out or until it
encounters a logical which was defined with the /TRANSLATION=TERMINAL qualifier.
This is a security feature which gets employed at a lot of shops.
1-40 C h a pter 1 - Fundamentals of OpenVMS
$ define/table=my_app_tbl/trans=terminal second_logical sys$output
$ show logical second_logical/full
“SECOND_LOGICAL” [super] = “SYS$OUTPUT” [terminal] (MY_APP_TBL)
$ show log sys$output
“SYS$OUTPUT” = “_LGKL1$RTA1:” (LNM$PROCESS_TABLE)
1.11 Foreign Commands
Those of you coming from platforms like Windows and UNIX are used to running an
executable by simply typing in its name. You have seen that here as well with respect to
the editors and such. That is not the normal method of invocation though. In order to
pass command line parameters to any executable it must be defined as a foreign
command. If you went through the section on setting up LSE you saw us define one
foreign command.
$ LSE :== $LSEDIT
Many times you want only a temporary definition or your own special definition so
sticking this definition in a batch file (or your LOGIN.COM) works just fine. Your system
manager has another method at their disposal. They define a logical called DCL$PATH
to point to one or more directories where executables exist. On my system it is defined as
follows:
$ show log dcl$path
“DCL$PATH” = “DKA1000:[SYSTEM_UTILITIES]” (LNM$SYSTEM_TABLE)
Any executable in that directory can be invoked by simply typing its name. Command
line parameters can be passed as well if the executable accepts them. If you are writing
programs in C and designing them to accept command line input it can be useful to put
them in a directory in this path.
There is one thing worthy of note with respect to foreign commands. On many
operating systems the first command line parameter is the full path to the executable
image. This parameter is inserted by the OS and the developer has to code around it. On
OpenVMS prior to changes which occurred with version 7.x that does not happen. I
wanted to bring this up now before we get into the chapter on C so you are aware of it.
Chapter 1 - Fundamentals of OpenVMS 1-41
1.12 Exercises
1. What is the purpose of the [F1] key on the VT terminal keyboard?
2. What command changes the prompt you see on the terminal?
3. What value should normally be in the error count column for disk drives?
Is this the same value for tape drives?
4. How big is a disk block?
5. How big is a memory page?
6. What is the root directory of every disk device?
7. What is the maximum file version number OpenVMS will allow?
8. What command gets rid of older versions of files?
9. What are the three types of data a symbol can store?
10. What are the two classes or storage spaces for symbols?
11. What is the difference between “=” and “==” when assigning a value to a symbol?
12. Given the following:$ S1 == “My big dog”
$ S1 := The purring cat
What will be displayed when typing$ SHOW SYMBOL S1
13. Given SYS$LOGIN is defined to be DUA1:[FRED], what is the value of CURR_DIR?$ curr_dir = f$trnlnm(“SYS$LOGIN”)
$ curr_dir = curr_dir - “]” + “.cars]”
14. What is the difference between “:=” and “=” when assigning symbol values?
15. Is the following a legal symbol assignment?$ diameter = 10
$ area = 3.414 * diameter
16. What is the difference between:$ ting = %x07
$ ting[0,7] = %x07
17. What is the initialization search order that EDT follows at startup?
How do you override it?
18. When in CHANGE mode in EDT, how do you get back to command mode?
19. When are device error counts reset?
1-42 C h a pter 1 - Fundamentals of OpenVMS
20. What is the “GOLD” key?
21. If EDT starts with the command prompt “*” how do you get into screen mode?
22. What does the FIND command do in EDT?
23. How do you save a selected range of lines with the WRITE command in EDT?
24. How do you save lines 10 - 15 of a given file using the WRITE command without
selecting them?
25. Which key on the VT style numeric keypad deletes a single character?
26. What numeric keypad combination takes you to the bottom of the file in EDT?
The top?
27. What does the INCLUDE command do in EDT?
28. In EDT, what is the syntax for the SUBSTITUTE command to change ABC to DEF for
a selected range of lines?
29. How do you make EDT take you to a specific source line?
30. What is the initialization search order for EVE?
How do you override it?
31. What does LSE stand for?
32. What are the two command languages supported by LSE?
33. How do you switch between the two languages?
34. What logical does LSE use to find its initialization file?
35. What one logical controls the logical translation search path for your process?
36. What is SYS$LOGIN? Not a value, what does it represent?
37. What does the logical SYS$OUTPUT represent?
38. If you enter the command:$ PRINT MY.FIL
What logical is used to determine the print queue?
39. What PRIV level is required to create an EXECUTIVE_MODE logical?
40. How long does a USER_MODE logical live?
41. If you override the definition of LNM$FILE_DEV where must you place its definition?
Chapter 1 - Fundamentals of OpenVMS 1-43
42. What is the difference between ASSIGN and DEFINE?
43. How do you continue a DCL command line onto the next line?
44. Given the definition:$ DEFINE PROJ_DATA DUA1:[DATA1], DUA2:[DATA2], DUA3:[DATA3]
Where would the command$ EDIT/EDT PROJ_DATA:NEW_FILE.TXT
create the file?
Why?
45. What are the five qualifiers you can put on a DEFINE or ASSIGN statement to control
the placement of the logical?
46. What account setting controls the amount of job level logicals you can have?
47. What does ACL stand for?
48. What flag do you set on an account in the UAF to leave an account defined by
unusable?
49. What error message do you get when you try to run AUTHORIZE from the wrong
directory?
50. What does the command $ SET HOST 0 do?
51. What does the name of the lexical function F$GETJPI stand for?
52. What command is used to change the owner of a file?
53. What are the 3 levels in which logicals exist?
54. How can you create a password which is shorter than the system minimum?
55. What are the 4 protected access paths to an object on OpenVMS?
56. What must a user account posses to gain access to an object via an ACL?
57. In what order are ACLs added to objects?
58. How many parameters can be passed on a command line to a COM file?
59. What is the search order for ACLs?
60. What is the maximum length for the contents of a symbol passed as a parameter?
61. What lexical function converts a string value to a number?
62. What command removes all ACLs from a file?
63. What command shows the ACLs on a file?
1-44 C h a pter 1 - Fundamentals of OpenVMS
64. If you own the directory DUA1:[ME] how do you add a subdirectory named “MYSELF”
to it?
65. What is the syntax of the command required to create a logical table which everyone
can read?
66. What command will add the logical name table INVENTORY_APP_TBL to your
default translation search path?
67. When defining a logical, what qualifier or command parameter causes the iterative
interpretation of the logical to cease?
68. What is a foreign command?
69. How is a foreign command different from an executable invoked by the RUN
command?
70. What is different between parameters passed on the command line to an executable
between OpenVMS and DOS or Unix?
71. What are the two methods of declaring foreign commands?