CONTENTS Title Page Copyright Page Preface 1 Overview of DSM DSM History DSM on a VAX Processor, DSM for OpenVMS VAX DSM on an Alpha AXP Processor, DSM for OpenVMS AXP DSM on an Alpha AXP Processor, DSM for DEC OSF/1 AXP DSM on a RISC Processor, DSM for ULTRIX DSM Components DSM Programming Language DSM Database System DSM Utilities Review Exercises 2 Getting Started with DSM Beginning a DSM Session Getting Started on a DSM for OpenVMS System Running the DSM Image on OpenVMS Systems Getting Started on DSM for DEC OSF/1 AXP and DSM for ULTRIX Systems Running the DSM Image on OSF/1 and ULTRIX Systems Ending a DSM Session Exiting from a DSM for OpenVMS System Exiting from a DSM for DEC OSF/1 AXP or DSM for ULTRIX System DSM Work Area Using Programmer Mode Review Exercises 3 DSM Syntax DSM Character Set Uppercase and Lowercase Characters Nonprinting Control Characters DSM Commands Using Command Abbreviations Using Multiple Commands on a Line Line Structure Command Lines Routine Lines Line Labels Tab Character Comments Constructing Arguments Argument List Expression Elements Literals Numeric Literals Integer Literals Decimal Numeric Literals Exponential Notation String Literals Variables Local Variables Listing Local Variables with the ZWRITE Command Deleting Local Variables Global Variables Subscripts Extended Global References Special Variables Operators INDIRECTION Operator Unary Operators Binary Operators Arithmetic Operators Relational Operators Logical Operators Evaluating Expressions Concatenating Expressions Review Exercises 4 Writing and Running DSM Routines Overview of DSM Routines Introduction to MUMPS I/O Commands Formatting Output Form-Feed Character New-Line Character Horizontal-Tabulation Character Control Mnemonic Character $X and $Y Special Variables Using Comments in Routines Using DSM Routines Entering Routines into the Routine Buffer Executing Routines in Your Routine Buffer Printing Routines on Your Terminal Saving Routines with the ZSAVE Command Displaying the Routine Directory Executing Saved Routines Executing a Routine from Your Routine Directory Using Entry References Loading and Executing a Routine in Your Routine Buffer Using Offsets, Line References, and Line Specifications Offsets Line References and Line Specifications Using Line References and Line Specifications to Correct Errors Using ZPRINT, ZREMOVE, and ZINSERT to Edit Routines Using ZINSERT to Insert Lines into a Routine Adding Lines to the End of a Routine Adding New Lines to the Beginning of a Routine Replacing Lines in a Routine Making Copies of Routines Deleting Routines Renaming Routines Interpreting Error Messages and Correcting Mistakes An Example Routine Review Exercises 5 Editing DSM Routines Editors Available with DSM Systems Using the % and %ED Editors Editing Example Editing a Single Line Editing a Range of Lines Adding a Line Label Using DSM Commands in the Editor Ending an Editing Session Using the EDT Editor with DSM for OpenVMS ( ^%EDT ) Using the DEC Text Processing Utility (DECTPU) with DSM for OpenVMS Using the DEC Text Processing Utility (DECTPU) with DSM for ULTRIX Using the vi Editor Using the EDI Editor ( ^%EDI ) EDI Commands Review Exercises 6 Controlling Routine Execution Using Alternate Execution Paths IF Command ELSE Command Performing Repetitive Operations GOTO Command QUIT Command FOR Command Using Subroutines Additional Ways to Control Routine Execution DO Command with Parameter Passing DO Command with Block Structuring Execution Levels Line Structure for Block Structuring Routine Structure and Execution Extrinsic Functions and Variables Using the NEW Command Review Exercises 7 Using Globals and Arrays Global Variables Assigning Values to Global Variables Using Global Directories Killing Global Variables Arrays Array Names and Subscripts Physical Array Structure Logical Array Structure Collating Sequences Naked References Determining the Status of Variables $DATA Function $GET Function Traversing an Array $ORDER Function $ZPREVIOUS Function Writing a Routine that Uses Arrays Review Exercises 8 Using String Relational Operators and Functions Using String Relational Operators Binary CONTAINS Binary FOLLOWS Binary PATTERN MATCH Using a Period with PATTERN MATCH Using Literals with PATTERN MATCH Writing Routines to Validate User Input Entering Student Profile Information Enrolling Students in Courses Using Functions $EXTRACT Function $FIND Function $JUSTIFY Function $LENGTH Function $PIECE Function $PIECE Argument Formats Setting and Modifying Substrings Using Piece References $TRANSLATE Function Using String-Manipulation Functions in Routines Using Postconditional Expressions Command Postconditional Expression Argument Postconditional Expression Naked References and Postconditional Expressions Review Exercises 9 Using the XECUTE Command and Indirection Overview Using the XECUTE Command Executing Data Using Indirection Argument Indirection Name Indirection Subscript Indirection Pattern Indirection Review Exercises 10 Performing Input/Output Using Devices Defining Devices OPEN Command OPEN Command Arguments Timeout Expressions USE Command CLOSE Command Performing Device Input/Output Device Input/Output with the WRITE and READ Commands Timeout Expressions with the READ Command Device I/O with Other Commands ZPRINT Command ZLOAD Command ZWRITE Command Input/Output Special Variables Review Exercises 11 Creating a Database and Writing a DSM Application Planning an Application ^NAME Array ^CLASS Array Creating a Database Writing a Menu Driver Routine $TEXT Function $CHAR Function Entering Student Grades Reporting Student Grades Review Exercises A ASCII Character Set B Answers to Exercise Questions Chapter 1 - Overview of DSM Chapter 2 - Getting Started with DSM Chapter 3 - DSM Syntax Chapter 4 - Writing and Running DSM Routines Chapter 5 - Editing DSM Routines Chapter 6 - Controlling Routine Execution Chapter 7 - Using Globals and Arrays Chapter 8 - Using String Relational Operators and Functions Chapter 9 - Using the XECUTE Command and Indirection Chapter 10 - Performing Input/Output Using Devices Chapter 11 - Creating a Database and Writing a DSM Application C DSM Command, Function, and Special Variable Abbreviations Glossary absolute pathname . . . Boolean truth valued expression branches . . . current device cursor . . . DSM for OpenVMS DSM for ULTRIX . . . global directory global variable . . . line line label . . . mailbox manpage . . . operator option . . . relative file relative pathname . . . special variable standard input device . . . symbol table terminal . . . volume set work area . . . working directory