100% found this document useful (1 vote)
1K views

Vos Fundamentals

Uploaded by

jgvp2010
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
1K views

Vos Fundamentals

Uploaded by

jgvp2010
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 385

VOS Fundamentals

303

Student Guide

Stratus®
VOS Fundamentals
303

Student Guide

Stratus®
World-wide Customer Education
Stratus Technologies, Inc.
111 Powdermill Road
Maynard, MA USA 01754-3409

1-800-634-2122
[email protected]
hhtp://www2.stratus.com/education
Stratus® VOS Fundamentals 303

VOS Fundamentals

Course

303

This document outlines the essence of the material covered in this course.

This document is not intended to be used as a self-instructional guide. The rest of the
supporting knowledge will come from the lecture, demonstrations, labs, exercises and
student interaction. Students are encouraged to add their notes as the class progresses.

Course: 303
Course Release Date: 01/06/97
Update Release Date: 05/01/2001
Associated O/S Releases: VOS-14.3

Copyright 2001 Stratus Technologies International, S.à r.l.


All rights reserved.
VOS Fundamentals 303 Stratus®

Notice

The information contained in this document is subject to change without notice.

STRATUS TECHNOLOGIES, INC., MAKES NO WARRANTY OF ANY KIND WITH REGARD TO


THIS MATERIAL, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Stratus Technologies, Inc.,
shall not be liable for errors contained herein or for incidental or consequential damages in connection with
the furnishing, performance, or use of this material.

Stratus Technologies, Inc., assumes no responsibility for the use or reliability of its software on equipment
that is not furnished by Stratus Technologies, Inc.

This document is protected by copyright. All rights are reserved. No part of this document may be
photocopied, reproduced, or translated to another language without the prior written consent of Stratus
Technologies, Inc.

Stratus, Continuous Processing, StrataNET, FTX, and the Stratus logo are registered trademarks of Stratus
Technologies International, S.à r.l.

Continuum, XA, XA/R, StrataLINK, RSN, SINAP, and the SQL/2000 logo are trademarks of Stratus
Technologies International, S.à r.l.

Hewlett-Packard is a registered trademark of Hewlett-Packard.


IBM is a registered trademark of International Business Machines Corporation.
Intel is a registered trademark of Intel Corporation.
Motorola and MC68000 are registered trademarks of Motorola, Incorporated.
SYBASE is a registered trademark of Sybase, Inc.
UNIX is a registered trademark of X/Open Company, Ltd.
Xerox is a registered trademark of Xerox Corporation.
NFS is a trademark of Sun Microsystems, Inc.
PA-RISC and HP-UX are trademarks of Hewlett-Packard.
All other trademarks are the property of their respective owners.

Stratus Technologies, Inc.


111 Powdermill Road
Maynard, Massachusetts 01754

© 2001 Stratus Technologies International, S.à r.l.


All rights reserved.
Stratus® VOS Fundamentals 303

VOS Fundamentals

In the VOS Fundamentals Course, you learn the skills necessary to use and
manage your Stratus environment. It is designed for those who have no prior
VOS experience. You learn the basic user interface and become familiar
with the most commonly used commands. With a combination of lectures,
demonstrations and hands-on experience, you build the knowledge base that
every VOS user needs. The skills you acquire in this course are the first step
toward mastering the Stratus environment. You are introduced to the basic
functionality of the VOS Full-Screen Editor. You have an opportunity for
hands-on experiences creating, editing and moving through text files within
the Editor.

Major Topics

• Basic commands
• Directory structure
• Security for files and directories
• Editing files
• Abbreviations
• Non-interactive processes
• Command macros

Audience

• This course is the prerequisite for most VOS courses and should be
taken by anyone new to the VOS environment.

Prerequisites

• Experience using a CRT-based computer system

Duration: 4 days
Stratus® VOS Fundamentals 303

Table of Contents

Chapter 1: An Overview of the Stratus System


Objectives ...................................................................................... 1-2
Stratus Continuous Availability .................................................... 1-3
Stratus Hardware Fault Tolerance ................................................. 1-4
Stratus Self-Checking Boards........................................................ 1-5
The Stratus Duplexed Architecture ............................................... 1-7
The Stratus Module Components .................................................. 1-9
A Stratus System............................................................................ 1-11
Networking Stratus Systems.......................................................... 1-12
Stratus System Software ................................................................ 1-13

Chapter 2: Getting Onto the System as a User


Objectives ...................................................................................... 2-2
CRT Terminal ................................................................................ 2-3
Logging onto the System............................................................... 2-4
Types of Commands ...................................................................... 2-6
Command Arguments .................................................................... 2-8
Help for Command Arguments ..................................................... 2-10
Editing the Command Line............................................................ 2-12
Cancel Execution after [Return] or [Enter] ............................ 2-14
Command Functions...................................................................... 2-15
Online Help Facility ...................................................................... 2-16
Customizing the Terminal Environment ....................................... 2-19
Some Basic Commands ................................................................. 2-20
Logging the Terminal Session....................................................... 2-25
Summary of Command Editing ..................................................... 2-27
Summary of Commands and Command Functions....................... 2-28
Lab: Getting Onto the System as a User........................................ 2-29

Table of Contents - 1
VOS Fundamentals 303 Stratus®

Chapter 3: The Directory Structure


Objectives ...................................................................................... 3-2
The Hierarchical Directory Structure ............................................ 3-3
Conventional Group and Person Level Structure.......................... 3-4
Full Path Names............................................................................. 3-6
Relative Path Names...................................................................... 3-8
Navigating the Directory Tree ....................................................... 3-9
Directory Commands..................................................................... 3-10
Links in the Directory Structure .................................................... 3-17
Link Commands............................................................................. 3-18
The walk_dir command ............................................................ 3-19
Summary of Commands ................................................................ 3-20
Lab: The Directory Structure......................................................... 3-21

Chapter 4: The File System Overview


Objectives ...................................................................................... 4-2
File System .................................................................................... 4-3
Naming a File................................................................................. 4-4
Suffixes in File Names................................................................... 4-5
Star Names..................................................................................... 4-6
File Attributes ................................................................................ 4-7
File Commands .............................................................................. 4-8
File Protect Commands.................................................................. 4-10
File Manipulation Commands ....................................................... 4-12
File Commands for Listing and Displaying .................................. 4-16
The sort Command ................................................................... 4-21
Summary of Commands ................................................................ 4-23
Lab: The File System..................................................................... 4-24

Table of Contents - 2
Stratus® VOS Fundamentals 303

Chapter 5: Access Control


Objectives ...................................................................................... 5-2
Access Control Mechanism ........................................................... 5-3
Access Control Entry..................................................................... 5-4
Directory Access Control .............................................................. 5-7
Directory Access Types................................................................. 5-8
Directory Access Commands ........................................................ 5-9
File Access Control........................................................................ 5-11
File Access Types .......................................................................... 5-12
File Access Commands.................................................................. 5-13
Default File Access........................................................................ 5-14
Default File Access Commands..................................................... 5-16
Checking Permissions on an Access Lists..................................... 5-17
Summary of Commands ................................................................ 5-20
Lab: Access Control ...................................................................... 5-21

Chapter 6: Introduction to Editing using edit


Objectives ...................................................................................... 6-2
The Terminal Keyboard................................................................. 6-3
Starting an Edit Session ................................................................. 6-4
Help Menu ..................................................................................... 6-8
Text Input....................................................................................... 6-9
Saving a File .................................................................................. 6-11
Ending an Edit Session .................................................................. 6-13
Results from the Editor.................................................................. 6-14
Summary of Editing Requests and VOS ....................................... 6-15
Lab: Introduction to Editing using edit ........................................ 6-16

Chapter 7: Editing Text using edit


Objectives ...................................................................................... 7-2
Moving the cursor.......................................................................... 7-3
Scrolling Text ................................................................................ 7-6
Search for Text .............................................................................. 7-8
Global Search and Replace............................................................ 7-9
Marking Text ................................................................................. 7-10
Altering Text.................................................................................. 7-11
Moving and Copying Text............................................................. 7-12
Displaying the Status Buffer.......................................................... 7-14

Table of Contents - 3
VOS Fundamentals 303 Stratus®

Formatting Text - Tabs .................................................................. 7-15


Tabs................................................................................................ 7-16
Columns ......................................................................................... 7-18
Summary of Editing Text using edit.............................................. 7-19
Lab: Editing Text using edit .......................................................... 7-21

Chapter 8: Edit Timesaving Techniques


Objectives ...................................................................................... 8-2
The Menu Screen Shorthands........................................................ 8-3
Defining a Shorthand..................................................................... 8-4
Executing a Shorthand................................................................... 8-6
Modifying Shorthands ................................................................... 8-7
Editing a Shorthand in the shorthand_definitions file................... 8-8
Defining Multiple Buffers ............................................................. 8-9
Move to an Existing Buffer Create a New Buffer ......................... 8-10
Read a File into a Buffer................................................................ 8-11
Accessing Text Between Buffers Save Buffer Contents............... 8-12
Defining Multiple Windows.......................................................... 8-13
Execute System Commands and Waiting...................................... 8-15
Keystroke Recovery....................................................................... 8-17
Using the keystroke file ................................................................. 8-18
Summary of Timesaving Techniques ............................................ 8-19
Lab: Edit Timesaving Techniques ................................................. 8-20

Chapter 9: Using the Abbreviations Facility


Objectives ...................................................................................... 9-2
User Abbreviations ........................................................................ 9-4
Abbreviations Processing Steps .................................................... 9-5
Abbreviations Replacement........................................................... 9-7
Types of Tokens ............................................................................ 9-8
The First Type Abbreviation ......................................................... 9-9
The Subsequent Type Abbreviation .............................................. 9-11

Table of Contents - 4
Stratus® VOS Fundamentals 303

Chapter 9: Using the Abbreviations Facility (cont)


The All Type Abbreviation............................................................ 9-13
Controlling the Use of Abbreviations............................................ 9-15
Passing Command line Arguments to Abbreviation ..................... 9-17
Collecting Arguments from the Command Line ........................... 9-20
Parameters in Multiple Command Abbreviations ......................... 9-21
Competing Arguments on the Command Line.............................. 9-22
Summary of VOS Commands and Abbreviations Types.............. 9-23
Lab: Using the Abbreviations Facility .......................................... 9-24

Chapter 10: The Attributes and Resources of a User Process


Objectives ...................................................................................... 10-2
Stratus User Process ...................................................................... 10-4
Process Priority and the CPU ........................................................ 10-5
User Name and Access to the Directory Structure ........................ 10-7
Other Resources - Memory............................................................ 10-9
The I/O Connection ....................................................................... 10-10
Subprocesses.................................................................................. 10-13
Summary of Commands and Command Functions....................... 10-16
Lab: The Attributes and Resources of a Process ........................... 10-17

Chapter 11: Batch and Started Processes


Objectives ...................................................................................... 11-2
Differences Between Process Types.............................................. 11-3
The start_process Command ............................................... 11-5
The batch Command .................................................................. 11-6
Associated batch Commands......................................................... 11-7
Summary of Commands ................................................................ 11-8
Lab: Batch and Started Process ..................................................... 11-9

Table of Contents - 5
VOS Fundamentals 303 Stratus®

Table of Contents (continued)

Chapter 12: Command Macros I


Objectives ...................................................................................... 12-2
Simple Command Macros ............................................................. 12-3
Continuation of Lines .................................................................... 12-4
display_line in Command Macros................................................. 12-5
Macro Condition Statements ......................................................... 12-6
Changing the Flow of Execution ................................................... 12-8
Programs and Other Macros .......................................................... 12-9
Summary of Macro Statements ..................................................... 12-10
Lab 1: Command Macros .............................................................. 12-11

Chapter 13: Command Macros II


Objectives ...................................................................................... 13-2
Checking a Command's Status in a Macro .................................... 13-3
Allowing a Macro to Provide Input to a Program ......................... 13-4
Setting Variable Values ................................................................. 13-5
Testing Variables ........................................................................... 13-6
Getting a Macro to Prompt a User................................................. 13-7
Using a Macro to Read from a File ............................................... 13-8
Using A Macro to Write to a File .................................................. 13-9
start_up.cm Command Macro................................................ 13-10
Debugging Macros......................................................................... 13-11
Summary of Command and Command Functions ........................ 13-14
Lab 2: Command Macros .............................................................. 13-16

Table of Contents - 6
Stratus® VOS Fundamentals 303

Table of Contents (continued)

Chapter 14: Macro Input Parameters


Objectives ...................................................................................... 14-2
Input Parameters ............................................................................ 14-3
Argument Specifiers ...................................................................... 14-4
Labels............................................................................................. 14-5
Qualifiers ....................................................................................... 14-6
Default Values ............................................................................... 14-7
Option Parameters ......................................................................... 14-8
Switch Parameters ......................................................................... 14-9
&end_parameters ................................................................... 14-10
Summary of Macro Statements ..................................................... 14-11
Lab: Command Macros and Input Parameters .............................. 14-12

Appendix A: For More Information .................................................... A-1


Appendix B: Edit/Emacs Help Sheet.................................................... B-1
Appendix C: Header and Footer Keywords for print Command..... C-1
Appendix D: Favorite Abbreviations ................................................... D-1
Appendix E: Introduction to editing using emacs .............................. E-1
Appendix F: Editing Text using emacs ................................................ F-1
Appendix G: Emacs Timesaving Techniques...................................... G-1

Table of Contents - 7
VOS Fundamentals 303 Stratus®

Course Map

DAY 1
Chapter 1 - Overview of the Stratus System
Chapter 2 - Getting onto the System
Chapter 3 - The Directory Structure
Chapter 4 - File System Overview

DAY 2
Chapter 5 - Access Control
Chapter 6 - Introduction to Editing
Chapter 7 - Editing Text using edit
Chapter 8 - Edit Timesaving Techniques

DAY 3
Chapter 9 - Using the Abbreviations Facility
Chapter 10 - Process Attributes and Resources
Chapter 11 - Batch and Started Processes
Chapter 12 - Command Macros I

DAY 4
Chapter 13 - Command Macros II
Chapter 14 - Macro Input Parameters

The course map shows approximately how the topics will be covered in class.
The instructor may make changes to this map to make the class more effective
for you.

Table of Contents - 8
Stratus® VOS Fundamentals 303

Table of Contents - 9
Stratus® VOS Fundamentals 303

Slide 1-1
303 - VOS Fundamentals
Chapter 1
An
An Overview
Overview of
of the
the Stratus
Stratus System
System

Education
Stratus

An Overview of the Stratus System 1-1


VOS Fundamentals 303 Stratus®

Slide 1-2
Objectives

303 - VOS Fundamentals


•• Describe
Describe the
the Stratus
Stratus implementation
implementation of
of fault
fault
tolerance.
tolerance.

•• Define
Define the
the Stratus
Stratus terms
terms for
for components
components of
of aa
system.
system.

•• Identify
Identify the
the Stratus
Stratus peripherals
peripherals and
and software
software
facilities.
facilities.

Education
Stratus
Objectives

In order to become an effective Stratus user in the shortest time, the student needs
to find out a little bit about how they see the system, as well as how the system
sees them, the user. This Chapter will help the student understand the resources of
their Stratus system.

At the end of this chapter, the student should be able to:

• Describe the Stratus implementation of fault tolerance.

• Define the Stratus terms for components of a system.

• Identify the Stratus peripherals and software facilities.

1-2 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

Slide 1-3
Stratus Continuous Availability

303 - VOS Fundamentals


•• Continuous
Continuous availability
availability

•• Fault
Fault tolerant
tolerant

•• Reliability
Reliability

Education
Stratus
Stratus Continuous Availability

Founded in 1980, Stratus Computer, Inc. is the premier supplier of computer


systems and services where continuous availability is a critical need. Stratus offers
the world's broadest range of fault-tolerant and continuously available computer
platforms, application solutions, and professional services for today's business
critical operations.

• A Stratus computer system is a continuous availability machine designed


for on-line transaction processing application environments.

• The system has the capability to perform its functions, even in the
presence of a hardware failure, i.e., the system is fault tolerant.

• A Stratus system provides the reliability needed in environments with


critical applications.

An Overview of the Stratus System 1-3


VOS Fundamentals 303 Stratus®

Stratus Hardware Fault

Slide 1-4
Tolerance

303 - VOS Fundamentals


•• Fault
Fault Tolerance
Tolerance is
is implemented
implemented through
through hardware
hardware
–– Self-checking
Self-checking Boards
Boards
–– Duplexed
Duplexed Boards
Boards

Stratus Stratus
board board

Education
Stratus
Stratus Hardware Fault Tolerance

Stratus fault tolerance is implemented through hardware design.

• Self-checking Boards
All Stratus boards have a common layout to provide self-checking, i.e.
the board can determine if it is not functioning properly thereby insuring
data integrity.

• Duplexed Boards
Boards are duplexed (paired) to provide protection in case of a failure.

1-4 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

Slide 1-5
Traditional CPU Board

303 - VOS Fundamentals


Input
2+3=?

Processor
2+3=5

5
Output

Education
Stratus
Traditional CPU Board

The CPU board is a good example to illustrate how self-checking works.

In the traditional CPU, there is minimal checking of the output, but this doesn't
guarantee that the output is correct.

An Overview of the Stratus System 1-5


VOS Fundamentals 303 Stratus®

Slide 1-6
Stratus Self-Checking CPU Board
Input
2+3=?

303 - VOS Fundamentals


Processor
Board

Processor Processor
2+3=5 2+3=5

5 5= 5

Output

Education
Stratus
Stratus Self-Checking CPU Board

Each CPU board has two circuits doing the same calculation at the same time.
The results are compared to make sure they are the same. Thus, the boards are
self-checking.

1-6 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

Stratus Duplexed Architecture

Slide 1-7
Input Input
Processor 2 +3 =? Processor 2 + 3 = ?

303 - VOS Fundamentals


Board Board

Processor Processor Processor Processor


2 +3 =5 2 +3 =5 2 +3 =5 2 +3 =5

5 =5 5 =5

5
Output

Education
Stratus
Stratus Duplexed Architecture

Duplexing of Stratus Self-Checking Boards means that there are two identical
boards performing the exact same function at exactly the same time (lock-step).
If one fails, the other keeps processing without degradation of performance.

An Overview of the Stratus System 1-7


VOS Fundamentals 303 Stratus®

Stratus Duplexed Architecture

Slide 1-8
(cont)

303 - VOS Fundamentals


Input Input
2+3=? 2+3=?
Processor Processor
Board Board

Processor Processor Processor Processor


2+3=5 2+3=5 2+3= 6 2+3=5

5=5 6 5

Stop

5
Output

Education
Stratus
Stratus Duplexed Architecture

The duplexed partner protects against a single board failure.

1-8 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

XA/R Duplexed Architecture

Slide 1-9
StrataBUS
Backpanel
A Bus B Bus C
Connectors

303 - VOS Fundamentals


5
P/Q Bus
12
13
14 IOP
15 IOP
Memory
Memory
Memory
Memory
15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

30
31

CPU
CPU

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Education
Stratus
I/O Adapter Chassis I/O Adapters

XA/R Duplexed Architecture

A Stratus processing module contains two of each kind of hardware component to


run as a fault-tolerant computer.

The XA/R Duplexed Module Components are as follows:

• CPU Boards (Intel i860 family of processors)

• Memory Boards

• Input Output Processor Boards (IOP)

• StrataLINK Boards

An Overview of the Stratus System 1-9


VOS Fundamentals 303 Stratus®

Continuum Duplexed

Slide 1-10
Architecture

303 - VOS Fundamentals


Education
Stratus
Continuum Duplexed Architecture

The Continuum Duplexed Module Components are as follows:

• CPU/Mem Boards (HP PA-RISC family of processors)

• SCSI-ENET Boards

• PKIO Boards

• High Speed Comm Controller

• ReCC Boards

1 - 10 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

Slide 1-11
A Stratus System

303 - VOS Fundamentals


1 2 3 ... 32

Education
Stratus
processing modules up to severalmiles apart

A Stratus System

A Stratus System is made up of from 1 to 32 processing modules that are


connected together by either StrataLINK or Open StrataLINK in a local area
network.

• StrataLINK: Stratus proprietary LAN between Stratus modules and/or


systems using Stratus proprietary hardware.

• Open StrataLINK (OSL): Stratus proprietary LAN/WAN between


Stratus modules and/or systems using a client/server architecture and
works with TCP/IP.

• The user of a Stratus System sees the resources of all modules as being
part of one system. Any user can access all disks, printers, etc.

• The system can be dispersed to where the work is. It does not have to be
concentrated in a computer room.

An Overview of the Stratus System 1 - 11


VOS Fundamentals 303 Stratus®

Slide 1-12
Networking Stratus Systems

303 - VOS Fundamentals


London

San Francisco Maynard

X25
Public
Network

Dallas New York

Education
Stratus
Tokyo

Networking Stratus Systems

Stratus systems can be networked using Open StrataNET, StrataLINK or


StrataNET.

• StrataNET uses the X.25 protocol.

• Open StrataNET uses TCP/IP and Ethernet.

• Access to remote facilities is transparent to the user.

• Physical connection can be private leased line or public data network.

1 - 12 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

Slide 1-13
Stratus System Software

System/32 VOS Release 14.3, Module %class#m1

303 - VOS Fundamentals


Please login 09:56:26

Education
Stratus
Stratus System Software

The Stratus supports four operating systems: VOS (Virtual Operating System), a
fault tolerant UNIX operating system (FTX, Hewlett-Packard UNIX (HP-UX) and
Microsoft Windows 2000. They are the user's interface into a Stratus system.

• The slide shows the login banner for the VOS Operating System.

It shows:

- the release of VOS (Release 14.3)


- the name of the system (%class)
- the name of the module that the terminal is connected to (#m1).

An Overview of the Stratus System 1 - 13


VOS Fundamentals 303 Stratus®

Slide 1-14
Other Stratus Software

•• Programming
Programming Languages
Languages

303 - VOS Fundamentals


•• VOS
VOS Symbolic
Symbolic Debugger
Debugger
•• JYACC
JYACC Application
Application Manager
Manager
•• Transaction
Transaction Processing
Processing Facility
Facility (TPF)
(TPF)
•• Forms
Forms Management
Management System
System (FMS)
(FMS)
•• Stratus
Stratus ORACLE
ORACLE (data
(data base)
base)
•• Communication
Communication protocols
protocols

Education
Stratus
Other Stratus Software

• Programming languages

- Basic
-C
- C++ (Rel 14.3)
- COBOL
- PL/1
- FORTRAN77
- Pascal

1 - 14 An Overview of the Stratus System


Stratus® VOS Fundamentals 303

Slide 2-1
303 - VOS Fundamentals
Chapter 2
Getting
Getting Onto
Onto the
the System
System as
as aa User
User

Education
Stratus

Getting Onto the System as a User 2-1


VOS Fundamentals 303 Stratus®

Slide 2-2
Objectives

303 - VOS Fundamentals


•• Login
Login onon the
the Stratus
Stratus system.
system.
•• Find
Find the
the names
names of of commands
commands and and their
their various
various
options.
options.
•• Execute
Execute common
common commands.
commands.
•• Customize
Customize youryour terminal
terminal environment.
environment.
•• Use
Use command
command functions.
functions.
•• Use
Use the
the online
online help
help facility
facility as
as aa reference
reference tool.
tool.

Education
Stratus
Objectives

The first thing the student needs to be able to do is to log into the system and
execute some of the basic commands. In this chapter, the student learns to log in
and out of the system, execute commands, and customize the terminal
environment.

At the end of this chapter, the student should be able to:

• Login on the Stratus system.


• Find the names of commands and their various options.
• Execute common commands.
• Customize your terminal environment.
• Use command functions.
• Use the online help facility as a reference tool.

2-2 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-3
Window to the System

The CRT Terminal

303 - VOS Fundamentals


Education
Stratus
Window to the System: The CRT Terminal

• CRT-based system (Stratus terminal or PC terminal emulator)

• Terminal size 25 lines by 80 characters

- The 25th (status) line

• Keyboard function keys

- Stratus keyboards have function keys (V102 has 22, V103 has 20).
These function keys provide default functions that are recognized
by VOS and VOS applications.

- The same functionality on a PC running a terminal emulation


program is accomplished by using the Shift, Ctrl and Alt keys in
conjunction with the function keys F1-F12.

Getting Onto the System as a User 2-3


VOS Fundamentals 303 Stratus®

Slide 2-4
Logging onto the System

303 - VOS Fundamentals


•• Before
Before the
the user
user logs
logs in
in

•• Logging
Logging in
in

•• The
The ready
ready prompt
prompt

•• Logging
Logging out
out

Education
Stratus
Logging onto the System

• Before the user logs in:

- The pre-login process listens to your terminal line.

- Pre-login commands are available.

• Logging in:

- The login command

using a registered name: login Joe_Smith

using an alias: login joe

entering a password: Password? *****

2-4 Getting Onto the System as a User


Stratus® VOS Fundamentals 303
Logging onto the System (continued)

• The ready prompt:

- The ready prompt waits for a command. After the operating


system executes the command, the ready prompt appears again.
ready: help -type all [RETURN]
ready:

• Logging out:

- The logout command

Getting Onto the System as a User 2-5


VOS Fundamentals 303 Stratus®

Slide 2-5
Types of Commands

303 - VOS Fundamentals


•• Internal
Internal and
and external
external commands
commands

•• Privileged
Privileged commands
commands

•• Command
Command Line
Line
help
help -match
-match file;
file; help
help -match
-match print
print

Education
Stratus
Types of Commands

• Internal and external commands

- Internal commands are part of the operating system and therefore


residing in memory.

- External commands reside on disk as part of the file system.

External commands are simply executable program modules


files (.pm) or command macro files (.cm).

They need to be read into memory to execute.

- The System Administrator can control the use of specific


commands through Access Control Lists for each command.

2-6 Getting Onto the System as a User


Stratus® VOS Fundamentals 303
Types of Commands (continued)

• Privileged commands

- Some commands.

- Only executed by privileged users.

- Privilege is a user login attribute.

• Command Line

- A line containing a command is a command line.

- To execute the command line, press either the [RETURN] key or


the [ENTER] key.

- A command line can contain multiple commands.

Separated by semicolon(s)

Executed sequentially

help -match file; help -match print

Getting Onto the System as a User 2-7


VOS Fundamentals 303 Stratus®

Slide 2-6
Command Arguments

•• VOS
VOS commands
commands take
take three
three kinds
kinds of
of arguments

303 - VOS Fundamentals


arguments
–– Positional:
Positional: copy_file
copy_file old
old new
new

–– Switch:
Switch: on
on print
print old
old -line_numbers
-line_numbers
off
off copy_file
copy_file old
old new
new -no_keep_extents
-no_keep_extents

–– Option:
Option: print
print old
old -copies
-copies 55
help
help -match file
-match file

Education
Stratus
• VOS commands can take three kinds of arguments

- Positional

- Switch

- Option

2-8 Getting Onto the System as a User


Stratus® VOS Fundamentals 303
Command Arguments (continued)

• Examples of command arguments

- Positional: values are taken from the position of the argument on


the command line
copy_file old new

- Switch: values are taken from the specifying keyword. The


switch can be either:

on

print old -line_numbers

off

copy_file old new -no_keep_extents

- Option: values are taken from an argument following the


keyword

print old -copies 5

help -match file

Note: Changes to the default settings of any argument are only effective
for the current execution of the command.

Getting Onto the System as a User 2-9


VOS Fundamentals 303 Stratus®

Slide 2-7
Display Command Arguments

303 - VOS Fundamentals


•• The -usage option
The -usage option
ready:
ready: copy_file
copy_file -usage
-usage [RETURN]
[RETURN]

Usage:
Usage: copy_file
copy_file source_file
source_file [destination]
[destination] [-pack]
[-pack]
[-parallel]
[-parallel] [-truncate] [-delete] [-keep_dates]
[-truncate] [-delete] [-keep_dates]
[-keep_acl]
[-keep_acl] [-no_keep_extents]
[-no_keep_extents] [-brief]
[-brief]
[-keep_safety_switch]
[-keep_safety_switch]

ready:
ready:

Education
Stratus
Displaying command arguments

To determine the correct keywords (arguments) and the required order for
positional arguments on any command, use the -usage or the -form option.

The -usage option displays the command's arguments on the terminal and then
returns to the ready: prompt.

Arguments that are enclosed in square brackets ([ ]) are optional. They usually
have default values.

Arguments that are not enclosed in square brackets require the user to enter a
value.

2 - 10 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-8
Display Command Arguments

303 - VOS Fundamentals


•• The
The [DISPLAY FORM] key
[DISPLAY FORM] key or -form option
or -form option

------------------------------
------------------------------ copy_file
copy_file ---------------------------
---------------------------
source_file:
source_file:
destination:
destination:
-pack:
-pack: no
no
-parallel:
-parallel: no
no
-truncate:
-truncate: no
no
-delete:
-delete: no
no
-keep_dates:
-keep_dates: no
no
-keep_acl:
-keep_acl: no
no
-keep_extents:
-keep_extents: yes
yes
-brief:
-brief: no
no
-keep_safety_switch:
-keep_safety_switch: no
no

Education
Stratus
Displaying command arguments

The [DISPLAY FORM] key or the -form option will display the arguments of the
command on the terminal vertically and will not return the user to the ready:
prompt. The values initially displayed in the argument fields are the default values.
If the value field is displayed in reverse video (high lighted), the user is required to
enter a value there in order for the command to be executed.

While in the form of the command, the cursor may be moved to any argument and
the user may overwrite the default. (more later)

To execute the command, press the [ENTER] key.

To return to the ready: prompt, press the [CANCEL] key.

Getting Onto the System as a User 2 - 11


VOS Fundamentals 303 Stratus®

Slide 2-9
Editing the Command Line

303 - VOS Fundamentals


•• Before [RETURN] or
Before [RETURN] or [ENTER]
[ENTER]

–– Insert
Insert Mode
Mode

–– Positioning
Positioning cursor
cursor

–– Deleting
Deleting characters
characters

–– Canceling
Canceling the
the command
command

Education
Stratus
Editing the Command Line

Before [RETURN] or [ENTER]

• Many of the function keys are available for editing the command line.

- Insert mode

- Positioning cursor
[Right Arrow] [Left Arrow]
[SHIFT]-[Right Arrow] [SHIFT]-[Left Arrow]
[GOTO] -[Right Arrow] [GOTO] -[Left Arrow]

- Deleting characters
[BACKSPACE] [DELETE]-[WORD]
[DEL] [DELETE]-[Right Arrow]
[DELETE]-[Left Arrow]

- Canceling the command


[CANCEL]

2 - 12 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-10
Editing the Command Line

303 - VOS Fundamentals


•• Using
Using the
the [DISPLAY FORM] or
[DISPLAY FORM] or -form
-form

–– Positioning
Positioning in
in the
the form
form

–– Cycle
Cycle fields
fields

–– Executing
Executing the
the form
form

–– Canceling
Canceling the
the form
form

Education
Stratus
Editing the Command Line (continued)

• Using the [DISPLAY FORM] or –form

- Positioning the cursor within the form


[Up Arrow] [Down Arrow]
[RETURN] [TAB] [BACK TAB]
[Right Arrow] [Left Arrow]

- Cycle fields
[CYCLE] [CYCLE-BACK]
[Right Arrow] [Left Arrow]

- Executing the command that is in the form


[ENTER] (Note: Can't use the [RETURN] key.)

- Canceling the form


[CANCEL]

Getting Onto the System as a User 2 - 13


VOS Fundamentals 303 Stratus®

Slide 2-11
Canceling Execution

303 - VOS Fundamentals


•• After [RETURN] or
After [RETURN] or [ENTER]
[ENTER]

–– Canceling
Canceling the
the output
output of
of aa command
command

–– Stopping
Stopping execution
execution of
of aa command
command

–– Saving/restoring
Saving/restoring command
command lines
lines

Education
Stratus
Canceling the execution of a command

After [RETURN] or [ENTER]

• Canceling the output of a command


[CANCEL]

• Stopping execution of a command


[CTRL-BREAK] (Hit twice if the terminal
[CTRL-C] device_type = window_term)

• Saving/restoring command lines


[INSERT SAVED]
[INSERT DEFAULT]

2 - 14 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-12
Command Functions

303 - VOS Fundamentals


•• Command
Command Functions
Functions are
are used
used as
as arguments
arguments to
to
VOS
VOS commands.
commands.
display_line
display_line Today
Today is
is (date)
(date)

display_line
display_line Time
Time is
is (time)
(time)

•• The display_line command


The display_line command
display_line
display_line Welcome
Welcome to
to Class
Class

Education
Stratus
Command Functions

• A Command Function is a self-contained function that can be used as an


argument in a command line. Before execution, the command processor
evaluates the command function and replaces it with a value.

- Command Functions must be enclosed in parentheses.

• The display_line command

- Used to display (echo) a line of text to the terminal


display_line Welcome to Class

- Use display_line to see the value of a Command Function.


display_line Today is (date)
display_line Time is (time)

• Command Functions may also have arguments. Use the VOS StrataDOC
facility to list the arguments and obtain the proper syntax.

Getting Onto the System as a User 2 - 15


VOS Fundamentals 303 Stratus®

Slide 2-13
Online Help Facility

303 - VOS Fundamentals


•• For
For aa list
list of
of VOS
VOS commands
commands or
or command
command
functions,
functions, use use the help command
the help command with
with
-type or
-type -match..
or -match
ready:
ready: help
help [DISPLAY
[DISPLAY FORM]
FORM]
--------------------
-------------------- help
help ------------------
------------------
topic_name
topic_name ::
-type:
-type: subsystem
subsystem
-match:
-match:
-text:
-text: no
no

Education
Stratus
Online Help Facility

The Stratus online help facility is part of the operating system that provides users
with a list of commands and command functions at the terminal screen.
topic_name: No longer supported.

-type: Displays a list of commands or command functions


qualified by type: all, internal, external and function..

-match: Lists commands and command functions that contain the


specified string. -match is case sensitive.
ready:
help -match file
copy_file
create_file
delete_file
display_file_status

-text: No longer supported.

2 - 16 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Customizing the Terminal

Slide 2-16
Environment
---------------------------
---------------------------set_terminal_parameters
set_terminal_parameters--------------------------
--------------------------

303 - VOS Fundamentals


-line_length:
-line_length: 80
80
-terminal_type:
-terminal_type: v103
v103
-setup:
-setup: 80x24
80x24
-system_message:
-system_message:
-prompt_message:
-prompt_message:
-continue_message:
-continue_message: ++
-pause_message:
-pause_message: --PAUSE--
--PAUSE--
-pause_lines:
-pause_lines: 24
24
-max_typeahead_lines:
-max_typeahead_lines: 10
10
-tabs1:
-tabs1: 6,11,16,21,26,31,36,41,46,51,56,61,66,71,76,81
6,11,16,21,26,31,36,41,46,51,56,61,66,71,76,81
-tabs2:
-tabs2: 86,91,96,101,106,111,116,121,126
86,91,96,101,106,111,116,121,126
-break_action:
-break_action: signal_and_discard
signal_and_discard
-cursor_format:
-cursor_format: steady_block
steady_block
-wait_cursor_format:
-wait_cursor_format: off
off
-forms_style:
-forms_style: overlay
overlay
-escape:
-escape: `` -break_to_wmgr:
-break_to_wmgr: yes
yes
-black_on_white:
-black_on_white: no
no -initial_overlay_on:
-initial_overlay_on: no
no
-key_click_on:
-key_click_on: no
no -cancel_doesnt_abort:
-cancel_doesnt_abort: no
no
-smooth_scroll:
-smooth_scroll: no
no -return_doesnt_unpause:
-return_doesnt_unpause: no
no
-interrupt_key_enabled:
-interrupt_key_enabled: yes
yes -return_doesnt_tab:
-return_doesnt_tab: no
no
-clear_reused_screen_pages:
-clear_reused_screen_pages: no
no -allow_multiple_users:
-allow_multiple_users: no
no

Education
Stratus
Customizing the Terminal Environment

• Changing the terminal parameters

set_terminal_parameters

- If the terminal_type argument in this command is not


set properly, the terminal will not function correctly.

Some common terminal types are:


-terminal_type v103
v103_ascii
window_term

• Displaying the terminal parameters

display_terminal_parameters

Getting Onto the System as a User 2 - 17


VOS Fundamentals 303 Stratus®

Slide 2-15
Some Basic Commands

303 - VOS Fundamentals


•• The
The list
list command
command
ready:
ready: list
list [RETURN]
[RETURN]

Files:
Files: 4,
4, Blocks:
Blocks: 16
16

ww 22 abbreviations
abbreviations
ww 77 auto.pm
auto.pm
ww 66 count_25.pm
count_25.pm
ww 11 demo_file
demo_file

Education
Stratus
The list command

• The list command is used to see the names of the files and
subdirectories in a directory.

• By default, the list command shows only the files in the directory.

2 - 18 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-18
Some Basic Commands

303 - VOS Fundamentals


•• The
The display
display command
command

–– Used
Used to
to see
see the
the contents
contents of
of aa particular
particular file
file

display
display abbreviations
abbreviations

Education
Stratus
The display command

• The display command allows the user to view the contents of a


particular file on the terminal screen.

• The -match keyword followed by a <character string> allows the


display of only lines that contain a match for the character string.

Getting Onto the System as a User 2 - 19


VOS Fundamentals 303 Stratus®

Slide 2-19
Some Basic Commands

------------------------------------print
------------------------------------ print-----------------------------------
-----------------------------------

303 - VOS Fundamentals


file_names:
file_names: <Required
<Requiredfield>
field>
-queue:
-queue: standard
standard
-title:
-title:
-destination:
-destination:
-module:
-module:
-device:
-device:
-header:
-header:
-footer:
-footer:
-index:
-index:
-defer_until:
-defer_until:
-interpret_tabs:
-interpret_tabs:
-exception_handling:
-exception_handling: replace
replace
-copies:
-copies: 11 -line_numbers:
-line_numbers: no
no
-delete:
-delete: no
no -raw:
-raw: no
no
-page_breaks:
-page_breaks: yes
yes -use_fortran_controls:
-use_fortran_controls: no
no
-indentation:
-indentation: 00 -page_size:
-page_size:
-top_margin:
-top_margin: 33 -bottom_margin:
-bottom_margin: 33
-line_length:
-line_length: -wrap:
-wrap: no
no
-queue_priority:
-queue_priority: -notify:
-notify: no
no
-first_page:
-first_page: 11 -last_page:
-last_page: 00
-pass_thru:
-pass_thru: no
no

Education
Stratus
The print command

• The print command puts a print request into a print queue for printing.

- The default print queue is named standard.

2 - 20 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-20
Some Basic Commands
•• Managing
Managing print
print requests
requests
–– The list_print_requests command
The list_print_requests command

303 - VOS Fundamentals


-------------list_print_requests
-------------list_print_requests -------------
-------------
-queue:
-queue: standard
standard
-module:
-module:
-all:
-all: no
no
-long:
-long: no
no

–– The cancel_print_requests command


The cancel_print_requests command
-------------
------------- cancel_print_requests
cancel_print_requests ------------
------------
file_names:
file_names:
-user:
-user:
-queue:
-queue: standard
standard
-module:
-module:

Education
Stratus
-ask:
-ask: yes
yes

Managing print requests

• The list_print_requests command

- Used to display the print requests in the print queue specified by


the argument -queue.

- The default queue is named standard.

• The cancel_print_requests command

- Used to cancel one or more print requests in the print queue


specified by the argument -queue.

- The default queue is named standard.

Getting Onto the System as a User 2 - 21


VOS Fundamentals 303 Stratus®

Slide 2-21
Some Basic Commands

•• The list_users command


The list_users command

303 - VOS Fundamentals


–– ItIt is
is used
used to
to see
see who
who is
is logged
logged in.
in.

•• The send_message command


The send_message command
-----------
----------- send_message
send_message ----------------------------
----------------------------
person:
person:
text:
text:
-module:
-module: **
-beep:
-beep: yes
yes
-system:
-system: no
no
-check_receivers:
-check_receivers: yes
yes

Education
Stratus
Sending a message

• The list_users command


- It is used to see who is logged in.
- You will see yourself on this display.

• The send_message command


- It is used to send messages to other users.
- Use the lineal form to send long messages by using quotes.
- Use the prompt format to send several lines.
A period (.) by itself, will terminate the command
ready 17:41:54
send_message (person_name)
-> this is a
-> multi-line
-> message
-> .
ready 17:42:44

- The keyword -system sends the message to the status line.

2 - 22 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 2-22
Logging the Terminal Session

•• Use
Use the start_logging command
the start_logging command to
to log
log the
the

303 - VOS Fundamentals


terminal
terminal session
session into
into aa file.
file.
ready:
ready: start_logging
start_logging log.(date)
log.(date)

•• Use
Use the stop_logging command
the stop_logging command to to stop
stop any
any
more
more terminal
terminal output
output from
from going
going in
in the
the file.
file.
ready:
ready: stop_logging
stop_logging

Education
Stratus
Logging the Terminal Session

• Use the start_logging command to capture the I/O traffic for the
terminal session into a file.

- The command requires a name for the output file.

ready: start_logging log.(date)

- You cannot display or print log files while logging.

- Use the -append option to add to an existing file instead of


overwriting it.

Getting Onto the System as a User 2 - 23


VOS Fundamentals 303 Stratus®
Logging the Terminal Session (continued)

• If the [DISPLAY-FORM] is used during the logging session, the form is


not recorded in the log file.

• To capture the information in the [DISPLAY-FORM]

Combining -usage and [DISPLAY FORM] or -form

copy_file abc new_abc –usage -form


------------------ copy_file ---------------------
source_file: abc
destination: new_abc
-pack: no
-parallel: no
-truncate: no
-delete: no
-keep_dates: no
-keep_acl: no
-keep_extents: yes
-brief: no
-keep_safety_switch: no

• Use the stop_logging command to stop any more terminal output from
going in the file.

ready: stop_logging

- You can display and print log files once logging has stopped.

2 - 24 Getting Onto the System as a User


Stratus® VOS Fundamentals 303
Summary of Command Editing

Subject Qualifier Keystrokes

Cancel non-executing command [CANCEL]


executing command [CTRL]-[BREAK]
[CTRL]-[C]
Delete character [BACK SPACE]
[DEL]

word [DELETE] [WORD]

lineal format line or [DELETE] [RightArrow]


display field [DELETE] [LeftArrow]

Execute command lineal format only [RETURN]


lineal or display format [ENTER]

Position character [RightArrow]


[LeftArrow]

word [SHIFT]-[RightArrow]
[SHIFT]-[LeftArrow]

lineal format line only [GOTO]-[RightArrow]


[GOTO]-[LeftArrow]

display field only [UpArrow][RightArrow]


[DownArrow][LeftArrow]
[RETURN]
[TAB] [BACK TAB]

Restore [INSERT SAVED]


[INSERT DEFAULT]

Getting Onto the System as a User 2 - 25


VOS Fundamentals 303 Stratus®
Summary of Commands and Command Functions

VOS Commands & chapter page numbers

cancel_print_requests (21) logout (5)


display (19) print (20)
display_line (15) send_message (22)
help (16) set_ready (19)
list (18) set_terminal_parameters (17)
list_print_requests (21) start_logging (23)
list_users (22) stop_logging(24)
login (4)

VOS Command Functions & chapter page numbers


(date [args] ) (15)
(time [args] ) (15)

Remember

• To see the files in a directory, use list.

• To see the contents of a file, use display.

• To see the value of a Command Function, use display_line.


• To get a list of all VOS commands and Command Functions,
use help -type all.

2 - 26 Getting Onto the System as a User


Stratus® VOS Fundamentals 303
Lab: Getting Onto the System as a User

Purpose: To practice logging in and executing various basic VOS commands:


start_logging, display_line, list, display, print,
list_users, send_message, and stop_logging.

Use the -usage or -form keyword or [DISPLAY FORM] key to help you
complete these exercises.

1. Log in (get your login information from the instructor).

2. Start logging this terminal session in a file called log2.your_name.

3. Use the command function, (date), with the appropriate command to


write the current date on the terminal.

4. List all the files in your directory.

5. Your directory contains a file called abbreviations.


Print this file.

6. Display the abbreviations file.

7. A line in the abbreviations file contains the word, logout. Using the
display command with –match, find the word logout in this file.

8. Find out who is logged in on the system.

9. Send a message to someone else in the class. Be sure it appears on the


25th line of their terminal.

10. Stop any more logging. Print your log file.

Getting Onto the System as a User 2 - 27


VOS Fundamentals 303 Stratus®
Lab: Getting Onto the System as a User

Optional

11. Print your log file with page numbers at the bottom of each page.
Have the system notify you when the job is finished.
(You'll need to read Appendix C - to see how to get page numbers
at the bottom of each printed page.)

12. Add a second prompt 'Okay, ‘ to the ready prompt.


Hint: Use the set_terminal_parameters command.

13. Logout.

14. Observe the results when you attempt to login as a privileged user.
You should receive an error message.

login [usere_name] –privileged

2 - 28 Getting Onto the System as a User


Stratus® VOS Fundamentals 303

Slide 3-1
303 - VOS Fundamentals
Chapter 3
The
The Directory
Directory Structure
Structure

Education
Stratus

The Directory Structure 3-1


VOS Fundamentals 303 Stratus®

Slide 3-2
Objectives

•• Describe
Describe thethe hierarchical
hierarchical directory
directory structure
structure

303 - VOS Fundamentals


•• Define
Define terms
terms
•• Build
Build aa full
full path
path name
name
•• Use
Use relative
relative path
path names
names
•• Use
Use commands
commands to to create,
create, examine,
examine, and
and delete
delete
directories,
directories, and
and move
move within
within directory
directory structure
structure
•• Use
Use commands
commands to to make,
make, access,
access, and
and break
break links
links

Education
Stratus
Objectives

In order to move around a Stratus system, it is necessary to understand the


directory structure and its parts. In this chapter, you will learn about the directory
structure, the system directories, naming objects in the I/O system, and the
commands that you can use in the directory structure.

At the end of this chapter, the student should be able to:

• Describe the hierarchical directory structure


• Define terms
• Build a full path name
• Use relative path names
• Use commands to create, examine, and delete directories, and move
within directory structure
• Use commands to make, access, and break links

3-2 The Directory Structure


Stratus® VOS Fundamentals 303

Hierarchical Directory

Slide 3-3
Structure

303 - VOS Fundamentals


m aste r _ d is k

sy stem g r o up d ir ecto r ies

Education
Stratus
Hierarchical Directory Structure

• The objects in the directory structure are directories, files, and links.

• Each disk has a top-level directory called the disk directory.

- The name of the disk directory uniquely identifies a disk in a


system.
- There is one and only one disk directory per logical disk.
- A disk directory may cover several physical disks to make one
large logical disk. A single physical disk can never be split into
several disk directories.
- One disk directory per module is designated as the master disk for
that module.
- All other directories on the disk, below the disk directory, are
subdirectories.
- The maximum depth of the directory hierarchy is 32 levels (prior
to VOS 14.0, the maximum depth is 15 levels).

The Directory Structure 3-3


VOS Fundamentals 303 Stratus®

Conventional Group and Person

Slide 3-4
Level Structure
#d101

303 - VOS Fundamentals


g ro up d ire c to rie s

VOS _Fundame ntals VOS Pro g ramme r

p e rs o n d ire c to rie s
p e rs o n d ire c to rie s

vf1 vf2 vf3 vp1 vp2

re po rts me mo s s tart up.c m abbre viatio ns pe rs o nne l file

we e kly mo nthly

Education
Stratus
we e k-02-18 we e k-02-25

Conventional Group and Person Level Structure

• The first level subdirectories under the master disk are the system
directories and group directories for users.

• Group directories are generally one level below the disk directory.

• Group directories are a way of organizing individual users into


categories, such as geographical location, project, department, etc.

• Access to directories can be organized by group name.

• Typically, the person directories are one level below their group
directory.

3-4 The Directory Structure


Stratus® VOS Fundamentals 303
Conventional Group and Person Level Structure (continued)

• The default home directory for a user is a directory based on their


person_name.

- The user’s person_name and group_name are set by the System


Administrator.

- The home directory is used by the system for abbreviations and


start_up.cm. Users store their files, directories, and links here.

The Directory Structure 3-5


VOS Fundamentals 303 Stratus®

Slide 3-5
Full Path Names

303 - VOS Fundamentals


•• Elements
Elements in
in aa path
path name
name
%class#d101>VOS_Fund>vf2>reports>weekly>week-02-25
%class#d101>VOS_Fund>vf2>reports>weekly>week-02-25
Top
Toplevel
level Group
Grouplevel
level Subdirectories
Subdirectories Object
Object
directory
directory directory
directory

Education
Stratus
Full Path Names

• A path name is a collection of object names in the directory structure


strung together to make a single name (up to 256 characters long).

• There are two rules for cataloging objects in directories.

- Every object in a directory must be uniquely named.


- An object can be catalogued in only one directory.

• Objects with the same name can exist in different directories.

• You can construct a path name which uniquely identifies an object in the
directory structure.

• A full path name can be used from anywhere in the network to uniquely
reference any object.

3-6 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 3-6
Sample Directory
#d101

g ro u p d ire c to rie s .....

303 - VOS Fundamentals


VOS _ Fu n d a me n ta ls

p e rs o n d ire c to rie s

vf1 vf2 vf3

re p o rts me mo s s ta rt_ u p .c m a b b re via tio n s p e rs o n n e l_ file

w e e kly mo n th ly

Education
Stratus
w e e k-0 2 -1 8 w e e k-0 2 -2 5

Sample Directory

• Sample full path name:


%class#d101>VOS_Fundamentals>vf2>reports>weekly>week-02-25

The Directory Structure 3-7


VOS Fundamentals 303 Stratus®

Slide 3-7
Relative Path Names

•• ## refers
refers to
to aa specific
specific disk
disk directory
directory

303 - VOS Fundamentals


#d101>VOS_Fundamentals>vf2>reports
#d101>VOS_Fundamentals>vf2>reports
•• >> refers
refers to
to the
the current
current disk
disk directory
directory
>VOS_Fundamentals
>VOS_Fundamentals
•• << refers
refers to
to aa level
level above
above the
the current
current level
level
<abbreviations
<abbreviations
<<memos
<<memos
•• other
other than
than %,
%, #,
#, >,
>, or
or << refers
refers to
to current
current directory
directory
week-02-25
week-02-25

Education
Stratus
Relative Path Names

Relative means dependent on your current location within the directory hierarchy.

• A relative path name starting with a # refers to an object beginning with


a specific disk directory on the current system.

• A relative path name beginning with the > refers to the current disk
directory.

• A relative path name starting with the < refers to one level above the
current directory.

• A path name starting with a character other than %, #, >, or < refers to
an object within your current directory.

3-8 The Directory Structure


Stratus® VOS Fundamentals 303
Navigating the Directory Tree

• The directory that you are in is called your current directory.

- Use the command display_line with the command function


(current_dir) to display your current directory.

display_line (current_dir)

- You can also use the command display_current_dir to see the path
name of your current directory.

ready: display_current_dir
%class#d101>VOS_Fundamentals>vf2

- The standard abbreviation file contains dcd as the abbreviation


for display_current_dir.

• To move within the directory tree structure, use the command


change_current_dir (ccd)

ccd >VOS_Fundamentals>vf3
ccd <VOS_Fundamentals>vf1
ccd >

• To return to your home directory, use change_current_dir or its


abbreviation, ccd without an argument.

The Directory Structure 3-9


VOS Fundamentals 303 Stratus®

Slide 3-8
list command

303 - VOS Fundamentals


------------------------
------------------------ list
list ----------------------
----------------------
path_name:
path_name:
-files:
-files: yes
yes
-dirs:
-dirs: no
no
-links:
-links: no
no
-sort:
-sort: name
name
-full:
-full: no
no
-names_only:
-names_only: no
no
-totals:
-totals: no
no
-header:
-header: no
no
-exclude:
-exclude:

Education
Stratus
Looking at the Contents of a Directory

• The list command displays the contents of a directory. Without any


keywords, it will display only the files in the current directory.

• The list command can be used with a path name to show files in a
directory other than the current directory.
Note: You must put >* at the end of the path name.

list >VOS_Fundamentals>vf2>*

• Common keywords with the list command

-dirs list directories


-links list links
-all list files, directories, and links
-sort sort output by names, dates(s), or size

3 - 10 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 3-9
Directory Commands

303 - VOS Fundamentals


ready:
ready: create_dir
create_dir reports>yearly
reports>yearly -form
-form

--------------------
-------------------- create_dir
create_dir --------------------
--------------------
directory_name: reports>yearly
directory_name: reports>yearly

Education
Stratus
• create_dir: Used to create a new subdirectory

ready: create_dir reports>yearly -form


-------------------- create_dir --------------------
directory_name: reports>yearly

(Rules for naming directory objects are on the next page.)

The Directory Structure 3 - 11


VOS Fundamentals 303 Stratus®

Naming an Object

• An object name consists of 1- 32 contiguous characters.

• Allowable characters

- Upper and lower case characters are unique. (e.g., test is a different
filename than TEST).

- Digits 0-9

- ASCII characters
@ [ \ ] ^ ` { | } ~ " $ + , - . / : _

• Certain characters are illegal

- Non-printing (control) characters

- The SPACE and DEL characters

- Certain ASCII characters


! # % & ' ( ) * ; < > = ?

• An object name cannot begin with a hyphen (-).

3 - 12 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 3-10
Directory Commands

303 - VOS Fundamentals


ready:
ready: delete_dir
delete_dir weekly
weekly -form
-form

--------------------
-------------------- delete_dir
delete_dir --------------------
--------------------
directory_name:
directory_name: weeklyweekly
-ask:
-ask: yes
yes
-expired_only:
-expired_only: yes yes
-brief:
-brief: no
no

Education
Stratus
• delete_dir: Deletes a directory and everything contained in it,
and everything below it.

-ask: If the directory is not empty, the command will ask if you wish to
delete the directory.

-expired_only: Delete only those files whose expiration dates have passed.

-brief: Suppress the display of each directory name that matches a star name.

The Directory Structure 3 - 13


VOS Fundamentals 303 Stratus®

Slide 3-11
Directory Commands

ready:
ready:copy_dir
copy_dir reports
reports >VOS_Fundamentals>public_reports
>VOS_Fundamentals>public_reports -form
-form

303 - VOS Fundamentals


--------------------
--------------------copy_dir
copy_dir-------------------------------
-------------------------------
source_directory:
source_directory: reports
reports
destination:
destination: >VOS_Fundamentals>public_reports
>VOS_Fundamentals>public_reports
-pack:
-pack: no
no
-delete:
-delete: no
no
-files:
-files: yes
yes
-dirs:
-dirs: yes
yes
-links:
-links: yes
yes
-translate_links:
-translate_links: yes
yes
-keep_dates:
-keep_dates: no
no
-keep_safety_switch:
-keep_safety_switch: no no
-brief:
-brief: no
no

Education
Stratus
• copy_dir: Copies a directory and its contents to another place.

-pack: Discard deleted records.

-delete: Delete destination directory if one exits

-files: Suppress the copying of all files.

-dirs: Suppress the copying of all subdirectories.

-links: Suppress the copying of all links.

-translate_links: Suppress the translation of links.

-keep_dates: Keep the existing dates of files and directories.

-keep_safety_switch: Keep the Safety_Switch status if active.

-brief: Suppress the display of each directory.

3 - 14 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 3-12
Directory Commands

303 - VOS Fundamentals


ready:
ready:move_dir
move_dir reports
reports >VOS_Fundamentals>public_reports
>VOS_Fundamentals>public_reports -form
-form

--------------------
--------------------move_dir
move_dir-------------------------------
-------------------------------
source_directory:
source_directory: reports
reports
destination:
destination: >VOS_Fundamentals>public_reports
>VOS_Fundamentals>public_reports
-pack:
-pack: no
no
-delete:
-delete: no
no
-keep_dates:
-keep_dates: no
no
-brief:
-brief: no
no

Education
Stratus
• move_dir: Creates a copy of a directory and its contents,
and then deletes the original directory.

-pack: Discard deleted records.

-delete: Delete destination directory if one exists.

-keep_dates: Keep the existing dates of files and directories.

-brief: Suppress the display of each directory.

The Directory Structure 3 - 15


VOS Fundamentals 303 Stratus®

Slide 3-13
Directory Commands

303 - VOS Fundamentals


ready:
ready:rename
rename memos
memos per_memos
per_memos -form
-form

--------------------
--------------------rename
rename-------------
-------------
old_name:
old_name: memos
memos
new_name:
new_name: per_memos
per_memos
-delete:
-delete: nono
-files:
-files: yes yes
-dirs:
-dirs: no
no
-links:
-links: no no
-brief:
-brief: no no

Education
Stratus
• rename: Changes the name of the directory.

-delete: Delete destination directory if one exists.

-files: (only applies to renaming files)


-dirs: Renames all directories whose names match.
Only effective if old_name is a star name.
Only effective if -all is yes.
-links: Renames all links whose names match.
Only effective if old_name is a star name.
Only effective if -all is yes.

-brief: Suppress the display of each directory.

3 - 16 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 3-14
Directory Commands

ready:
ready:display_dir_status
display_dir_status per_memos
per_memos -form

303 - VOS Fundamentals


-form

--------------------------
--------------------------display_dir_status
display_dir_status-------------------
-------------------
directory_names:
directory_names: per_memos
per_memos
name:
name: %educ#d102>Education>Jack_Rabbit>per_memos
%educ#d102>Education>Jack_Rabbit>per_memos
last used at:
last used at: 01-07-14
01-07-1414:08:42
14:08:42est
est
last modified at: 01-07-14 14:08:42
last modified at: 01-07-14 14:08:42 est est
last
lastsaved
savedat:
at: never
never
time
timecreated:
created: 01-07-14
01-07-1414:08:14
14:08:14est
est
blocks used:
blocks used: 11
mode:
mode: mm
author:
author: Jack_Rabbit.Education
Jack_Rabbit.Education

Education
Stratus
• display_dir_status: Displays information about a specified
directory

The Directory Structure 3 - 17


VOS Fundamentals 303 Stratus®

Slide 3-15
Links in the Directory Structure
#d101 #d102

303 - VOS Fundamentals


reports
re ports VOS Fundamentals VOS Prog

we ekly mo nthly
vf1 vf2 vf3 vp1 vp2

we ek-02-18

abbreviatio ns me mos rpt we ek-02-25

pers onnel file

s tart up.cm

rpt -> %clas s #d101>reports


reports -> %clas s #d102>reports

Education
Stratus
Links in the Directory Structure

• A link is an object in a directory that points to a file, or a directory, or


another link.

- A directory can contain more than one link.


- The link command creates a link with a full path name.

link >reports rpt

rpt -> %class#d101>reports

• You can reference the name of a link the same way you would use the
path name of an object.

ccd rpt

3 - 18 The Directory Structure


Stratus® VOS Fundamentals 303
Links in the Directory Structure

• Use for links:

- Create a shortened name that points to a long, descriptive name.

rpt -> %class#d101>reports

ccd rpt

- Links allows you to move a file to another location without


effecting others who reference that file location.

weekly ->%class#d101>reports>weekly

display weekly>week-02-18

- You can use a link in an application, to point to a data file.


This allows the application to run on any system or module,
thus making the application portable.

Note: Links can point to other links. However, if there are more than
10 links in the chain, VOS stops the search and displays an error
message.

The Directory Structure 3 - 19


VOS Fundamentals 303 Stratus®

Slide 3-16
Link Commands

--------------------
--------------------link
link--------------------
--------------------

303 - VOS Fundamentals


target_name:
target_name: >VOS_User
>VOS_User
link_name:
link_name: vu
vu
-delete:
-delete: no
no
-brief:
-brief: no
no

--------------------
--------------------unlink
unlink--------------------
--------------------
link_names:
link_names: vu
vu
-ask:
-ask: yes
yes
-brief:
-brief: no
no

Education
Stratus
Link Commands

• The link command is used to create links.

• The unlink command is used to break links.

• Use list -links or list -all to see the links in your current
directory.

• Use the where_path command to chase links and return the name of the
object at the final destination. Very helpful when links point to links.

-link: displays all links encountered while resolving the path name.

3 - 20 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 3-17
walk_dir command

walk_dir -------------------

303 - VOS Fundamentals


-------------------
directory_name: %ed16#d101>SysAdmin>Admin
-depth:
-down_command:
-down_start_process: no
-up_command:
-up_start_process: no

Education
Stratus
walk_dir command

• The walk_dir command walks through the directory tree, executing the
same command in the directory specified and all its subdirectories.

ready: walk_dir reports -down_command 'list *02-*'

• If the command line uses external commands, set the appropriate start
process argument to yes. This is not required for internal commands.

- The where_command shows you the type of command:


internal, external, or command macro.
ready: where_command list
list: (internal command)

ready: where_command print


print: %class#d101>system>command_library>print.pm (external
command)

The Directory Structure 3 - 21


VOS Fundamentals 303 Stratus®
Summary of Commands

VOS Commands & chapter page numbers

change_current_dir (9)
copy_dir (14)
create_dir (11)
delete_dir (13)
display_current_dir (9)
display_dir_status (17)
link (20)
list (10)
move_dir (15)
rename (16)
unlink (20)
walk_dir (21)
where_command (21)
where_path (20)

VOS Command Functions

(current_dir) (9)

3 - 22 The Directory Structure


Stratus® VOS Fundamentals 303
Lab: The Directory Structure

Purpose: To practice using and moving around the directory structure and
also to use a to link to reference a file in another directory.

1. Give the command to show the name of your current directory.

2. Create a subdirectory in your current directory named test_dir.

3. List all the files, directories, and links in your current directory.

4. Go to your group level directory. Show the name of your current directory.

5. Move back to your home directory.

6. Move into the test_dir subdirectory. Create a link named ab to the


abbreviations file in your home directory.

7. List the links in your current directory.

8. Remain in test_dir and display the contents of your abbreviations file using
the link you just created.

9. Change to your home directory. Display the directory status of test_dir.

10. Delete test_dir.

The Directory Structure 3 - 23


VOS Fundamentals 303 Stratus®
Lab: The Directory Structure (continued)

Optional

11. Move to your group directory, VOS_Fundamentals. Use the walk_dir


command to move through the tree structure listing the contents of samples
and all of its subordinate directories.

12. From your home directory, test the arguments that can be used with the list
command.

Directory Structure Diagram

vf1

test_dir abbreviations

ab

3 - 24 The Directory Structure


Stratus® VOS Fundamentals 303

Slide 4-1
303 - VOS Fundamentals
Chapter 4
The
The File
File System
System Overview
Overview

Education
Stratus

File System Overview 4-1


VOS Fundamentals 303 Stratus®

Slide 4-2
Objectives

303 - VOS Fundamentals


•• Use
Use the
the commands
commands for
for file
file manipulation.
manipulation.

Education
Stratus
Objectives

This Chapter teaches you how to use the file system effectively.

At the end of this chapter, the student should be able to:

• Use the commands for file manipulation.

4-2 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-3
File System

303 - VOS Fundamentals


#d101

Sales

John_Smith

test.cm

Education
Stratus
File System

• A file is a named, logical unit of storage containing a sequence of


records.

• A file can contain data, notes, addresses, programs, etc.

• The maximum file size varies depending on the file organization and
whether the file was created with extents.

• Provided you have the disk space, a VOS file that does not use extents
can grow to an approximate maximum of 2.15 GB.

• Maximum record size is 32,767 bytes.

File System Overview 4-3


VOS Fundamentals 303 Stratus®

Suffixes in File Names

• A suffix is a character string that begins with a period as part of the name
of an object in the I/O system.

sales.memo
_edit.t14.6
report.feb.19 (multiple suffixes)

• Certain file name suffixes have special meaning to the system.

- The editor generates a file with the suffix .backup.

sales.backup

- Command macros have a suffix of .cm.

start_up.cm

- The binder produces program modules with a suffix .pm.

budget.pm

- The final suffix on a source file must be that of the compiler.

budget.cobol

4-4 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-4
Star Names

list
lista*

303 - VOS Fundamentals


a*

matches
matches on
on star
starrepresents
represents

abbreviations
abbreviations **== bbreviations
bbreviations
a.cm
a.cm **== .cm
.cm
aa **== null
nullstring
string

Education
Stratus
Star Names

• A star name is a name containing one or more asterisks (*).


An asterisk stands for an unspecified character string.

• A star name matches on any string, including strings containing periods


or a null string.

• Certain commands accept star names as arguments.

- Perform the operation on every object which matches the star name

- Replaces the asterisk with a string

- Matches when the replacement produces an identical object


list *.pm list all .pm files in the current
directory

File System Overview 4-5


VOS Fundamentals 303 Stratus®
File Attributes

The directory containing the files, maintains the attributes of files, including:

• path name

• file organization
sequential
fixed
relative
stream
server queue
message queue
one way server queue

• date and time for


used
modified
saved
created

• protection
transaction file
log protected
safety switch
expiration date

• file size
extent size
next byte or record size:
num indexes
blocks used
allocation size

• access mode

• author

4-6 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-5
display_file_status command
ready: display_file_status personnel_file -form
------------------- display_file_status -------
file_names: personnel_file

303 - VOS Fundamentals


name: %class#d101>VOS_Fundamentals>vf1>personnel_file
file organization: sequential file
last used at: 01-07-09 11:25:53 CDT
last modified at: 01-07-09 11:25:53 CDT
last saved at: never
time created: 01-07-09 11:25:49 CDT
transaction file: no
log protected: no
implicit locking: no
pipe file: no
safety switch: no
audit: no
extent size: 1
next byte: 1902
blocks used: 1
num indexes: 0
allocation size: 1
mode: w
author: vf1.VOS_Fundamentals
tag type: 0
tag version: 0

Education
Stratus
display_file_status command

• display_file_status: Shows the attributes of a file.

File System Overview 4-7


VOS Fundamentals 303 Stratus®

Slide 4-6
create_file

ready:
ready:create_file
create_file new_file
new_file -form

303 - VOS Fundamentals


-form

--------------------
--------------------create_file
create_file--------------------
--------------------
file_name:
file_name: new_file
new_file
-organization:
-organization: sequential
sequential
-record_size:
-record_size:
-num_records:
-num_records:
-extent_size:
-extent_size: 11
-dynamic_extents:
-dynamic_extents: no no
-character_set:
-character_set: none
none
-shift_mode:
-shift_mode: all
all

Education
Stratus
• create_file: Creates an empty file of a specified organization.
file_name: Name of the new file
-organization: (sequential, fixed, relative, stream, etc)
-record_size: Max number of bytes in a record

-num_records: Number of records to pre-allocate


-extent_size: Number of blocks in each extent.
Number is a power of 2 between 8 and 64.
-dynamic_extents: Grow file by extent size vs one block.
-character_set: Assign a character set (foreign language)
-shift_mode: If –character_set is other than none, store
data as compactly as possible at the expense
of execution speed.

4-8 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-7
File Protect Commands

·· ready:
ready:set_expiration_date
set_expiration_date abbreviations
abbreviations 01-12-31
01-12-31 -form
-form

303 - VOS Fundamentals


------------------
------------------set_expiration_date
set_expiration_date------------------
------------------
file_name: abbreviations
file_name: abbreviations
date/time:
date/time: 01-12-31
01-12-31

·· ready:
ready:set_safety_switch
set_safety_switch personnel_list
personnel_list -form
-form

--------------------
--------------------set_safety_switch
set_safety_switch--------------------
--------------------
file_name: personnel_list
file_name: personnel_list
state:
state: on
on

Education
Stratus
• set_expiration_date:

Prevents the deletion of a file before the date / time specified.


Protects the file against premature deletion.

• set_safety_switch:

Protects a file against being deleted, renamed, or truncated.


Requires modify access to the directory to enable/disable.

File System Overview 4-9


VOS Fundamentals 303 Stratus®

Slide 4-8
File Protect Commands

·· ready:
ready:set_transaction_file
set_transaction_file datalog
datalog -form
-form

303 - VOS Fundamentals


--------------------set_transaction_file
--------------------set_transaction_file----------------
----------------
file_name: datalog
file_name: datalog
state:
state: on
on

·· ready:
ready:set_log_protected_file
set_log_protected_file protectalog
protectalog -form
-form

--------------------set_log_protected_file
--------------------set_log_protected_file----------------
----------------
file_name: protectalog
file_name: protectalog
state:
state: on
on

Education
Stratus
• set_transaction_file:

All read and update requests on a transaction file must be


submitted from within a transaction (from within a program).

If the transaction is aborted, VOS can back out the effects of an


uncommitted transaction, thus guaranteeing consistency.

• set_log_protected_file:

Records are written to the log partition before they are written to
the data file.

Ensures files remain logically consistent in the event of a system


interruption.

4 - 10 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-9
File Manipulation Cmds

ready:
ready:copy_file
copy_file personnel_file
personnel_file 2001_personnel
2001_personnel -form

303 - VOS Fundamentals


-form

--------------------
--------------------copy_file
copy_file-----------------------------
-----------------------------
source_file:
source_file: personnel_file
personnel_file
destination:
destination: 2001_personnel
2001_personnel
-pack:
-pack: no
no
-truncate:
-truncate: no
no
-delete:
-delete: no
no
-keep_dates:
-keep_dates: no
no
-keep_acl:
-keep_acl: no
no
-keep_extents:
-keep_extents: yes
yes
-brief:
-brief: no
no
-keep_safety_switch:
-keep_safety_switch: no
no

Education
Stratus
• copy_file: Copies the contents of a file or set of files to another file or
set of files.
.
-pack: Discard deleted records to save space.
-parallel: Used when –pack is yes. Simultaneously
rebuilds all indexes as file is copied.
-truncate: Truncate the existing destination file
before copying a file to it.

-delete: Delete destination file if one exists.


-keep_dates: Keep existing dates.
-keep_acl: Keep existing Access Control List.
-keep_extents: Keep existing extents characteristics.
-brief: Display file names if star name is used.
-keep_safety_switch: Keep safety switch ON if enabled.

File System Overview 4 - 11


VOS Fundamentals 303 Stratus®

Slide 4-10
File Manipulation Cmds

ready:
ready:move_file
move_file personnel_file
personnel_file >reports>rpt
>reports>rpt -form

303 - VOS Fundamentals


-form

--------------------
--------------------move_file
move_file--------------------
--------------------
source_file:
source_file: personnel_file
personnel_file
destination:
destination: >reports>rpt
>reports>rpt
-pack:
-pack: no
no
-truncate:
-truncate: no
no
-delete:
-delete: no
no
-keep_dates:
-keep_dates: no
no
-keep_acl:
-keep_acl: no
no
-brief:
-brief: no
no

Education
Stratus
• move_file: Moves a file, or set of files, to another file or directory.
destination: If blank, defaults to the current directory.
-pack: Discard deleted records.
-truncate: Truncate an existing destination file before
moving an input file to it.
-delete: Delete destination file if one exists.

-keep_dates: Keep existing dates.


-keep_acl: Keep existing Access Control List.
-brief: Display file names if star name is used.

4 - 12 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-11
File Manipulation Cmds

ready:
ready:delete_file
delete_file new_file
new_file -form

303 - VOS Fundamentals


-form

--------------------
--------------------delete_file
delete_file--------------------
--------------------
file_names:
file_names: new_file
new_file
-ask:
-ask: yes
yes
-brief:
-brief: no
no
-force:
-force: no
no

Education
Stratus
• delete_file: Deletes one or more files from a directory.
-ask: If a star name is used, the command asks
whether to delete a file with a matching name.
-brief: Display file names if star name is used.
-force: Mark for deletion a file that is in use.
The command deletes the file after all users
have closed it.

File System Overview 4 - 13


VOS Fundamentals 303 Stratus®

Slide 4-12
File Manipulation Cmds

--------------------
--------------------truncate_file
truncate_file--------------------

303 - VOS Fundamentals


--------------------
file_name:
file_name: personnel_list
personnel_list
-retain:
-retain: no
no
-brief:
-brief: no
no

--------------------
--------------------rename
rename-------------------------
-------------------------
old_name:
old_name: 2001_personnel
2001_personnel
new_name:
new_name: personnel_list
personnel_list
-delete:
-delete: no
no
-files:
-files: yes
yes
-dirs:
-dirs: no
no
-links:
-links: no
no

Education
Stratus
-brief:
-brief: no
no

• truncate_file: Clears the data area of a file, but maintains the file
attributes.
-retain: Retains the allocated disk space

-brief: Display file names if star name is used.

• rename: Changes the name of a file, directory, or link


-delete: Delete the destination object if one exists.
-files: Renames all files whose names match.
Only effective if old_name is a star name.
-dirs: Renames all directories whose names match.
Only effective if old_name is a star name.
Only effective if -all is yes.
-links: Renames all links whose names match.
Only effective if old_name is a star name.
Only effective if -all is yes.
-brief: Display each object name that matches a
star name.

4 - 14 File System Overview


Stratus® VOS Fundamentals 303

File Commands for

Slide 4-13
Listing and Displaying

list
list -full

303 - VOS Fundamentals


-full

Files:
Files:6,
6,Blocks:
Blocks:20
20

ww 11seq
seq 00-12-20
00-12-2009:46:00
09:46:00 _edit.os_telnet1.4.1
_edit.os_telnet1.4.1
ww 22seq
seq 99-04-15 16:22:59 abbreviations
99-04-15 16:22:59 abbreviations
ww 14 seq
14 seq 01-02-01
01-02-0111:17:26
11:17:26 as_meter_file
as_meter_file
ww 11stm
stm 99-04-19 13:57:13 recc_boot.out
99-04-19 13:57:13 recc_boot.out
ww 11stm
stm 99-04-19
99-04-1913:58:41
13:58:41 recc_config.out
recc_config.out
ww 11seq
seq 99-04-15
99-04-1516:22:59
16:22:59 start_up.cm
start_up.cm

Education
Stratus
• The list command will show the files in a directory.

- The -full argument is a short version of display_file_status

- It includes the file organization and last modified date.

File System Overview 4 - 15


VOS Fundamentals 303 Stratus®

File Commands for

Slide 4-14
Listing and Displaying
---------------------------------
---------------------------------display
display--------------------------------

303 - VOS Fundamentals


--------------------------------
file_names:
file_names: abbreviations
abbreviations
-caseless:
-caseless: yes
yes
-index:
-index:
-match:
-match:
-output_path:
-output_path:
-first_line:
-first_line:
-last_line:
-last_line:
-line_numbers:
-line_numbers: no
no
-header:
-header: yes
yes
-raw:
-raw: no
no
-line_length:
-line_length: default
default
-slave_printer:
-slave_printer: no
no
-slave_page_length:
-slave_page_length: 60
60
-min_lines:
-min_lines: 11
-interpret_tabs:
-interpret_tabs:

Education
Stratus
-file_separator:
-file_separator: none
none

• Use display to see the contents of one or more files.

• Useful arguments:
-match: [character_string]
Displays only the lines in the files that
contain the character string.
-first_line: [line_number]
Starts the display at the specified line.
-last_line: [line_number]
Ends the display at the specified line.
-line_numbers: Includes line numbers in the output.

-min_lines: [number_of_lines]
Number of lines to be displayed following each
line containing the character specified in
–match.

4 - 16 File System Overview


Stratus® VOS Fundamentals 303

File Commands for

Slide 4-15
Listing and Displaying

303 - VOS Fundamentals


--------------------------------
--------------------------------tail_file
tail_file-------------------------------
-------------------------------
file_path_name:
file_path_name: >system>syserr_log.01-05-17
>system>syserr_log.01-05-17
-records:
-records: 10
10
-follow:
-follow: no
no
-check_lockers:
-check_lockers: yes
yes

Education
Stratus
• The tail_file command enables you to display the last part of an
ASCII file. By default, the command displays the last 10 lines.

-records: [number of records/lines to be displayed]


-follow: If the file is implicitly locked by another
program, the command will read from the end
of the file until the file is unlocked.
Use this argument to display output added to an
implicitly locked file by a background process as
the process executes.
-no_check_lockers: When used with the –follow argument, causes
the command to display the file even when no
other processes have the file open.
This is particularly useful for displaying
system error log files which may receive error
reports at irregular intervals.

File System Overview 4 - 17


VOS Fundamentals 303 Stratus®

File Commands for

Slide 4-16
Listing and Displaying

303 - VOS Fundamentals


locate_files
locate_files per*
per* -root_dir
-root_dir >VOS_Fundamentals>samples
>VOS_Fundamentals>samples

%dal#d108>VOS_Fundamentals>samples>2_on_system
%dal#d108>VOS_Fundamentals>samples>2_on_system
personnel_file
personnel_file
%dal#d108>VOS_Fundamentals>samples>6_files
%dal#d108>VOS_Fundamentals>samples>6_files
personnel_file
personnel_file
%dal#>VOS_Fundamentals>samples>8_batch
%dal#>VOS_Fundamentals>samples>8_batch
personnel_file
personnel_file

Education
Stratus
• The locate_files command will walk through the directory structure
looking for files which match on the specified name.
-------------------- locate_files ------------------------
file_names: Name or star name of files you want to locate.
-root_dir: The top directory to start the search.
The default is the current directory.

• The command lists the full path name of a directory that contains one
or more files with matching names.

4 - 18 File System Overview


Stratus® VOS Fundamentals 303

File Commands for

Slide 4-17
Listing and Displaying

303 - VOS Fundamentals


compare_files
compare_files start_up.cm
start_up.cm start_up.cm.backup
start_up.cm.backup
(file A)
(file A) (file
(fileB)
B)

AA(%ed31#d102>Education>Bruce_Sadler>start_up.cm)
(%ed31#d102>Education>Bruce_Sadler>start_up.cm)does
doesnot
notmatch
match
BB(%ed31#d102>Education>Bruce_Sadler>start_up.cm.backup).
(%ed31#d102>Education>Bruce_Sadler>start_up.cm.backup).

B38
B38 display_line
display_line
inserted
insertedbefore
before
A39
A39 display_line
display_line' ' Welcome
Welcome'(person_name)
'(person_name)

11data
datadifference(s).
difference(s).

Education
Stratus
• The compare_files command will display the differences of two files.

-------------------------- compare_files -------------------------


file_A: start_up.cm
path_B: start_up.cm.backup
-ascii_records: yes
-ignore_blank_lines: yes
-binary_records: no (Display as hexadecimal integers)
-index_for_A: (Define the order of records file A)
-index_for_B: (Define the order of records file B)
-check_block_count: no (Compares the block count of the files)
-check_times: no (Compares the date/time of the files)
-check_author: no (Compares the authors of the files)
-use_random_access: no (Use random access vs sequential access)
-output_path: (Directs output to a file or device)
-start_record: 1 (Record number to start comparing)
-end_record: (Record number to stop comparing)
-difference_count: (Set the maximum number of differences)
-line_numbers: yes (Display line number where files differ)

File System Overview 4 - 19


VOS Fundamentals 303 Stratus®

Slide 4-18
sort command
------------------------------- sort ---------------------------------
sort_path_names: personnel_file

303 - VOS Fundamentals


-merge_path:
-output_path: %educ#d102>Education>Steve_Wright>personnel_file
-exceptions_path: %educ#d102>Education>Steve_Wright>
personnel_file.sort_exc
-duplicates_path:
-control:
-statistics: no
-position_1: 1
-length_1: 32767
-collation_1: ascending_alphabetical
-position_2:
-length_2:
-collation_2: ascending_alphabetical
-position_3:
-length_3:
-collation_3: ascending_alphabetical
-position_4:
-length_4:
-collation_4: ascending_alphabetical
-sort_in_memory: 1000
-work_dir:

Education
Stratus
sort command

• The sort command is used to sort the records in a text file.

sort personnel_file

• You can specify the positions, the lengths, and the collating sequence of
up to four keys or fields to be used by the sort command, in the
command itself, or up to 32 keys in a sort control file.

• By default, the output of the sort command overwrites the input file.

• Any record shorter than the length key will be written to the exceptions
file.

• The sort command can merge sorted files by specifying the


–merge_path argument followed by the names of the sorted files.

4 - 20 File System Overview


Stratus® VOS Fundamentals 303

Slide 4-19
Sort Control File

The
Thefollowing
followingisisan
anexample
exampleofofaasort
sortcontrol
controlfile.
file.

303 - VOS Fundamentals


field:
field:
name
namechar(32)
char(32)varying,
varying,
age
agedecimal(2),
decimal(2),
height
heightdecimal(2),
decimal(2),
weight
weightdecimal(3),
decimal(3),
modes
modesbit(8),
bit(8),
attributes
attributeschar(64)
char(64)varying;
varying;
key:
key:
age
agedescending,
descending,
name
namespace_suppress,
space_suppress,
attributes
attributesorder(user_collation)
order(user_collation)substr(5,10);
substr(5,10);
user_collation:
user_collation:
'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ';
'aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ';
index:
index:
name
nameno_duplicates
no_duplicatesorder(alphabetical);
order(alphabetical);
organization:
organization:
relative;
relative;

Education
Stratus
end;
end;

In the preceding example, the fields supply the following information:


• field defines the fields in the records of the file to be sorted
• key specifies the fields of the records to be used for sorting
• user_collation specifies the sequence in which the records are to
be collated
• index designates an index or indexes that the operating system
is to create when it makes the output file
• organization specifies the organization of the sorted output file
• end is the last statement in this sort control file

File System Overview 4 - 21


VOS Fundamentals 303 Stratus®
Summary of Commands

VOS Commands & chapter page numbers

compare_files (19)
copy_file (11)
create_file (8)
delete_file (13)
display (16)
display_file_status (7)
list (15)
locate_files (18)
move_file (12)
rename (14)
set_expiration_date (9)
set_log_protected_file (10)
set_safety_switch (9)
set_transaction_file (10)
sort (20)
tail_file (17)
truncate_file (14)

4 - 22 File System Overview


Stratus® VOS Fundamentals 303
Lab: The File System

Purpose: To use the appropriate file command to copy, view attributes, sort,
locate, and protect various files.

1. In your home directory there is file called media.


Copy media to media.copy.

2. List all of the objects in your current directory.

3. Display the status of the file, media. Note the date and time created, the
author, the size.

4. Create a directory called music. Copy the file, media, into the new
directory.

5. Use the locate_files command to search for all files, starting with your home
directory that contain media in their name. You should find 3 files.

6. Practice sorting the file, media, in alphabetical order:

First, sort the full record and produce an output file with the name,
media.sort.

Next, alphabetically sort using the field that begins in column 11.

Use the media file for input and output.

File System Overview 4 - 23


VOS Fundamentals 303 Stratus®
Lab: The File System (continued)

Optional

7. Copy media to new_file with -keep_dates switch on.


Use display_file_status command to compare the dates for both files.

8. Set an expiration time on your media file to be later than the current time.
Observe what happens when you attempt to delete the file.
Remove the expiration date.

9. Use the set_safety_switch command to protect your file, media.


Execute the commands to delete the file, rename the file, copy the file to
a new file, and display the contents of the file. Observe the affects of
these commands on the protected file.
Now remove the safety switch from the file.

4 - 24 File System Overview


Stratus® VOS Fundamentals 303

Slide 5-1
303 - VOS Fundamentals
Chapter 5
Access
Access Control
Control

Education
Stratus

Access Control 5-1


VOS Fundamentals 303 Stratus®

Slide 5-2
Objectives

303 - VOS Fundamentals


•• Use
Use the
the access
access control
control commands
commands to
to control
control
access
access to
to user
user directories.
directories.

•• Use
Use the
the access
access control
control commands
commands to
to control
control
access
access to
to user
user files
files

Education
Stratus
Objectives

An important factor in maintaining security on the system is the access control


mechanism in the directory structure. In this section, the student will learn what
kinds of access rights exist and how to implement them on their file system
objects.

At the end of this chapter, the student should be able to:

• Use the access control commands to control access to user directories.

• Use the access control commands to control access to user files.

5-2 Access Control


Stratus® VOS Fundamentals 303

Slide 5-3
Access Control

303 - VOS Fundamentals


#d101 (ACL)

Sales (ACL)

John_Smith (ACL)

test.cm (ACL)

Education
Stratus
Access Control Mechanism

• Access control is the mechanism by which the operation system


determines a user’s access rights to directories and files.

• Each file and directory has an Access Control List (ACL).

• An Access Control List allows you to define who can use your files and
directories. You also get to decide the extent of this access.
(For example, can someone change the contents of your files or can
she/he just execute them?)

• Setting access control is optional


- Access control can be completely defaulted
- When a directory or a file is created, default access control is
established.

Access Control 5-3


VOS Fundamentals 303 Stratus®

Slide 5-4
Access Control Entry

303 - VOS Fundamentals


access type user_name

m John_Smith.Sales
s *.Sales
n *.*

Education
Stratus
Access Control Entry

• An entry in an Access Control List (ACL) has two components:

- The type of access


- A user name

access type - user name

Note: Access types for directories are different from


access types for files.

5-4 Access Control


Stratus® VOS Fundamentals 303

Slide 5-5
User Name

303 - VOS Fundamentals


John_Smith . Sales

Person Name Group Name


Delimiter (period)

Education
Stratus
When you log into a Stratus, the operating system assigns a user name to your
process. You can see your user name with the command function (user_name).
For example:

ready: display_line (user_name)

John_Smith.Sales

• There are two components to a user name.

- A Person Name
- A Group Name

A delimiter, a period, is used by the operating system to show where the


person name ends and the group name begins.

Access Control 5-5


VOS Fundamentals 303 Stratus®

Slide 5-6
Order of ACL Entries

•• Entries
Entries in
in an
an ACL
ACL are
are ordered
ordered in
in aa list
list from

303 - VOS Fundamentals


from
specific
specific user
user name
name to
to general
general user
user name.
name.
–– vf1.VOS_Fundamentals
vf1.VOS_Fundamentals
–– vf1.*
vf1.*
–– *.VOS_
*.VOS_Fundamentals
Fundamentals
–– *.*
*.*

Education
Stratus
Access Control Lists (continued)

• The way Access Control Lists represent user names can take four forms:

1. person_name.group_name represents an individual process with a


specific name and a specific group. Example: John_Smith.Sales

2. person_name.* represents the set of all processes with a specific person


name, regardless of group name. Example: John_Smith.*

3. *.group_name represents the set of all processes in a specific group,


regardless of person names. Example: *.Sales

4. *.* represents the set of all processes, regardless of person names or


group names.

• The operating system searches an Access Control List from the top down
and uses the access right associated with the first match.

5-6 Access Control


Stratus® VOS Fundamentals 303

Slide 5-8
Directory Access Control

303 - VOS Fundamentals


DIR_B ACL
DIR_A
DIR_C ACL
Directory Entries

DIR_B DIR_C

Education
Stratus
Directory Access Control

• The Access Control List (ACL) that protects a directory is stored in the
directory's parent directory.

• When you create a new directory, the initial contents of its Access
Control List are the same as its parent directory.

• The copy_dir command brings the ACL of the source directory to the
destination directory.

Access Control 5-7


VOS Fundamentals 303 Stratus®

Slide 5-8
Directory Access Types

Directory Access Types

303 - VOS Fundamentals


Modify access gives users full access to the contents of
m the directory. Users can create and delete objects. In
(modify) addition users can change access to files and
subdirectories.

s Status access allows users to list the contents of the


(status) directory and to see other information, but not to
change the contents of the directory.

n Null access denies users all access to the directory.


(null)

u This is equivalent to null access. This is the access


(unspecified) users get when not on the ACL.

Education
Stratus
Directory Access Types

• Each directory has its own Access Control List (ACL).

• The types of access rights in a directory are:

- Modify (includes Status)

- Status

- Null

- Unspecified

• To define an entry in the Access Control List of a directory, you must


have modify access to its parent directory.

5-8 Access Control


Stratus® VOS Fundamentals 303

Slide 5-9
Directory ACL Commands
ready:
ready: display_access_list
display_access_list -form
-form
-----------------
----------------- display_access_list
display_access_list -------------

303 - VOS Fundamentals


-------------
path_names:
path_names: <required>
<required>

ready:
ready: give_access
give_access status
status my_dir
my_dir -user
-user vf2.*
vf2.* -form
-form
------------------- give_access --------------------
------------------- give_access --------------------
access:
access: status
status
path_names:
path_names: my_dir
my_dir
-user:
-user: vf2.*
vf2.*

ready:
ready: remove_access
remove_access my_dir
my_dir -user
-user vf2.*
vf2.* -form
-form
--------------------
-------------------- remove_access
remove_access -----------------
-----------------
path_names:
path_names: my_dir
my_dir

Education
Stratus
-user:
-user: vf2.*
vf2.*
-all:
-all: no
no

Directory Access Control Commands

• To examine an Access Control List, use display_access_list (dal)

Note: To specify the current directory, enter a period (.) for the path.

• To place an entry in an Access Control List for a directory, use the


give_access (ga) command.

- To give access to an object, you need modify access to the parent


of the object.

- If the object is a directory, you must specify an access type of


modify, status, or null.

• To remove an entry from an Access Control List, use the


remove_access (ra) command.

Access Control 5-9


VOS Fundamentals 303 Stratus®

Go to next page.

5 - 10 Access Control
Stratus® VOS Fundamentals 303

Slide 5-11
File Access Control

303 - VOS Fundamentals


DACL
DIR_A
Moe_File ACL
Larry_File ACL
Moe_File
Curley_File ACL
Larry_File
Directory Entries
Curley_File

Education
Stratus
File Access Control

• The Access Control List that protects a file is stored in its parent
directory.

• When you create a file, its specific Access Control List (ACL) is empty.
Use the give_access command to add entries.

• To define an entry in a file-specific Access Control List (ACL), you must


have modify access to the file's parent directory.

• If there is an Access Control List (ACL) for a file, it does not get carried
to the new file by copy_file.

Access Control 5 - 11
VOS Fundamentals 303 Stratus®

Slide 5-11
File Access Types
FILE ACCESS TYPES

303 - VOS Fundamentals


w Write access allows the user to change the contents of
(write) the file.

r Read access allows users to read the file or to execute


(read) it, if it is executable, but not change it.

e Execute access allows users to execute a program


(execute) module or command macro, but not read or change it.

n
(null) Null access denies users all access to the file.

Education
u

Stratus
(unspecified) Equivalent to null access.

File Access Types

• Each file has its own Access Control List (ACL).

• Access types for files are different from access types for directories.

• The types of access rights in a file are:

- Write (includes Read and Execute)

- Read (includes Execute)

- Execute

- Null

- Unspecified

5 - 12 Access Control
Stratus® VOS Fundamentals 303

Slide 5-12
File ACL Commands
ready:
ready: display_access_list
display_access_list -form
-form
-----------------
----------------- display_access_list
display_access_list -------------

303 - VOS Fundamentals


-------------
path_names:
path_names: <required>
<required>

ready:
ready: give_access
give_access write
write demo_file
demo_file -user
-user vf2.*
vf2.* -form
-form
------------------- give_access --------------------
------------------- give_access --------------------
access:
access: write
write
path_names:
path_names: demo_file
demo_file
-user:
-user: vf2.*
vf2.*

ready:
ready: remove_access
remove_access demo_file
demo_file -user
-user vf2.*
vf2.* -form
-form
--------------------
-------------------- remove_access
remove_access -----------------
-----------------
path_names:
path_names: my_dir
my_dir

Education
Stratus
-user:
-user: vf2.*
vf2.*
-all:
-all: no
no

File Access Control Commands

• To examine an Access Control List, use display_access_list (dal)

• To place an entry in an Access Control List for a file, use the


give_access (ga) command.

- To give access to an object, you need modify access to the parent


of the object.

- If the object is a file, you must specify an access type of


write, read, execute, or null.

• To remove an entry from an Access Control List, use the


remove_access (ra) command.

Access Control 5 - 13
VOS Fundamentals 303 Stratus®

Slide 5-13
Default Access Control

303 - VOS Fundamentals


DACL
DIR_A
Moe_File ACL
Larry_File ACL
Moe_File
Curley_File ACL
Larry_File
Directory Entries
Curley_File

Education
Stratus
Default Access Control List

• Files can be controlled by a specific Access Control List (ACL) and/or a


Default Access Control List (DACL).

• A Default Access Control List (DACL) is used to establish default


access for all the files in a directory.

• Default Access Control List (DACL) goes with a directory, but controls
all the files in the directory (not the directory itself).

• The access types in a Default Access Control List (DACL) are file
types: write, read, execute, null.

• The Default Access Control List (DACL) is searched when no match


can be made on the Access Control List (ACL) for the file.

5 - 14 Access Control
Stratus® VOS Fundamentals 303
Default Access Control List

• The Default Access Control List (DACL) is carried from parent to new
subordinate directory by create_dir.

• The Default Access Control List (DACL) is copied from the source
directory to the new directory by copy_dir.

Access Control 5 - 15
VOS Fundamentals 303 Stratus®

Slide 5-14
Default Access Commands
ready:
ready: display_default_access_list
display_default_access_list -form
-form
------------------
------------------ display_default_access_list --------
display_default_access_list

303 - VOS Fundamentals


--------
directory_names:%class#d101>VOS_Fundamentals>vf1
directory_names:%class#d101>VOS_Fundamentals>vf1

ready:
ready: give_default_access
give_default_access -form
-form
-----------------
----------------- give_default_access
give_default_access ---------
---------
access:
access: read
read
directory_names:
directory_names: my_dir
my_dir
-user:
-user: *.VOS_Fundamentals
*.VOS_Fundamentals

ready:
ready: remove_default_access
remove_default_access -form
-form
---------------
--------------- remove_default_access ---------------
remove_default_access ---------------
directory_names:
directory_names: my_dir
my_dir

Education
Stratus
-user:
-user: vf2.VOS_Fundamentals
vf2.VOS_Fundamentals
-all:
-all: no
no

Default Access Commands

• The display_default_access_list (ddal) is used to see the default


access for the files in a directory.

• The give_default_access (gda) command places an entry into the


Default Access Control List for a specified directory.

- You need modify access to the specified directory to change entries


in the Default Access Control List (DACL).

- The access types in a Default Access Control List (DACL) are


file types: write, read, execute, null).

• The remove_default_access (rda) command removes an entry from


the Default Access Control List for a specified user in a directory.

5 - 16 Access Control
Stratus® VOS Fundamentals 303

Checking Permissions on Access

Slide 5-15
Lists
•• The
The list -all displays
list -all displays each
each file
file and
and directory
directory in
in the
the
current
current directory
directory and
and your
your access
access to
to each
each of
of them.
them.

303 - VOS Fundamentals


list
list -all
-all

Files:
Files: 1,
1, Blocks:
Blocks: 00
ww 00 demo_file
demo_file

Directories:
Directories: 22
mm 11 my_dir
my_dir
mm 11 test_dir
test_dir

Education
Stratus
Checking Permissions on Access Lists

• The quickest method to find your access to files and directories is to use
the list -all command.

Access Control 5 - 17
VOS Fundamentals 303 Stratus®

Checking Permissions on Access

Slide 5-10
Lists (cont)
•• The
The command display_access will
command display_access will

303 - VOS Fundamentals


–– Display
Display the
the ACL
ACL of
of aa directory
directory

–– Display
Display the
the ACL
ACL and
and DACL
DACL of
of aa file
file

–– Report
Report the
the access
access of
of aa specific
specific user
user to
to aa file
file

–– Report
Report the
the access
access of
of aa specific
specific user
user to
to aa directory
directory

Checking Permissions on Access Lists (continued)

• The command display_access will display the ACL for a directory,


display the (ACL) and (DACL) for a specific file or compare someone
against the access control list and report what the person's access is.
ready: display_access -form
---------------- display_access -----------------
path_names: <required>
-user: vf1.VOS_Fundamentals
-all: no

5 - 18 Access Control
Stratus® VOS Fundamentals 303
Checking Permissions on Access Lists

• Display the ACL of a directory


ready: display_access >VOS_Fundamentals>vf1>my_dir -all
%class#d101>VOS_Fundamentals>vf1>my_dir
s vf2.VOS_Fundamentals
m vf1.*
m *.SysAdmin
m *.System
s *.VOS_Fundamentals
n *.*

• Display the ACL and DACL of a file


ready: display_access mail_list -all
%class#d101>VOS_Fundamentals>vf1>mail_list
n vf2.VOS_Fundamentals
w vf1.* (D)
r *.VOS_Fundamentals (D)
w *.SysAdmin (D)
w *.System (D)
n *.* (D)

• Report the access of a specific user to a file


ready: display_access mail_list -user vf2.VOS_Fundamentals
null %class#d101>VOS_Fundamentals>vf1>mail_list

• Report the access of a specific user to a directory


ready: display_access >VOS_Fundamentals>vf1>my_dir
-user vf2.VOS_Fundamentals
status %class#d101>VOS_Fundamentals>vf1>my_dir

Access Control 5 - 19
VOS Fundamentals 303 Stratus®
Summary of Commands

VOS Commands, their standard abbreviations & chapter page numbers

display_access, da (18)
display_access_list, dal (9,13)
display_default_access_list, ddal (16)

give_access, ga (9,13)
give_default_access, gda (16)

remove_access, ra (9,13)
remove_default_access, rda (16)

5 - 20 Access Control
Stratus® VOS Fundamentals 303
Lab: Access Control

Purpose: To practice using various access control command to verify access rights
and to change them where possible and as directed.

1. Display your access to all the objects in your home directory.

2. Display the ACL to your home directory. What are the 2 commands to do
this?
_________________________________________________________

3. Display the Default Access Control List for your home directory.

4. Display the ACL to your abbreviations file.

5. Display the ACL to your abbreviations file for all users? How is this
different from the previous questions?

6. Give read access to the abbreviations file for Mary_Smith.Sales. Verify the
access.

7. Create a subdirectory called test_dir under your home directory. Display the
access list and default access list for test_dir. What happened?

8. Copy your abbreviations file to test_dir. Display the ACL to the


abbreviations file in test_dir. What happened?

_____________________________________________________________

Access Control 5 - 21
VOS Fundamentals 303 Stratus®
Lab: Access Control (continued)

9. Give status access to test_dir for a user John_Smith.Operations. Verify


your access.

10. Give default execute access for all files in test_dir to any person in the
Operations group.

11. Make an ACL entry to the abbreviations file in test_dir. The code is read
and the person named is John_Dunn in any group.

12. Copy the directory test_dir to test_dir2

13. Verify the ACL & DACL for test_dir2 and the ACL for abbreviations
inside test_dir2. What happened?

5 - 22 Access Control
Stratus® VOS Fundamentals 303
Lab: Access Control (continued)

Optional

14. Set access on the directory, test_dir, so that you have status access.

Move to test_dir and perform the following actions:

List the contents of the directory.

Display the contents of the abbreviations file.

Attempt to create a new directory called, another_dir.


What happened?

Edit the abbreviations file in test_dir to add the line:


subsequent u by -user.

What happens when you attempt to write the file (menu w)?

Return to the command line (menu q). Now edit the abbreviations file
using the argument -no_backup. Can you write the file out?
What is the difference?

15. Move back to your home directory. Give yourself modify access to the
directory, test_dir.

16. Give yourself default read access to the files in test_dir. Check your
access rights. Display the abbreviations file in test_dir.

Access Control 5 - 23
VOS Fundamentals 303 Stratus®
Lab: Access Control (continued)

17. Move to test_dir and perform the following actions:

Create a new directory called, another_dir.

Attempt to copy the abbreviations file to another_dir naming it


copy_of_abbrevs.
What happened?

Attempt to add another abbreviation to the abbreviations file:


first me by list_users Joe.*.

What happened?

Quit out of the editor.

Try to delete the file abbreviations located in test_dir.


What happened?

Move to another_dir.

Attempt to edit a new file, abc.


What happened?

5 - 24 Access Control
Stratus® VOS Fundamentals 303

Lab: Access Control (continued)

vf1

test_dir
abbreviations

another_dir
abbreviations

Access Control 5 - 25
Stratus® VOS Fundamentals 303

Slide 6-1
303 - VOS Fundamentals
Chapter 6
Introduction
Introduction to
to Editing
Editing using
using edit
edit

Education
Stratus

Introduction to Editing using edit 6-1


VOS Fundamentals 303 Stratus®

Slide 6-2
Objectives

•• Describe
Describe thethe terminal
terminal keyboard
keyboard keys.
keys.

303 - VOS Fundamentals


•• Input
Input text
text into
into an
an edit
edit buffer.
buffer.
•• Refer
Refer to
to the
the function
function keykey template
template to
to execute
execute
editor
editor requests.
requests.
•• Save
Save edited
edited text
text and
and end
end the
the edit
edit session.
session.

Education
Stratus
Introduction to Editing using edit

The edit command is a VOS command that calls the Full Screen Editor and
enables you to begin editing a file.

At the end of this chapter, the student should be able to:

• Describe the terminal keyboard keys.


• Input text into an edit buffer.
• Refer to the function key template to execute editor requests.
• Save edited text and end the edit session.

6-2 Introduction to Editing using edit


Stratus® VOS Fundamentals 303

Slide 6-3
Terminal Keyboard

•• Overview
Overview of
of Key
Key Types
Types

303 - VOS Fundamentals


•• A
A keyboard
keyboard consists
consists of:
of:
–– Standard
Standard typewriter
typewriter keys.
keys.
–– Cursor
Cursor positioning
positioning keys.
keys.
–– Function
Function keys
keys (activities
(activities named
named on
on the
the template)
template) which
which
drive many of the editing requests.
drive many of the editing requests.
–– Special
Special keys
keys which
which are
are the
the keys
keys with
with lettering
lettering or
or
symbols
symbols on
on them.
them. (e.g.,
(e.g., [DEL],
[DEL], [___])
[___])

Education
Stratus
The Terminal Keyboard

Introduction to Editing using edit 6-3


VOS Fundamentals 303 Stratus®
Starting an Edit Session

• The edit Command

- To call up the Full Screen Editor, enter the edit command.


ready: edit

- The Full Screen Editor allows you to enter and modify text while
viewing the total screen area.

• Default Edit Buffer

- When you execute the edit command, VOS positions the cursor
in a temporary area known as the default buffer.

- The default buffer is empty when you do not specify a file name on
the command line.

6-4 Introduction to Editing using edit


Stratus® VOS Fundamentals 303

Slide 6-4
Default Edit Buffer

Working

303 - VOS Fundamentals


Information is written here. What you see is this
Buffer

Lines 1-20

System
%class#d101>VOS_Fundamentals>vf1>abbreviations
Area
Status
Line

Education
Stratus
Default Edit Buffer

• The default buffer contains the contents of a file when you follow the
edit command with the name of a specific file on the command line.

ready: edit abbreviations

• The working area will only show 20 lines of a file at a time.

• Line 22 will show the buffer name preceding a colon followed by the full
pathname for a file if a file was loaded into the buffer.

Note: The default buffer name will not show on the screen.

• Lines 23 and 24 are used for prompting.

• Lines 25 is the system status line.

Introduction to Editing using edit 6-5


VOS Fundamentals 303 Stratus®

Slide 6-5
Menu Requests

303 - VOS Fundamentals


Education
Stratus
Editor Requests

Methods of Executing Edit Requests

• Requests in edit are executed from menu selections and/or function


keys.

• The [MENU] function key will display a menu of additional edit


functions.

• There are some special keys that will require you to hold a key down
while pressing another key. This will be represented by showing a
hyphen between the two keys.

For Example: [CTRL] - [BREAK]

6-6 Introduction to Editing using edit


Stratus® VOS Fundamentals 303

Slide 6-6
Terminating editor Requests

303 - VOS Fundamentals


•• Before
Before execution
execution
–– Use
Use [CANCEL]
[CANCEL]

•• After
After execution
execution
–– Use
Use [CTRL
[CTRL -- BREAK]
BREAK]

Education
Stratus
Terminating Editor Requests

• Before execution

- For example, you pressed [MENU] but have not selected an


option, OR when a request prompts you to take some action.

• After execution

- For example, you issued a [MENU] request, which has begun


performing its function.

Introduction to Editing using edit 6-7


VOS Fundamentals 303 Stratus®

Slide 6-7
HELP MENU

303 - VOS Fundamentals


Education
Stratus
Help

Press the [HELP] function key to display the [HELP] Menu. The Editor's Help
Menu provides definitions for the keys used in executing editor requests.

• Press the desired key(s) to get detailed information about the request.

6-8 Introduction to Editing using edit


Stratus® VOS Fundamentals 303

Slide 6-8
Text Input

303 - VOS Fundamentals


•• Limit
Limit of
of 300
300 characters
characters per
per line.
line.

•• An
An invisible,
invisible, line-separating
line-separating character
character defines
defines
each
each line
line of
of text
text in
in the
the edit
edit buffer.
buffer.

Education
Stratus
Text Input

A Line of Text

• There is a limit of 300 characters per line.

• An invisible, line-separating character defines the end of each line of text


in the edit buffer.

- Press the [RETURN] key when you want to end a line of text or to
create a new line.

- There are two ways to remove the line separating character and
collapse two lines into one. If the cursor is at the end of the line,
press [DEL]. If the cursor is at the beginning of the following line,
press [BACKSPACE].

Introduction to Editing using edit 6-9


VOS Fundamentals 303 Stratus®

Slide 6-9
Simple Modifications to Text
•• Insert
Insert text
text at
at the
the cursor
cursor position.
position.

303 - VOS Fundamentals


•• You
You can
can delete
delete each
each character
character (including
(including line-
line-
separating
separating characters)
characters) with
with either:
either:
[BACKSPACE]
[BACKSPACE] or or [DEL]
[DEL]

•• Position
Position the
the cursor
cursor on
on aa line
line by
by pressing
pressing the
the arrow
arrow
keys.
keys. ARROW KEYS

Education
Stratus
Simple Modifications to Text

6 - 10 Introduction to Editing using edit


Stratus® VOS Fundamentals 303

Saving a File

Writing a File with a Name

You issue the write request to save the contents of your text buffer.

• The Editor writes the contents of the text buffer to permanent storage in a
file when you follow these steps:

1. Write request
[MENU] [W]

2. Prompts for path name


Output path name: letter

3. The editor displays the complete path name if one didn't exist.
%class#d01>VOS_Fundamentals>vf1>letter

• If there is a path name already associated with the edit session, you
don't have to re-enter the name when you write it (save it to disk). The
path name becomes the default name, making it unnecessary to re-enter
the name.

1. Write request
[MENU] [W]

2. Prompts for path name


Output path name: [RETURN]

Introduction to Editing using edit 6 - 11


VOS Fundamentals 303 Stratus®

Slide 6-10
Ending an edit Session

•• Following
Following the the write
write request,
request, the
the cursor
cursor returns
returns to to

303 - VOS Fundamentals


its
its position
position in in the
the edit
edit buffer.
buffer.
•• You
You cancan either
either continue
continue the
the edit
edit session
session or
or you
you
can
can exit.
exit.
•• To
To exit
exit the
the edit
edit session,
session, [MENU]
[MENU] [Q] [Q]
•• The
The Editor
Editor displays
displays aa message
message when
when you
you try
try to
to
quit
quit without
without writing
writing thethe most
most recent
recent changes.
changes.

Education
Stratus
Ending an Edit Session

Quitting the Editor

• To exit the edit session.

[MENU] [Q]======> Quit request

- The operating system returns the cursor to the command level.

ready 12:52:15

• The Editor displays a message when you try to quit without writing the
most recent changes:

A buffer has been modified and not written.


Quit anyway?

6 - 12 Introduction to Editing using edit


Stratus® VOS Fundamentals 303

Slide 6-11
Results from an edit session

303 - VOS Fundamentals


•• Keystrokes
Keystrokes file.
file.
ready:
ready: list
list
Files:
Files: 2,
2, Blocks:
Blocks: 22
ww 11 _edit.t13.7
_edit.t13.7
ww 11 letter
letter

•• Backup
Backup file.
file.
ready:
ready: list
list
Files:
Files: 3,
3, Blocks:
Blocks: 33
ww 11 _edit.t13.7
_edit.t13.7
ww 11 letter
letter
ww 11 letter.backup
letter.backup

Education
Stratus
Results from the Editor

The Editor generates several files.

• It creates and writes your text file to a disk.

• The system records all of the keystrokes for this edit session in a
specific keystrokes file named: edit.<terminal_name> .
This file can be used to recover the edit session in case the file is not
closed properly. (Procedure covered in Chapter 8.)

• It generates a backup file if you have modified an existing file.

Note: The operating system only stores one backup per file.
Also, it only creates a backup file if the file-name is
25 characters or less.

Introduction to Editing using edit 6 - 13


VOS Fundamentals 303 Stratus®
Summary of Editing Request and VOS

EDITOR REQUESTS

ACTIVITY REQUEST
Enter a new line [RETURN]

Position the cursor ARROW KEY

Set bell column [MENU]-Z

Change text [BACK-SPACE]


[DEL]

Cancel a request [CANCEL]


[CTRL]-[BREAK]

Get help [HELP]

Save a file [MENU]-W

Leave the editor [MENU]-Q

Typical QUIT sequence [MENU]-W


[RETURN]
[MENU]-Q

VOS COMMANDS

ACTIVITY COMMAND
ARGUMENTS
Call the editor edit (3) file name

6 - 14 Introduction to Editing using edit


Stratus® VOS Fundamentals 303
Lab: Introduction to Editing using edit

Purpose: To use edit requests to create, save, and modify files, and
also to view the results in your home directory.

1. Log into the system.

2. Create an edit buffer by invoking just the editor.

a. Is there a pathname below the solid line on your screen?

________________________________________

b. Type a couple of short paragraphs explaining your major job


responsibilities.

c. Move around with the arrow keys and use the [RETURN] key to
add a blank line between paragraphs.

d. Use the on-line help facility to get some help on the following two
edit functions: [DEL] and [MENU] W.

Note: This will return you to your document after each execution.

e. Save the document with the name job1 and quit the edit session.

f. List the files. Is job1 there? ____________________

g. You should also have a keystrokes file. What is its name?

____________________________________________

Introduction to Editing using edit 6 - 15


VOS Fundamentals 303 Stratus®
Lab: Introduction to Editing using edit (continued)

3. This time, create a file by invoking the editor with the name of a file that
does not exist, such as job2.

a. Does the pathname to this default file show on your screen below
the solid line? ______________________

b. Type in a couple of paragraphs that explain what you like to do


when you are not working. Again, use [RETURN], [DEL] and
[BACKSPACE] to format your document as you create it.

c. When you finish, attempt to quit your edit session without


writing (saving) the file. What does the message say?

__________________________________________

d. Return to your edit session.

e. Write (save) this file to disk keeping the default file name.
Then quit the editor.

f. List the files in your directory to be sure that job2 is there.


Is it there? ________________________________

g. Display the contents of your keystrokes file.


Does it contain the keystrokes of the job1 or job2 file?

______________________________

6 - 16 Introduction to Editing using edit


Stratus® VOS Fundamentals 303
Lab: Introduction to Editing using edit (continued)

4. Modify the file job1 that you created a moment ago by invoking the
editor with the name of this existing file.

a. Move the cursor to the beginning of the second paragraph and


insert a new paragraph that explains what you would do if you won
the lottery.

b. Be sure that each paragraph is separated by a blank line.

c. Save this file with the default name (job1) and quit the edit
session.

d. Now, list the files. Is there anything different? ____________

e. Display the contents of both job1 and job1.backup.


What has happened?

____________________________________________________

Introduction to Editing using edit 6 - 17


Stratus® VOS Fundamentals 303

Slide 7-1
303 - VOS Fundamentals
Chapter 7
Editing
Editing Text
Text using
using edit
edit

Education
Stratus

Editing Text using edit 7-1


VOS Fundamentals 303 Stratus®

Slide 7-2
Objectives

303 - VOS Fundamentals


•• Move
Move thethe cursor
cursor quickly
quickly and
and easily
easily throughout
throughout the
the
editor.
editor.
•• Perform
Perform efficient
efficient methods
methods of
of modifying
modifying text.
text.
•• Tabulate
Tabulate text.
text.

Education
Stratus
Objectives

When you're using the editor, file manipulation is easy. With it, you can quickly
insert, modify, or just view text. You can also move easily through a buffer by
combining the arrow keys with other keys, or you can use it to set up columns,
then manipulate that data.

At the end of this chapter, the student should be able to:

• Move the cursor quickly and easily throughout the editor.


• Perform efficient methods of modifying text.
• Tabulate text.

7-2 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-3
Moving the Cursor

•• You
You can
can move
move the
the cursor
cursor by
by groups
groups of
of characters.
characters.

303 - VOS Fundamentals


•• A
A word
word is
is aa group
group of
of alphanumeric
alphanumeric characters,
characters,
ending
ending with
with aa space.
space.

•• AA line
line is
is aa group
group of
of characters
characters which
which ends
ends with
with aa
line-separating
line-separating character.
character.

•• A
A screen
screen is
is the
the display
display area
area for
for text.
text.

Education
Stratus
Moving the Cursor

• Word

[SHIFT] [right arrow/left arrow]


[WORD] [right arrow/left arrow]

• Line

Beginning/End of line: [GOTO] [right arrow/left arrow]

• Screen

Top/Bottom of screen: [GOTO] [up arrow/down arrow]


Next/Previous screen: [SHIFT] [up arrow/down arrow]
Beginning/End of file: [GOTO] [LINE] [up arrow/down arrow]

Note: For Stratus V103 terminals, the [HOME] key serves as the [GOTO]

Editing Text using edit 7-3


VOS Fundamentals 303 Stratus®

Slide 7-4
ARROW KEYS

LEFT R IG H T

303 - VOS Fundamentals


UP DOW N

B E G IN N IN G END
O F L IN E G O TO O F L IN E G O TO

BOTTOM OF TOP OF
SCREEN G O TO SCREEN G O TO

P R E V IO U S NEXT
SCREEN S H IF T SCREEN S H IF T

B O T T O M O F F IL E T O P O F F IL E

G O TO LIN E G O TO LIN E

Education
Stratus
ARROW KEYS

Position the cursor on a line by pressing the arrow keys.

• Scrolling a half-screen

- If you press the up-arrow key when the cursor is on the first line of
the screen, the text will scroll down ten lines.

- If you press the down-arrow key when the cursor is on the last line
of the screen, the text will scroll up ten lines.

7-4 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-5
Line Numbers

303 - VOS Fundamentals


•• To
To display
display the
the file
file with
with Line
Line Numbers:
Numbers:
–– [MENU]
[MENU] [N]
[N] (Toggles
(Toggles ON/OFF)
ON/OFF)

•• To
To move
move directly
directly to
to aa Line:
Line:
–– [GOTO]
[GOTO] [[ LINE]
LINE] Line
Line number:
number:

•• To
To move
move directly
directly to
to aa Column:
Column:
–– [GOTO]
[GOTO] [COLUMN]
[COLUMN] Column
Column number:
number:

Education
Stratus
Line Numbers

• To display the file with line numbers, use [MENU] [N] to toggle
line numbers ON/OFF.

Note: Line numbers only show up on the screen display. If you want
your file to print with line numbers, use the -line_numbers
argument of the print command.

print filename -line_numbers.

• You can move the cursor directly to a specific line in the text.

[GOTO] [LINE] Line number:

• You can move the cursor directly to a specific column in the text.

[GOTO] [COLUMN] Column number:

Editing Text using edit 7-5


VOS Fundamentals 303 Stratus®

Slide 7-6
Scrolling Text

303 - VOS Fundamentals


•• Line
Line at
at aa time:
time:
[SCROLL]
[SCROLL] [up
[up arrow/down
arrow/down arrow]
arrow]

•• Several
Several lines:
lines:
[REPEAT]
[REPEAT]
Number
Number of
of times:<Enter
times:<Enter number>[RETURN]
number>[RETURN]
[SCROLL]
[SCROLL] [up
[up arrow/down
arrow/down arrow]
arrow]

Education
Stratus
Scrolling Text Up or Down

You can move characters and lines that are outside of the display area into view.

• Scrolling moves the entire screen of text, a character or a line at a time.

- The cursor moves with the text.

• Scrolling the text up or down allows you to see the text that is just above
or just below the display area.

7-6 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-7
Scrolling Text (cont)

303 - VOS Fundamentals


•• To
To see
see text
text that
that exceeds
exceeds the
the screen
screen width:
width:
–– One
One character
character at
at aa time:
time:
[SCROLL]
[SCROLL] [right
[right arrow/left
arrow/left arrow]
arrow]

–– Several
Several characters:
characters:
[REPEAT]
[REPEAT]
Number
Number of
of times:<Enter
times:<Enter number>
number> [RETURN]
[RETURN]
[SCROLL] [right arrow/left arrow]
[SCROLL] [right arrow/left arrow]

Education
Stratus
Scrolling Text Left or Right

• You can move the text that is outside the screen area, to the left or the
right, into view.

Note: When the cursor is outside the width of the screen, a message line
displays the number of characters off the screen.

The cursor is 2 characters offscreen right.

Editing Text using edit 7-7


VOS Fundamentals 303 Stratus®

Slide 7-8
Search for Text

•• Search
Search for
for the
the exact
exact match
match of
of aa string.
string.

303 - VOS Fundamentals


(upper
(upper and
and lower
lower case
case are
are unique).
unique).
[SEARCH]
[SEARCH]
[down
[down arrow/up
arrow/up arrow]
arrow]
Forward
Forward search:
search: or
or Reverse
Reverse search:
search: (Enter
(Enter search
search string)
string)
•• Search
Search that
that is
is independent
independent of
of case.
case.
[CASELESS]
[CASELESS]
[down
[down arrow/up
arrow/up arrow]
arrow]
Forward
Forward search:
search: or
or Reverse
Reverse search:
search: (Enter
(Enter search
search string)
string)

Education
Stratus
Search for Text

Search for a String

A search string is the sequence of characters (including spaces) that you are trying
to locate.

• A search string must all be on the same line.

• The search begins at the current cursor position and searches to the top
of the file or to the bottom of the file. The search stops at the first
occurrence of the string.

• To repeat the last search, use [REPEAT LAST]

7-8 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-9
Global Search and Replace

303 - VOS Fundamentals


•• Global
Global Replace
Replace
[MENU]
[MENU] [G]
[G] =======>
=======> Global
Global replace
replace
Original string:
Original string:
New
New string:
string:

•• case-by-case
case-by-case replacement
replacement
[MENU]
[MENU] [G]
[G]
[QUERY]
[QUERY]You will
You will be
be queried
queried for
for each
each occurrence.
occurrence.
Original
Original string:
string:
New
New string:
string:

Education
Stratus
Global Search and Replace

You can replace every occurrence of one string in the text with another string.

• You can replace every occurrence of a string from the current cursor
position to the end of the buffer.

• You can decide case-by-case whether to do a replacement.

Replace this occurrence? y or n

• To terminate a global query, press the [CANCEL] twice.

Editing Text using edit 7-9


VOS Fundamentals 303 Stratus®

Slide 7-10
Marking Text

303 - VOS Fundamentals


•• To
To mark
mark aa block
block of
of text:
text:
[MARK]
[MARK] [arrow
[arrow key(s)]
key(s)]

•• To
To make
make the
the marked
marked text
text into
into aa region:
region:
[MARK]
[MARK] (move
(move cursor
cursor over
over text
text to
to highlight
highlight it)
it)
[REGIONAL]
[REGIONAL]
[MENU]
[MENU] [G]
[G]

Education
Stratus
Marking Text

• To work with a section of text, you need to the MARK (select) the text.

- Start the selection with the [MARK] key. Use the [ARROW KEYs] to
select the text. As the cursor moves over the text, the marked text will
be displayed in reverse video.

Regional Search and Replace

• To make global changes within the marked text, make the marked text
into a region with the [REGIONAL] key. Now a regional Search and
Replace can be done within the selected text.

7 - 10 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-11
Altering Text

303 - VOS Fundamentals


•• Insert/Overlay
Insert/Overlay
[MENU]
[MENU] [O]
[O]

•• Changing
Changing Case
Case
[Change
[Change case]
case] [arrow
[arrow key(s)]
key(s)]
UP arrow for uppercase
UP arrow for uppercase
DOWN
DOWN arrow
arrow for
for lowercase
lowercase

Education
Stratus
Altering Text

Insert/Overlay
You can modify text in the text buffer by inserting or by overwriting the text.

• The insert mode (default mode) adds characters at the cursor position.
• The overlay mode replaces the character at the cursor position.
• [Menu] [O] toggles between insert mode and overlay mode.
• The function key [INSERT/OVERLAY] does the same as [MENU] O.

Changing Case

• The [CHANGE CASE] key and the up/down arrow key will change the
case of the current character at the cursor position.
• To change the case of a whole word, use [WORD] [CHANGE CASE] and
an up/down arrow key.

Editing Text using edit 7 - 11


VOS Fundamentals 303 Stratus®

Slide 7-12
Moving and Copying Text

•• Deleting
Deleting and
and Saving
Saving Text
Text

303 - VOS Fundamentals


–– [DELETE]
[DELETE] or
or [SAVE]
[SAVE]

•• Displaying
Displaying the
the Stack
Stack
–– [MENU]
[MENU] [1]
[1]

•• Retrieving
Retrieving Text
Text
–– [INSERT
[INSERT SAVED]
SAVED]

Education
Stratus
Moving and Copying Text

• To move or copy text, the text must first be written to a work area called
the Stack or the Status Buffer.

• The editor writes text to the Stack using the [DELETE] or [SAVE] key.

- To delete character strings:

Word deletion [DELETE] [WORD]


Line deletion [DELETE] [right arrow/left arrow]
Block deletion [MARK] [use arrow keys] [DELETE]

- To copy character strings:

[MARK][arrow keys][SAVE]

7 - 12 Editing Text using edit


Stratus® VOS Fundamentals 303

Status Buffer (Stack area)

• Items on the stack are LIFO (last in first out) order.

• A maximum of eight entries can be active on the stack at one time.

- Entries are discarded when the stack exceeds the maximum


number of active entries.

- The Editor automatically discards the oldest entries from the


end of the stack.

- Discarded entries remain in the stack, but can not be retrieved.


(They are marked DISCARD.)

Displaying the Status Buffer (Stack area)

• To display the contents of the Status Buffer (Stack), use: [MENU] [1]

- The top of the stack is the bottom of the buffer.

- You can not edit the stack (change the information).

• To move the cursor from the stack back to the current text buffer, use:
[CANCEL]

Editing Text using edit 7 - 13


VOS Fundamentals 303 Stratus®

Slide 7-13
Displaying the Status Buffer

* (default): %class#d01>VOS_Fundamentals>vf1>abc

303 - VOS Fundamentals


Cursor at line 4, column 20; mark at line 4, column 1.

DELETE

bbbbbbbbbb

SAVE

CCCCCC

Education
Stratus
Displaying the Status Buffer

• To retrieve text from the stack (Status Buffer), use: [INSERT SAVED]

- The Editor inserts the text, that was saved or deleted, at the current
cursor position.

• The [INSERT SAVED] key will always retrieve the last [SAVE] or
[DELETE] request.

• To retrieve a different item from the stack, the last item on the stack must
be discarded using the [DISCARD] key.

- To verify the last request on the Stack before discarding, use:


[INSERT SAVED] then [DISCARD]

7 - 14 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-14
Formatting Text - Tabs

303 - VOS Fundamentals


•• To
To display
display the
the current
current tab
tab settings
settings
(the
(the Tab
Tab Definition
Definition Line)
Line)
[MENU]
[MENU] [T]
[T]

Education
Stratus
Formatting Text

Tabs

• The default tab positions are set every five spaces.

• There is no TAB control character. When the [TAB] key is pressed,


spaces are added to the text.

• Use the [TAB] key to move the cursor along the line according to the tab
stops.

[TAB]5960 [TAB]Brown [TAB]20567890

• To display the tab settings, use: [MENU] [T]

Editing Text using edit 7 - 15


VOS Fundamentals 303 Stratus®

Slide 7-15
Tabs

303 - VOS Fundamentals


•• To
To delete
delete tabs
tabs on
on the
the tab
tab definition
definition ::
[SPACE],
[SPACE], [BACKSPACE]
[BACKSPACE] or
or [DEL]
[DEL]

•• To
To add
add new
new tabs
tabs on
on the
the tab
tab definition
definition line
line ::
–– Enter
Enter [>]
[>] (greater-than)
(greater-than)

Education
Stratus
Tabs (continued)

• Tabs on the Tab Definition Line may be deleted by spacing over them or
using the keys:

[BACKSPACE] or [DEL]

• To add new Tabs on the Tab Definition Line, type [>].


Tabs become effective with the [ENTER] key.

• To reset the Tabs to the default, press: [INSERT DEFAULT]

• Tabs only stay for this edit session. When you exit the Editor, the Tabs
go back to the default.

7 - 16 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 7-16
Formatting Text - Backtab

303 - VOS Fundamentals


•• The
The [BACKTAB]
[BACKTAB] key key on
on the
the terminal
terminal allows
allows the
the
cursor
cursor to
to move
move quickly
quickly from
from one
one column
column toto
another.
another.

Education
Stratus
BACKTAB

The [BACKTAB] key on the terminal allows the cursor to move quickly from one
column to another.

• Before using this feature, you have to set up the spacing for the first line
of data. [BACKTAB] positions are determined by the previous line with
characters.

• [BACKTAB] looks for the first letter of words on the preceding line.

• For PCs and V103 terminals, the [SHIFT -TAB] is the [BACKTAB].

Editing Text using edit 7 - 17


VOS Fundamentals 303 Stratus®

Slide 7-17
Columns

303 - VOS Fundamentals


•• Moving
Moving and
and Deleting
Deleting columns.
columns.

Education
Stratus
Columns

• Editor requests can also be executed on columns.

• To do anything with a column, you first have to MARK the column.

- Move cursor to the first position in the column.


- [MARK] [COLUMN], move the cursor to the right and down to
highlight the column.

• To delete the column, press: [DELETE].

• To copy the column, press: [SAVE].

• To search the column, press:

[SEARCH] [down/up arrow] <search string>

7 - 18 Editing Text using edit


Stratus® VOS Fundamentals 303
Summary of Editing Text using edit

ACTIVITY REQUEST
Move through the buffer [SHIFT] ARROW KEY
[GOTO] ARROW KEY
[GOTO] [LINE] ARROW KEY
[WORD] ARROW KEY

Scroll text [SCROLL] ARROW KEY

Insert/Overlay text [MENU] O


[INSERT/OVERLAY]

Repeat request [REPEAT]


[REPEAT LAST]

Display line numbers [MENU] N

Go to line numbers [GOTO] [LINE]

Go to column [GOTO] [COLUMN]

Display the stack [MENU] 1

Cancel a request [CANCEL]

Search for a string [SEARCH] ARROW KEY


[CASELESS] ARROW KEY
[MARK] [COLUMN] UP/DOWN ARROW

Editing Text using edit 7 - 19


VOS Fundamentals 303 Stratus®
Summary of Editing Text using edit (continued)

EDITOR REQUESTS (continued)


ACTIVITY REQUEST
Delete text [BACK SPACE]
[DEL]
[DELETE] ARROW KEY
[DELETE] [WORD]
[MARK]...[DELETE]
[MARK] [COLUMN]...[DELETE]

Replace a string [MENU] G


[MENU] G [QUERY]
[MARK]...[REGIONAL] [MENU] G

Copy text [SAVE]...[INSERT SAVED]

Discard text from the stack [DISCARD]

Tabulate text [TAB]


[MENU] T
[BACK TAB]

7 - 20 Editing Text using edit


Stratus® VOS Fundamentals 303
Lab: Editing Text using edit

Purpose: To practice using edit requests to efficiently move within an edit


buffer, to modify text and use tabs.

1. In your directory there is a file named abbreviations. Invoke the editor


with the name of this file.

a. Use the arrow keys to move up, down, right and left in this file until
you feel comfortable.

b. Now, press the [GOTO] key followed by an arrow key to move in one
of four directions on the screen. (Be sure to try them all.)

c. From the Request Menu, turn on line numbers.

d. Move to the bottom line in the screen and press the down arrow.
What happened? _______________________________________

e. Move to the top line of the screen and press the up arrow. What does
this do? _________________________________________

f. What happens when you press the [SHIFT] and down arrow together?
_____________________________

g. What happens from any cursor position in the screen when you press
the [SHIFT] and up arrow simultaneously?

h. Use the [GOTO] and [LINE] function key to position the cursor on
the last line of the file. What number is it? _______

i. Now use the [GOTO] and [LINE] function key to move back to the
beginning of the file.

j. Use the [GOTO] and [LINE] function key to specifically go to line 50


of the file. What does this line of text say?
_________________________________________________

k. When you are finished, quit this edit session.

Editing Text using edit 7 - 21


VOS Fundamentals 303 Stratus®
Lab: Editing Text using edit (continued)

2. The following exercise allows you to practice searching techniques.


Invoke the editor with the file, Ada/ADA, then:

a. Do a case-sensitive search forward for every occurrence of the


woman's name, 'Ada '. (Include "Ada's" in your count.)
How many did you find?______

b. Do a case-sensitive search in reverse for every occurrence of the


acronym 'ADA' (American Dental Association).
How many did you find?__________

c. Lastly, go to the top of the buffer, then do a caseless search of the


document to find every occurrence of the string 'ada' (regardless of
location). How many did you find?_______

d. When you are finished, quit this edit session.

3. Edit a file named computers_and_technology The following exercise


demonstrates global searching techniques.

a. Globally search this document and replace every occurrence of


'technology' with 'TECHNOLOGY'.

b. Again, globally search this document and change every occurrence of


the word 'computer' to 'COMPUTER'.

c. Lastly, do a global search and replace with a query to selectively


change every other 'COMPUTER' back to 'computer'.
How many replacements did you make in the file? _________

d. When you are finished, quit this edit session without saving the
changes.

4. Use the Saved-Text Stack feature of the editor to unscramble the steps of
the file, scrambled_turkey, in your directory.

7 - 22 Editing Text using edit


Stratus® VOS Fundamentals 303
Lab: Editing Text using edit (continued)

Optional

5. In your directory there is a file named scrolling. This file contains


instructions for practicing scrolling. Invoke the editor with the name of this
file and carefully follow the steps.

6. Edit the file, overlay, in your directory and follow the instructions in the file.

7. To get some experience in changing the default tab settings of file, edit the
file, tab_lab, in your directory and follow its instructions.

Editing Text using edit 7 - 23


VOS Fundamentals 303 Stratus®

7 - 24 Editing Text using edit


Stratus® VOS Fundamentals 303

Slide 8-1
303 - VOS Fundamentals
Chapter 8
Edit
Edit Timesaving
Timesaving Techniques
Techniques

Education
Stratus

Edit Timesaving Techniques 8-1


VOS Fundamentals 303 Stratus®

Slide 8-2
Objectives

303 - VOS Fundamentals


•• Turn
Turn the
the [MENU]
[MENU] screen screen on
on and
and off
off
•• Define
Define shorthands.
shorthands.
•• Read
Read several
several files
files into
into an
an edit
edit session.
session.
•• Display
Display files
files in
in several
several windows.
windows.
•• Execute
Execute VOS
VOS commands
commands from from within
within the
the editor
editor
•• Edit
Edit session
session recovery
recovery

Education
Stratus
Objectives

This chapter covers some of the techniques that make editing easier for you. This
section demonstrates how to combine basic techniques to create shorthands, bring
several files into one edit session, and to issue system commands without leaving
your edit session.

At the end of this chapter, the student should be able to:

• Turn the [MENU] screen on and off


• Define shorthands.
• Read several files into an edit session.
• Display files in several windows.
• Execute VOS commands from within the editor
• Edit session recovery

8-2 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

The Menu Screen

Slide 8-3
Shorthands

303 - VOS Fundamentals


•• The
The Menu
Menu Screen
Screen
–– You
You can
can toggle
toggle the
the Menu
Menu screen
screen ON
ON and
and OFF.
OFF.

•• Shorthands
Shorthands
–– A
A shorthand
shorthand is
is aa series
series of
of keystrokes
keystrokes that
that execute
execute as
as
one request.
one request.

Education
Stratus
The Menu Screen Shorthands

• You can toggle the [MENU] screen ON and OFF. You may choose to do
this because you're dialing in over a modem and you want to speed up the
process or simply because you find it distracting

• To en/disable it, press: [MENU] [A]

Shorthands

• A shorthand is a series of keystrokes that execute as one request.

• Shorthands consist of edit requests and text. They can:

- Repeat the same series of keystrokes


- Re-define infrequently used requests
- Execute requests at the beginning of the edit session.

Edit Timesaving Techniques 8-3


VOS Fundamentals 303 Stratus®

Slide 8-4
Defining a Shorthand

303 - VOS Fundamentals


•• To
To create
create aa shorthand:
shorthand:

1.
1. Start
Start the
the shorthand.
shorthand.

2.
2. Enter
Enter keystrokes.
keystrokes.

3.
3. End
End and
and save
save the
the shorthand.
shorthand.

Education
Stratus
Defining a Shorthand

1. Start the shorthand.

[DEFINE SHORTHAND]
Defining shorthand. <--- msg seen on the 25th status line

2. Enter the keystrokes that you want to save.

3. End and save the shorthand.

[DEFINE SHORTHAND]
Shorthand name (1 character): <-- type in a single character

a. Give the shorthand a name.


b. The name is a single character (letter, digit, or symbol).
c. Alphabetical characters are caseless.
d. System creates a shorthand file (if it doesn't exist)

8-4 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-5
Defining a Shorthand (cont)

303 - VOS Fundamentals


•• The
The shorthand
shorthand is
is stored
stored in
in aa system-generated
system-generated file
file
called
called shorthand_definitions.
shorthand_definitions.

•• Create
Create only
only the
the shorthand_definitions
shorthand_definitions
file.
file.

Education
Stratus
Defining a Shorthand (continued)

• When you save the shorthand, it is stored in a system-generated file


called shorthand_definitions (By default, this file is in your
home directory.)

- Once you have created a shorthand, you can use it in any of your
edit sessions.

• To create only the shorthand_definitions file, start the shorthand


and then immediately save without entering any keystrokes.

Edit Timesaving Techniques 8-5


VOS Fundamentals 303 Stratus®

Executing a Shorthand

Slide 8-6
303 - VOS Fundamentals
•• Executing
Executing aa Shorthand
Shorthand

•• Beginning
Beginning an
an edit
edit Session
Session with
with aa Shorthand
Shorthand

Education
Stratus
Executing a Shorthand

• You execute the shorthand by following the editor request with the
shorthand name. [SHORTHAND] shorthand_name

• The shorthand's execution is not obvious until it finishes executing.

• You can repeat the shorthand by pressing


[SHORTHAND] shorthand_name or by pressing: [REPEAT LAST]

Beginning an edit Session with a Shorthand

• You can use the -initial_shorthand argument on the command line,


to execute a shorthand when you begin an edit session:
edit letter -initial_shorthand x

8-6 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Modifying Shorthands

You can modify a shorthand in any of the following ways:

• Overwrite an existing shorthand by defining another shorthand and


entering the existing shorthand's name.

1. Start the shorthand. [DEFINE SHORTHAND]

2. Enter new keystrokes.

3. End and save the shorthand. [DEFINE SHORTHAND]

Shorthand name (1 character): <-- enter the existing


shorthand name
Replace it?

• Delete a saved shorthand by defining an empty shorthand (no keystrokes)


and entering the shorthand's name.

• Edit the shorthand_definitions file.

Edit Timesaving Techniques 8-7


VOS Fundamentals 303 Stratus®

Editing a Shorthand in the shorthand_definitions file

Creating a shorthand in the shorthand_definitions file is different than


creating it in a text buffer. Instead of executing the sequence of keystrokes, you
have to type them in. This gets tricky when you are trying to input a keystroke that
is a menu request (e.g., [MENU] [W]). For this, you have to make sure the editor
takes it literally.

Note: The only times you would need to do this is to imbed a hex value or to
capture [MENU] Q.

Steps to building a shorthand to both write and quit from an edit buffer.

1. Bring any file into an edit buffer and make a change (just hitting a carriage
return to add a new-line character is a sufficient enough change).

2. Issue the [DEFINE-SHORTHAND] edit request. Then use the [MENU] [W]
request. When prompted for the file name, just hit [CARRIAGE RETURN] to
write the file to its original name. Issue the [DEFINE-SHORTHHAND] again and
when prompted, name the shorthand 'q'. Then quit from the edit.

3. From the ready prompt, type: edit shorthand_definitions.


Use the [SEARCH] [Down-arrow] [Q] request to locate the Q shorthand you
just created in step 2. Carefully place your cursor at the end of the current
definition.

4. Issue the menu request, [MENU] [L] (Insert literal), then [MENU] [Q].

You know it worked if you see the request blinking.

5. Write the shorthand_definitions file to disk. Test it by editing a file and


making a simple change. Now, enter [SHORTHAND] [Q] to write and quit the
edit session.

8-8 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-7
Defining Multiple Buffers

•• Create
Create Several
Several Buffers
Buffers for
for Existing
Existing Files
Files

303 - VOS Fundamentals


•• Display
Display Listing
Listing of
of Buffers
Buffers

* ( default) :%class# d1 0 1 >VOS_ Fundamentals>vf1 >abc


Cur sor at line 2 , column 4 0 ; mar ked at line 2 , column1 .
letter :%class# d1 0 1 > VOS_ Fundamentals>vf1 >letter
Cur sor at line 4 , column 2 0 ; mar ked at line

* * STATUS * *

Education
Stratus
Defining Multiple Buffers

You may use multiple buffers to edit several files during the same edit session.

• There is no limit to the number of buffers.

• You can create several buffers by specifying the file names that you wish
to edit on the command line.

edit abc letter

• The operating system creates a buffer for each file and gives each buffer
the same name as the file, except for the default buffer (which has the
buffer name (default)).

Display Listing of Buffers

• The status buffer displays the list of buffers in use: [MENU] [1]

Edit Timesaving Techniques 8-9


VOS Fundamentals 303 Stratus®

Move to an Existing buffer

Slide 8-8
Create a New Buffer

303 - VOS Fundamentals


•• Move
Move to
to an
an Existing
Existing Buffer
Buffer

•• Create
Create aa New
New Buffer
Buffer

Education
Stratus
Move to an Existing Buffer Create a New Buffer

• You can move the cursor between existing buffers with a menu request.

- To move to the (default) buffer:


[MENU] [B] Buffer name: <-- Press [RETURN]

- To change to a different buffer:


[MENU] [B] Buffer name: <-- type in buffer name

Create a New Buffer

• To create a new buffer:


[MENU] [B] Buffer name: <-- enter new buffer name

• A buffer name can be as many as 32 characters long.


(Upper and lower case are unique.)

8 - 10 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-9
Read a File into a Buffer

303 - VOS Fundamentals


•• Read
Read aa File
File into
into an
an Existing
Existing Buffer
Buffer

•• Create
Create aa New
New Buffer
Buffer and
and Read
Read in
in aa File
File

Education
Stratus
Read a File into a Buffer

• You can read an existing file into the edit buffer.

• The file is inserted at the current cursor position.


[MENU] R =====> Read file
Input path name: <--- type existing file name

• You can create an empty buffer with a short name by using [MENU] B,
then read in a file using [MENU] R. (This works well when the file
name is very long or it's a mix of upper and lower case characters.)

Create a New Buffer and Read in a File

• You can create a new buffer and read a file into it in one operation.
[MENU] C =======> Change buffer and read
Input path name: (Buffer name will be file name)

Edit Timesaving Techniques 8 - 11


VOS Fundamentals 303 Stratus®

Accessing Text between Buffers

Slide 8-10
Save Buffer Contents

303 - VOS Fundamentals


•• Accessing
Accessing Text
Text between
between Buffers
Buffers

•• Save
Save the
the Contents
Contents of
of aa Buffer
Buffer

Education
Stratus
Accessing Text between Buffers

• You can retrieve text copied to the stack regardless of which buffer it was
saved from. Move to another buffer and insert text from the stack.

Saving the Contents of Buffers

• If you attempt to exit the edit session without saving a modified buffer,
the editor will prompt you:

A buffer has been modified and not written.


Quit anyway?
Note: The editor does not say which buffer needs to be saved.

• The status buffer [MENU] [1] displays an asterisk (*) for each modified
buffer not yet written to disk.

• With multiple buffers, you must move into each buffer to save its
contents to a file.

8 - 12 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Defining Multiple Windows

Describing Windows

A window is the display area for the contents of a buffer.

• A default window is always present.

• You can divide a window (horizontally or vertically).

• You can define windows to see different buffers at one time.

• You can define windows to see different views of the same buffer.

Create Windows

At any time, you can use the editor requests to create more windows.

• Within the edit session, move the cursor to where you want to create the
window.

[WINDOW] [down/up/left/right arrow]

- The arrow key determines where the window will appear.

• If you would like to start the edit session with multiple windows, on the
command line, use the keyword argument –num_windows and the
specific number of windows that you wish to open.

edit letter1 letter2 -num_windows 2

Edit Timesaving Techniques 8 - 13


VOS Fundamentals 303 Stratus®

Moving to a Window

• To move to a window:

[GOTO] [WINDOW]down/up/left/right arrow


Buffer name:

• To associate the window with an edit buffer, type in a buffer name at the
prompt. If the buffer doesn't exist, the editor will create one.

• Whenever you would like to see a different buffer, you can execute
[MENU] [B] and the "new" buffer is displayed in the window.

Deleting a Window

• To delete a window, position the cursor in the window to be deleted.

[DELETE][WINDOW]

8 - 14 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Execute System Commands

Slide 8-11
while in edit

303 - VOS Fundamentals


•• Execute
Execute Commands
Commands and
and Wait
Wait

•• Execute
Execute Commands
Commands and
and Continue
Continue

•• Interrupt
Interrupt the
the edit
edit Session
Session to
to Execute
Execute Commands
Commands

Education
Stratus
Executing System Commands and Waiting

While you are in the editor, you can execute system commands without leaving the
edit session.

• To wait while the system executes a command

[MENU] [7]====> Execute command and wait


Command: Å type in the command

- The result of the command is placed in a buffer called (C#N).


Note: N is a number.

- The Editor positions the cursor in the C#N buffer.

Edit Timesaving Techniques 8 - 15


VOS Fundamentals 303 Stratus®

Executing a Command and Continuing

• To continue the edit session while a system command executes:

[MENU] [8]====> Execute command and continue


Command: <--- Type in the command

- The Editor displays the name of the buffer that contains output
from the command.
Command is executing; output will be placed in buffer C#N.
Note: N is a number.

- The cursor remains in the current buffer.

- The system notifies you on the 25th status line when the command
is done.

Execute Multiple Commands and Continuing

• While you are in the editor, you can temporarily suspend the editor and
execute system commands

[INTERRUPT]

- Interrupt will bring you to the command line (ready:) prompt so


you can execute system commands.

- The editor is suspended while you are at the command line.

- The results of the command(s) are displayed on the terminal.


(The results are NOT stored in any edit buffer.)

- logout will bring you back to the edit session.

8 - 16 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-12
Keystroke Recovery

303 - VOS Fundamentals


•• Issue
Issue quit
quit and
and answered
answered yy (yes)
(yes) instead
instead of
of nn (no)
(no)
to
to the
the question
question about
about leaving
leaving without
without writing.
writing.

•• You
You lose
lose your
your modem
modem connection.
connection.

•• Someone
Someone shuts
shuts the
the system
system down
down without
without warning
warning
people.
people.

Keystroke Recovery

While you are in the editor, you might accidentally lose your data.

This could happen for different reasons.

• If you went to quit and answered y (yes) instead of n (no) to the question
about leaving without writing.

• If you lose your modem connection.

• If someone shuts the system down without warning everyone.

Edit Timesaving Techniques 8 - 17


VOS Fundamentals 303 Stratus®

Using the keystroke file

What is a keystroke file. A keystroke file is a file created in your home directory
called _edit.terminal_name. Terminal_name is based on the terminal you are
logged into at the time of the edit session. There is one keystroke file per terminal
for every edit session you have. The following steps will allow you to recover
your edit session.

1. Find out your terminal name and compare it to the appropriate keystroke file.

display_line (terminal_name)
%educ#t11.5
ready 16:24:02
ls _edit*
Files: 2, Blocks: 2
w 1 _edit.t11.5
w 1 _edit.vterm.1.2
w 1 _edit.os.telnet1.3.1

Note: If you login remotely, there maybe multiple


keystroke files. Execute list –full and look for
the keystroke file with the most recent date.

2. copy_file the keystroke file to a file called fix.cm

copy_file _edit.t11.5 fix.cm

3. Edit the file fix.cm and add the following lines at the beginning of the file.

&attach_input
edit <name of file that needs recovery>
&control off

Note: In Step 3, you may also need to modify the keystroke file.
For example, if the last request is to quit the edit session,
then when you recover the session, you'll just quit again.

4. Now write and quit the file fix.cm.

5. Execute the file fix.cm by typing in fix.

8 - 18 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Summary of Timesaving Technique

COMMANDS
ACTIVITY COMMAND ARGUMENTS
Execute shorthand edit -initial_shorthand

Create buffers edit file name(s)

Create windows edit -num_windows N

EDITOR REQUESTS
ACTIVITY REQUEST
Enable/Disable the [MENU] display [MENU] A
Define a shorthand [DEFINE SHORTHAND]
Insert a menu request as is [MENU] L
Execute shorthand [SHORTHAND]

Create buffers [MENU]-C


[MENU]-B
Read a file [MENU]-R
Display buffer status [MENU]-1
Move to beginning of buffer [GOTO]-[LINE]-UP-ARROW
Move to end of buffer [GOTO]-[LINE]-DN-ARROW

Cancel status display [CANCEL]

Create windows [WINDOW]-ARROW- KEY


Move to a window [GOTO]-[WINDOW]-ARROW
KEY
Delete a window [DELETE]-[WINDOW]

Execute system commands [MENU]-7


[MENU]-8
[INTERRUPT]

Edit Timesaving Techniques 8 - 19


VOS Fundamentals 303 Stratus®

Lab: Edit Timesaving Techniques (Optional)

1. First, list the files in your directory to see if you have a file named
shorthand_definitions. Is it there? ____________________

2. Begin an edit session. Create a shorthand which contains the following


module header

Company Proprietary Software


Created by your name

Name this shorthand m. Quit the edit session.

3. If you didn't have the shorthand_definitions file in your directory


before, list the files once again.
Is the shorthand_definitions file there now? _______________

4. Use the -initial_shorthand argument with the edit command to create


an edit buffer and load in the module header format all at once. Fill out the
header info, save the file with the name module_demo, then quit the editor.

5. There are four sample files in your directory named: trout_almondine, rice,
asparagus, and tarts. Use [MENU] R to combine them all into a new file
called dinner.

8 - 20 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Lab: Edit Timesaving Techniques (continued)

6. Use the -num_windows option of the edit command to load copies of


the files, addresses and names, into separate windows on your screen.
Be sure that addresses is in the default buffer before proceeding with the
following steps:

a. Use the Saved-Text Stack and the [INSERT-SAVED] function keys to


copy the respective addresses from the address file into their
proper location in the names file.

b. Once you are finished, save the modified buffer under the title of
addresses_names.

c. Quit the edit session and print out a copy of the file,
addresses_names, to be sure you performed the steps correctly.

Edit Timesaving Techniques 8 - 21


VOS Fundamentals 303 Stratus®

Lab: Edit Timesaving Techniques (continued)

Optional

7. This exercise provides practice in moving comfortably back and forth


between files. bad.cobol is a file with bugs while bad.error is a list of the
fixes that need to be made.

Use the -num_windows argument of the edit command to load the files,
bad.cobol and bad.error, into two separate windows on the screen.
(Be sure that bad.cobol is in the default buffer before you continue with the
following tasks.)

a. Turn on the line numbers in the top window.

b. Go to lines 17 and 52 and simulate correcting the errors.

c. Go to the bottom window and scroll the file up so you can see more
errors.

d. Go back to the top window and simulate correcting the errors.

e. Continue until you are comfortable with this procedure.

f. Delete the bottom window.

g. Quit the edit session.

8 - 22 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Lab: Edit Timesaving Techniques (continued)

8. Invoke the editor with the name of a non-existing file called new.

a. Type in the following statement: Now that I am almost finished with


the Editor course, I would like a list of the files in my directory.

b. Through the Request Menu, select the editor request to wait for the
output then execute the appropriate system command to make the
above statement true.

c. Use the Saved-Text Stack and multiple buffer features to copy a list of
your files into your default buffer.

d. Once you have done this, position the cursor at the end of new, and
type in the following statement: These are abbreviations that I can
use on the command line.

e. Through the Request Menu, select the function that lets you continue
working in your file. Execute the appropriate system command.

f. When you are ready, go to the buffer that contains the abbreviations.
Use the Saved-Text Stack and multiple buffer features to copy this
display into your default buffer.

g. Save the file and quit the edit session.

9. Edit one of your files and make some changes, then quit with out saving.
Now recovery your edit session.
(Hint don't forget to remove the last set of keystrokes you did!!!)

10. Edit the file, exercise3, and follow its instructions. When you have
finished, quit the file.

Edit Timesaving Techniques 8 - 23


VOS Fundamentals 303 Stratus®

8 - 24 Edit Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 9-1
303 - VOS Fundamentals
Chapter 9
Using
Using the
the Abbreviations
Abbreviations Facility
Facility

Education
Stratus

Using the Abbreviations Facility 9-1


VOS Fundamentals 303 Stratus®

Slide 9-2
Objectives

303 - VOS Fundamentals


•• Implement
Implement and
and use
use aa set
set of
of abbreviations.
abbreviations.

Education
Stratus
Objectives

Students can tailor the system to their own liking by creating abbreviations for
command names, file names, command functions, command arguments, and even
entire command lines. Thus, the student can save on typing, effectively change
defaults of commands, and execute several commands by typing in an abbreviation
on the command line.

At the end of this chapter, the student should be able to:

• Implement and use a set of abbreviations.

9-2 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Slide 9-3
User Abbreviations

303 - VOS Fundamentals


•• Abbreviation
Abbreviation is
is aa character
character string
string

•• Simplifies
Simplifies typing
typing long
long sequences
sequences

Education
Stratus
User Abbreviations

• An abbreviation is a character string on a command line that the


operating system replaces before executing the command.

• It simplifies typing long sequences of characters and is a convenient way


to shorten any components on a command line:

- command names, program names, macro names


- arguments
- path names
- command functions

Note: VOS does not support abbreviations within abbreviations. That is,
abbreviations may not be used recursively (nested).

Using the Abbreviations Facility 9-3


VOS Fundamentals 303 Stratus®

Slide 9-4
Abbreviations Replacement

303 - VOS Fundamentals


Initial Command: lpr

User Memory
Abbreviations Table
Command ...
Processor ...
lpr by list_print_requests
...

Substituted Command: list_print_requests

Education
Stratus
Abbreviations Replacement

The command line may contain one or more tokens. Any token on the command
line can be abbreviated.

Before executing a command line, the Command Processor compares every token
on the command line against the abbreviations table in user memory. If there are
abbreviations, they are replaced with the definition of the abbreviation.

9-4 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Slide 9-5
Abbreviations Processing Steps

1.
1. Define
Define your
your abbreviation.

303 - VOS Fundamentals


abbreviation.
type
type abbreviation
abbreviation by
by [command
[command or
or char-string]
char-string]

2.
2. Activate
Activate the
the abbreviations
abbreviations file.
file.
use_abbreviations
use_abbreviations

3.
3. Use
Use the
the abbreviation(s)
abbreviation(s) on
on the
the command
command line.
line.

Education
Stratus
Abbreviations Processing Steps

1. Define your abbreviation. Use an editor to update the abbreviations file


(which contains abbreviation definitions).

- Each definition name must be unique.

- A definition can be as large as 300 characters, but it must all be on


one line in the file.

Definition format:

type abbreviation_name by [command-request or string]

2. Activate the abbreviations file with the command, use_abbreviations.


This causes the abbreviations file to be read into a table in memory.

3. Use the abbreviation(s) on the command line.

Using the Abbreviations Facility 9-5


VOS Fundamentals 303 Stratus®

Go to next page.

9-6 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Slide 9-6
Types of Tokens

303 - VOS Fundamentals


display start_up.cm -match notices

first subsequent

all

Education
Stratus
Types of Tokens

When defining the abbreviation, the type of token to be replaced must be


specified.

The types are:

• first: is a string of characters delimited by a space.

• subsequent: is a string of characters separated by a space or


one of five symbols (. > < # %).

• all: is a string of characters separated by a space or


one of five symbols (. > < # %).

Using the Abbreviations Facility 9-7


VOS Fundamentals 303 Stratus®

Slide 9-7
The Type first Abbreviation

•• A
A type
type first
first abbreviation
abbreviation replaces
replaces the
the first
first token
token

303 - VOS Fundamentals


Abbrev:
Abbrev: first
first dd by
by display
display
Cmd
Cmd line:
line: dd phone_file
phone_file
Result:
Result: display
display phone_file
phone_file

•• An
An abbreviation
abbreviation may
may contain
contain multiple
multiple VOS
VOS
commands
commands separated
separated by
by aa semi-colon.
semi-colon.
first
first show
show by
by display_line
display_line Here
Here are
are your
your files;list
files;list
Cmd
Cmd line:
line: show
show
Result:
Result: display_line
display_line Here
Here are
are your
your files;list
files;list

Education
Stratus
The Type first Abbreviation

• A type first abbreviation replaces the first token on the command line
(but not any later occurrences).

- In the abbreviations file:

first d by display

- On the command line:

d phone_file

- Replacement:

display phone_file

9-8 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

The Type first Abbreviation (continued)

• An abbreviation may contain multiple VOS commands that are separated


by a semi-colon.

- In the abbreviations file:

first show by display_line Here are your files; list

- On the command line:

show

- Replacement:

display_line Here are your files; list

Using the Abbreviations Facility 9-9


VOS Fundamentals 303 Stratus®

The Type subsequent

Slide 9-8
Abbreviation
•• AA subsequent
subsequent abbreviation
abbreviation is is replaced
replaced only
only when
when

303 - VOS Fundamentals


the
the token
token is
is not
not the
the first
first on
on the
the command
command line.
line.
Abbrev:
Abbrev: subsequent
subsequent tt by
by (time)
(time)
Cmd
Cmd Line:
Line: display_line
display_line tt
Result:
Result: display_line
display_line (time)
(time)

Abbrev:
Abbrev: subsequent
subsequent -m
-m by
by -match
-match
Cmd
Cmd Line:
Line: help -m print
help -m print
Result:
Result: help
help -match
-match print
print

Education
Stratus
The Type subsequent Abbreviation

• A type subsequent abbreviation is replaced only when the token is not


the first token on the command line.

- In the abbreviations file:

subsequent t by (time)

- On the command line:

display_line t

- Replacement:

display_line (time)

9 - 10 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

The Type subsequent Abbreviation (continued)

- In the abbreviations file:

subsequent -m by -match

- On the command line:

help -m print

- Replacement:

help -match print

Using the Abbreviations Facility 9 - 11


VOS Fundamentals 303 Stratus®

Slide 9-9
The Type all Abbreviation

•• The
The type
type all
all abbreviation
abbreviation replaces
replaces the
the token
token no
no

303 - VOS Fundamentals


matter
matter where
where the
the token
token is
is on
on the
the command
command line.
line.

Abbrev:
Abbrev: all
all stu
stu by
by start_up.cm
start_up.cm
Cmd
Cmd line:
line: stu
stu
Result:
Result: start_up.cm
start_up.cm

OR
OR

Cmd
Cmd line:
line: display
display stu
stu
Result:
Result: display
display start_up.cm
start_up.cm

Education
Stratus
The Type all Abbreviation

• The type all abbreviation replaces the token no matter where the token is
on the command line.

- In the abbreviations file:

all stu by start_up.cm

- On the command line:

stu

- Replacement:

start_up.cm

9 - 12 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

The Type all Abbreviation (continued)

Or

- On the command line:

display stu

- Replacement:

display start_up.cm

• Type first and subsequent abbreviations are protection against


unexpected results that may occur with a type all abbreviation.

Using the Abbreviations Facility 9 - 13


VOS Fundamentals 303 Stratus®

Passing Command line

Slide 9-10
Arguments to Abbreviation

303 - VOS Fundamentals


•• Default
Default Positioning
Positioning
–– In
In the
the abbreviations
abbreviations file:
file:
first
first pp by
byprint
print

–– On
On the
the command
command line:
line:
pp greetings.list
greetings.list -copies
-copies 22 -line_numbers
-line_numbers -defer_until
-defer_until 20:00
20:00

–– Replacement:
Replacement:
print
print greetings.list
greetings.list -copies
-copies 22 -line_numbers
-line_numbers -defer_until
-defer_until 20:00
20:00

Education
Stratus
Passing Command Line Arguments to an Abbreviation

• Sometimes it is desirable to pass arguments from the command line into


the abbreviation replacement.

- Default positioning is at the end of the replacement.

- Deliberate positioning within a replacement is done through


parameters.

9 - 14 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Passing Command Line

Slide 9-11
Arguments to Abbreviation

303 - VOS Fundamentals


•• Deliberate
Deliberate Positioning
Positioning
–– In
In the
the abbreviations
abbreviations file:
file:
first
first pf
pf by
byprint
print &1&
&1& -defer_until
-defer_until 20:00;
20:00; list_print_requests
list_print_requests -all
-all

–– On
On the
the command
command line:
line:
pf
pf start_up.cm
start_up.cm

–– Replacement:
Replacement:
print
print start_up.cm
start_up.cm -defer_until
-defer_until 20:00;
20:00; list_print_requests
list_print_requests -all
-all

Education
Stratus
Passing Command Line Arguments to an Abbreviation (continued)

• Abbreviation parameters are place-holders in the abbreviation definition.

- A parameter is an argument, enclosed in ampersands, that


corresponds to a position on the command line (&number&).

- &1& parameter for the first token on the command line after the
abbreviation.

- &3& parameter for the third token on the command line after the
abbreviation.

• Abbreviation parameters are used only with type first abbreviations.

Using the Abbreviations Facility 9 - 15


VOS Fundamentals 303 Stratus®

Passing Command Line

Slide 9-12
Arguments to Abbreviation
•• Multiple
Multiple parameters
parameters in
in an
an abbreviation
abbreviation definition
definition

303 - VOS Fundamentals


–– In
In the
the abbreviations
abbreviations file:
file:
first
first prc
prc by
byprint
print &1&
&1& -line_numbers
-line_numbers
-copies
-copies &2&
&2& -defer_until
-defer_until 20:00
20:00

–– On
On the
the command
command line:
line:
prc
prc log.96-09-04
log.96-09-04 55

–– Replacement:
Replacement:
print
print log.96-09-04
log.96-09-04 -line_numbers
-line_numbers -copies
-copies 55 -defer_until
-defer_until 20:00
20:00

Education
Stratus
Passing Command Line Arguments to an Abbreviation (continued)

• You can have multiple parameters (place holders) in an abbreviation


definition.

• Every place-holder requires a token on the command line.

• If there are more tokens on the command line than there are place-holders
in the abbreviation, all extra tokens will be ignored.

9 - 16 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Collecting Arguments from the

Slide 9-13
Command Line
•• One
One parameter
parameter can
can pick
pick up
up the
the remaining
remaining tokens
tokens

303 - VOS Fundamentals


–– In
In the
the abbreviations
abbreviations file:
file:
first
first prc2
prc2 by
byprint
print &1&
&1& -line_numbers
-line_numbers
-copies
-copies &f2&
&f2& ;; list_print_requests
list_print_requests

–– On
On the
the command
command line:
line:
prc2
prc2 log.96-09-04
log.96-09-04 55 -notify
-notify

–– Replacement:
Replacement:
print
print log.96-09-04
log.96-09-04 -line_numbers
-line_numbers -copies
-copies 55 -notify
-notify ;;
list_print_requests
list_print_requests

Education
Stratus
Collecting Arguments from the Command Line

• You can designate one parameter to pick up the remaining tokens on the
command line starting with a particular argument by inserting an f before
the parameter number for that argument (&fn&).

• If parameters (place holders) are used in an abbreviation, the definition


must use one argument collector, &fn&. Otherwise, extra arguments will
be discarded.

Using the Abbreviations Facility 9 - 17


VOS Fundamentals 303 Stratus®

Parameters in Multiple

Slide 9-14
Command Abbreviations
•• Multiple
Multiple commands
commands in
in an
an abbreviation.
abbreviation.

303 - VOS Fundamentals


–– In
In the
the abbreviations
abbreviations file:
file:
first
first dp
dp by
bydisplay
display &1&;
&1&; print
print &1&
&1& &f2&;
&f2&;
list_print_requests
list_print_requests -all
-all

–– On
On the
the command
command line:
line:
dp
dp phone
phone -line_numbers
-line_numbers

–– Replacement:
Replacement:
display
displayphone;
phone; print
print phone
phone -line_numbers;
-line_numbers;
list_print_requests
list_print_requests -all
-all

Education
Stratus
Multiple Command Abbreviation

• Parameters can be used to pass the same token to multiple commands in


an abbreviation.

9 - 18 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Competing Arguments on the

Slide 9-15
Command Line
•• Two
Two competing
competing arguments
arguments on
on the
the command
command line.
line.

303 - VOS Fundamentals


–– In
In the
the abbreviations
abbreviations file:
file:
first
first pl
pl by
by print
print &1&
&1& -line_numbers
-line_numbers &f2&
&f2&

–– On
On the
the command
command line
line
pl
pl phone_file
phone_file -no_line_numbers
-no_line_numbers

–– Replacement:
Replacement:
print
print phone_file
phone_file -line_numbers
-line_numbers -no_line_numbers
-no_line_numbers

Education
Stratus
Competing Arguments on the Command Line

• If there are two competing arguments are on the command line, the last
one is the effective one.

Using the Abbreviations Facility 9 - 19


VOS Fundamentals 303 Stratus®

Controlling the Use of

Slide 9-16
Abbreviations

303 - VOS Fundamentals


ready:
ready: use_abbreviations
use_abbreviations [DISPLAY
[DISPLAY FORM]
FORM]
--------------
-------------- use_abbreviations
use_abbreviations --------------------
--------------------
abbreviations_file_name:
abbreviations_file_name:
-off:
-off: no
no

Exclamation
Exclamation point
point
dd !stu
!stu

Single
Single quotes
quotes
dd ‘stu’
‘stu’ -m
-m notices
notices

Education
Stratus
Controlling the Use of Abbreviations

• The abbreviations file name can be specified or defaulted.

ready: use_abbreviations [DISPLAY FORM]


---------------- use_abbreviations --------------------
abbreviations_file_name:
-off: no

- The default is the file, abbreviations, located in your current


directory.

• To stop all processing of abbreviations, turn the table off.

use_abbreviations -off

9 - 20 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Controlling the Use of Abbreviations (continued)

• To suppress abbreviations processing on a command line use the


! (exclamation point).

d !stu

(will use a file named stu without checking the abbreviations table for
a replacement)

- The abbreviations are suppressed from that point to the end of the
command line

• Use ' ' (single quotes) around the token if you only want to suppress that
one token instead of the entire command line

d 'stu' -m notice

Using the Abbreviations Facility 9 - 21


VOS Fundamentals 303 Stratus®

Summary of VOS Commands and Abbreviations Types

VOS Commands & chapter page numbers

use_abbreviations (5)

Remember

The commonly used types of abbreviations are:

first (8)
subsequent(10)
all (12)

Ways to suppress abbreviations

use_abbreviations -off (14)


! (15)
' ' (15)

9 - 22 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Lab: Using the Abbreviations Facility

Purpose: To practice implementing and using abbreviations.

1. Create the abbreviation “ua” for “use_abbreviations”

2. Activate your abbreviations file by executing the appropriate command.

3. Create the abbreviations “-ln” for “-line_numbers”

4. Activate your abbreviations file by executing the abbreviation from step 1.

5. Test your new abbreviations by typing the following:

display abbreviations -ln

6. Create one abbreviation “ldd” that will do the following:

List the files in the current directory

Display the date on the terminal

Display DONE on the terminal

7. Edit your abbreviations file to add the abbreviation prc that will print a file.
The abbreviation should accept input parameters for the file name and the
number of copies.

When you type: prc media 1

The result will be: print media -copies 1

8. Test your newly created abbreviations.

Using the Abbreviations Facility 9 - 23


VOS Fundamentals 303 Stratus®

Lab: Using the Abbreviations Facility (continued)

Optional

9. Create an abbreviation which uses a parameter to list a specific file then


displays that file with any other options assigned from the command line.

10. Create an abbreviation that will edit any abbreviations file and will then
activate the same abbreviations file.

11. Test your newly created abbreviations.

9 - 24 Using the Abbreviations Facility


Stratus® VOS Fundamentals 303

Slide 10-1
303 - VOS Fundamentals
Chapter 10
The
The Attributes
Attributes and
and Resources
Resources of
of aa User
User Process
Process

Education
Stratus

Process Attributes and Resources 10 - 1


VOS Fundamentals 303 Stratus®

Slide 10-2
Objectives

•• List
List the
the attributes
attributes and
and resources
resources

303 - VOS Fundamentals


•• Describe
Describe the the CPU
CPU priority
priority scheduling
scheduling
•• Change
Change thethe user
user process
process priority
priority
•• Display
Display thethe user_name
user_name
•• Describe
Describe the the uses
uses of
of virtual
virtual memory
memory
•• Describe
Describe the the uses
uses of
of I/O
I/O ports
ports
•• Create
Create aa subprocess,
subprocess, terminate
terminate aa subprocess
subprocess

Education
Stratus
Objectives

When you log into the system, your user_name is assigned to a process. This
defines your interaction with the system. In order to better understand other parts
of the system, it is necessary to know about the attributes and resources of a user
process. In this chapter, the student will look conceptually at a process.

At the end of this chapter, the student should be able to:

• List the attributes and resources


• Describe the CPU priority scheduling
• Change the user process priority
• Display the user_name
• Describe the uses of virtual memory
• Describe the uses of I/O ports
• Create a subprocess, terminate a subprocess

10 - 2 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Slide 10-3
Stratus User Process

•• Attributes
Attributes of
of aa process
process

303 - VOS Fundamentals


–– user_name
user_name
–– process
process priority
priority
–– privilege
privilege
–– home
home directory
directory
•• Resources
Resources of
of the
the computer
computer
–– CPU
CPU time
time
–– access
access to
to the
the directory
directory structure
structure onon disk
disk
–– memory
memory
–– interface
interface to
to peripherals
peripherals and
and files
files

Education
Stratus
Stratus User Process

When you log in, your user_name is assigned to a process. The user process is
terminated by the command, logout. The user process is your identity to the
Stratus system. How the system shares the work environment with you is affected
by your identity. Being a user process is like having a virtual computer.

• Identity means the attributes of a process, some of which are unique.

• Work environment means the resources of the computer, which allow


execution of VOS commands, macros, and programs.

• Some attributes and resources can be changed by the user.

Process Attributes and Resources 10 - 3


VOS Fundamentals 303 Stratus®

Slide 10-4
Process Priority and the CPU

P ro c e s s S c h e d u le r Lo o p

303 - VOS Fundamentals


Ready v f5 . VOS _ F undamentals (7 )
v f 1 . VOS _ F undamentals ( 5 )

Running Waiting

v f4 . VOS _ F undame ntals (8 ) v f 3 . V OS _ F undamentals ( 5 )


v f 2 . VOS _ F undamentals ( 7 )

Education
Stratus
Process Priority and the CPU

• The attribute, process priority, determines how much CPU time your
process will get and when your process gets this time.

• The System Administrator sets a user's default and maximum process


priority at registration time, 0 (low) to 9 (high).

10 - 4 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Slide 10-5
Process Priority and the CPU
•• Check
Check process
process priority
priority
ready:
ready: list_users
list_users -admin
-admin usage
usage -interval
-interval 10
10

303 - VOS Fundamentals


USERS
USERS CPU
CPU DCPU
DCPU PF
PF DPF
DPF MM PSPS FF PP PROGRAM
PROGRAM
vf1
vf1 ---
--- ---
--- ---
--- ---
--- 00 ---
--- -- 55 edit.pm
edit.pm
vf2
vf2 ---
--- ---
--- ---
--- ---
--- 00 ---
--- -- 55 emacs.pm
emacs.pm
ready: display_line (process_info priority)
ready: display_line (process_info priority)
55

•• Change
Change process
process priority
priority
ready:
ready: set_priority
set_priority [DISPLAY
[DISPLAY FORM]
FORM]
----------------------
---------------------- set_priority ---------------
set_priority ---------------
priority:
priority: 5
5
process_name:
process_name:
–user:
–user: vf1.VOS_Fundamentals
vf1.VOS_Fundamentals

Education
Stratus
–module:
–module:
-ask:
-ask: no
no

Process Priority and the CPU (continued)

• The user can check their current process priority two ways:

- list_users -admin usage -interval 10

The next to last column (P) is the Process Priority.

- display_line (process_info priority)

• Users can change the priority of their own processes, up to their


maximum, via the set_priority command.

Note: If a user is privileged, they can change the priority of any


process.

Process Attributes and Resources 10 - 5


VOS Fundamentals 303 Stratus®

User Name and Access to the

Slide 10-6
Directory Structure
#d101

303 - VOS Fundamentals


group directories

VOS_Fundamentals VOS_Programmer

person directories

vf1 vf2 vf3

start_up. cm abbreviations personnel_file

Education
Stratus
User Name and Access to the Directory Structure

• Your user_name is your credential into the directory structure on disk. It


will determine your home directory and it is the basis for the directories
and files you can and cannot use.

• Your user_name is established when you are registered on the system.

(user_name) = (person_name).(group_name)

• To display your user_name, use the VOS command line:

display_line (user_name)

ready: display_line (user_name)


vf2.VOS_Fundamentals

10 - 6 Process Attributes and Resources


Stratus® VOS Fundamentals 303

User Name and Access to the

Slide 10-7
Directory Structure

303 - VOS Fundamentals


•• To
To display
display your
your home
home directory.
directory.
ready:
ready: display_line
display_line (home_dir)
(home_dir)
%class#d101>VOS_Fundamentals>vf2
%class#d101>VOS_Fundamentals>vf2

Education
Stratus
User Name and Access to the Directory Structure (continued)

• Your home directory is established when you login to the system.

- To display your home directory, use the VOS command line:

display_line (home_dir)

• The disk is structured into directories for easy management and security.

Process Attributes and Resources 10 - 7


VOS Fundamentals 303 Stratus®

Slide 10-8
login Command

303 - VOS Fundamentals


ready: login -form

------------------------- login -----------------------


user_name:
-privileged: (as_registered, yes, no)
-password:
-change_password: (no, yes)
-priority:
-home_dir:
-module:
-subsystem:

Education
Stratus
The login Command

• As a user logins into the system, the following attributes may be changed.

- privileged: If the user is registered as privileged.

- password:

- priority: Up to the user’s maximum priority.

- home_dir: Must have at least status access.

- module: Default is the current module.

- system: Default is the current system.

10 - 8 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Slide 10-9
Other Resources - Memory

303 - VOS Fundamentals


•• Virtual
Virtual memory
memory is
is conceptually
conceptually divided
divided into
into
VOS
VOS memory
memory space
space and
and User
User memory
memory space.
space.

VOS Memory User Memory

External Commands
Internal Commands Abbreviations
User programs

Education
Stratus
Other Resources - Memory

Every process requires some memory in order to exist.

• Stratus uses a virtual memory scheme

- Virtual memory means part of your process is in real memory and


part of your process stays on disk (virtual memory) until it is
needed.

- When a page from virtual memory (disk) is brought (paged) into


real memory, the OS records the physical memory location.

- Translation between virtual memory and real memory is done by


VOS, transparently to the user.

Process Attributes and Resources 10 - 9


VOS Fundamentals 303 Stratus®

Slide 10-10
The I/O Connection

303 - VOS Fundamentals


User
Process
error text file

Education
Stratus
The I/O Connection (continued)

• Whenever your process wants to send data to a device or file, or receive


data from a device or file, a connection with the device or file must first
be established.

• The connection is called a port. A port is a logical object that holds


information about the device or file.

- VOS pre-defined ports


- User-created ports

• Every process has some VOS predefined ports.

10 - 10 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Slide 10-11
list_port_attachments

default_input
default_input(1)(1)
Indirects
Indirectstototerminal

303 - VOS Fundamentals


terminal

terminal_output
terminal_output(2) (2)
Indirects
Indirectstototerminal
terminal

command_input
command_input(3) (3)
Indirects
Indirectstototerminal
terminal

default_output
default_output(4) (4)
Indirects
Indirectstototerminal
terminal

terminal
terminal(5)
(5)
Pathname:
Pathname: %ed31#telnet.1.0
%ed31#telnet.1.0
Type:
Type: window
windowterminal
terminal
I/O type: output
I/O type: output
Access mode: sequential
Access mode: sequential
Attributes:
Attributes: wait
waitmode,
mode,hold
holdattached
attachedand
andopen
open

_aaac0cGQGpGaWiE5
_aaac0cGQGpGaWiE5(7) (7)
Pathname:
Pathname: %ed31#d101>system>error_codes.text
%ed31#d101>system>error_codes.text
Type:
Type: sequential
sequentialfile
file
I/O
I/Otype:
type: input
input
Access
Accessmode:
mode:indexed
indexed
Attributes:
Attributes: wait wait mode,
mode, hold
hold attached
attached and
and open

Education
open

Stratus
• Use the list_port_attachments (lpa) command to see the ports in use
by your process.

• VOS-predefined ports:

- one for input data (default_input)


- one for error output to terminal (terminal_output)
- one for VOS commands (command_input)
- one for output data (default_output)
- one to the physical terminal

• The first four predefined ports above are connected to the terminal.

• VOS uses one port to reference the error text file for error messages.

- This file contains the error messages for each error code.

Process Attributes and Resources 10 - 11


VOS Fundamentals 303 Stratus®

Slide 10-12
The I/O Connection

•• The
The default_output
default_output port port can
can be
be directed
directed to
to aa file
file

303 - VOS Fundamentals


rather
rather than
than the
the terminal.
terminal.
ready:
ready: attach_default_output
attach_default_output [DISPLAY
[DISPLAY FORM]
FORM]
-----------------
----------------- attach_default_output ------------
attach_default_output ------------
pathname:
pathname: default_output.out
default_output.out
-append:
-append: no
no

•• To
To reattach
reattach the
the default_output
default_output
ready:
ready: detach_default_output
detach_default_output

Education
Stratus
The I/O Connection (continued)

• A user can redirect the following predefined ports.

- default_input

- command_input

- default_output

10 - 12 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Slide 10-13
Subprocesses

303 - VOS Fundamentals


Parent
Process
(login)

Sub-
process 1
(ready)

Education
Stratus
Subprocesses

• A subprocess is an interactive process created by the user process and


typically carries the same attributes as the parent process.

- The parent process is suspended for the life of the subprocess.

- A subprocess can create another subprocess.

- The current process is the interactive one.

- The user can create a subprocess, use it to check something, and


then terminate it.

Process Attributes and Resources 10 - 13


VOS Fundamentals 303 Stratus®

Slide 10-14
Subprocesses

•• A
A user
user creates
creates aa subprocess
subprocess by:

303 - VOS Fundamentals


by:
–– login
login command
command
•• from
from the
the command
command line
line
•• from [CTRL-BREAK]
from [CTRL-BREAK]

–– [INTERRUPT]
[INTERRUPT] key
key from
from aa CRT
CRT form
form

–– from
from directives
directives within
within edit
edit or
or emacs
emacs
•• in
in edit
edit [INTERRUPT]
[INTERRUPT] keykey
•• in
in emacs
emacs ^X-L
^X-L key
keysequence
sequence

Education
Stratus
Subprocesses (continued)

• A user creates a subprocess by the

- login command

from the command line


ready: login [DISPLAY FORM]
---------------------- login ------------
group_name: VOS_Fundamentals
–privileged: no
–priority:
-password:
–module:
-memory_pool: default

from [CTRL-BREAK]
BREAK
Request? (stop, continue, debug, keep, login, re-enter)
login

10 - 14 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Subprocesses (continued)

- [INTERRUPT] key from a CRT form

- from directives within edit or emacs

in edit [INTERRUPT] key

in emacs ^X-L key sequence

• To return from a subprocess, to the creating or former process, use the


logout command.

Process Attributes and Resources 10 - 15


VOS Fundamentals 303 Stratus®

Slide 10-15
Subprocesses

•• The
The users
users can
can check
check on
on their
their processes.
processes.

303 - VOS Fundamentals


list_users command
–– list_users command

–– command
command functions:
functions:(process_type) and
(process_type) and
(process_info
(process_info sub_process_level)
sub_process_level)

ready:
ready: display_line
display_line (process_type)
(process_type)
sub_process
sub_process

ready:
ready: display_line
display_line (process_info
(process_info sub_process_level)
sub_process_level)
11

Education
Stratus
Subprocesses (continued)

• Note: If the terminal device_type is window_term,


the process_type will display as interactive,
and
the sub_process_level will display as 0.

10 - 16 Process Attributes and Resources


Stratus® VOS Fundamentals 303
Summary of Commands and Command Functions

VOS Commands & chapter page numbers

attach_default_output (12)
detach_default_output (12)
list_port_attachments (11)
list_users(5)
login (8)
set_priority (5)

VOS Command Functions & chapter page numbers

(group_name)(6)
(home_dir) (7)
(person_name) (6)
(process_info args) (5)
Argument values:
priority (5)
privileged (16)
sub_process_level (16)
(process_type) (16)
(user_name) (6)

Process Attributes and Resources 10 - 17


VOS Fundamentals 303 Stratus®
Lab: The Attributes and Resources of a Process

Purpose: Use various VOS commands and command functions to determine


the attributes and resources of your process and change them when
directed.

1. Using your terminal, display the following:

person_name

privileged status

home directory name

2. Display the CPU priority of your process.

Change it to priority 2.

Display your new CPU priority.

Reset your priority to the original number.

3. Display your user_name, person_name, and group_name on your


terminal.

4. Use attach_default_output to redirect the following information to a


file, named 10-4.[your_name]:

a. Do the following:

1. Determine your user_name by using a command function.


2. Use a command function to confirm you are in your home
directory.
3. Produce a list of the files in your home directory.
4. Use a command function to show the date of this information.

b. Terminate the redirection

c. Display the file 10-4.[your_name].

10 - 18 Process Attributes and Resources


Stratus® VOS Fundamentals 303

Lab: The Attributes and Resources of a Process (continued)

5. Execute either the emacs or edit commands. From within either editor:

a. Create a subprocess in order to list the contents of your home


directory and to print a file of your own choosing.

b. Execute the list_users command in order to see both of your


processes.

c. Return to the previous process (parent).

Optional

6. Display the ports used in your process.

7. Find out the process type of your current process.

8. Create a subprocess and then check the process type of your subprocess.

Process Attributes and Resources 10 - 19


Stratus® VOS Fundamentals 303

Slide 11-1
303 - VOS Fundamentals
Chapter 11
Batch
Batch and
and Started
Started Processes
Processes

Education
Stratus

Batch and Started Processes 11 - 1


VOS Fundamentals 303 Stratus®

Go to next page.

11 - 2 Batch and Started Processes


Stratus® VOS Fundamentals 303

Slide 11-2
Objectives

303 - VOS Fundamentals


•• Describe
Describe the
the differences
differences between
between an
an interactive
interactive
process
process and
and aa non-interactive
non-interactive process.
process.
•• Describe
Describe the
the differences
differences between
between aa batch
batch process
process
and
and aa started
started process.
process.

Education
Stratus
Batch and Started Processes

Commands and programs can execute without using a terminal. In this section,
you learn to manage non-interactive processes while freeing up the terminal for
other processes.

At the end of this chapter, the student should be able to:

• Describe the differences between an interactive process and a non-


interactive process.

• Describe the differences between a batch process and a started process.

Batch and Started Processes 11 - 3


VOS Fundamentals 303 Stratus®

Slide 11-3
login

sub_process

303 - VOS Fundamentals


login login
start_process batch

started batch
process process

Education
Stratus
Differences Between Process Types

• A non-interactive process differs from an interactive process

- The output of the non-interactive process is directed to a file rather


than to the terminal.

- No need to wait for a command to finish executing before entering


more commands.

• A non-interactive process may be executed with either the


start_process or batch command.

11 - 4 Batch and Started Processes


Stratus® VOS Fundamentals 303

Differences Between Process Types (continued)

• When execution starts:

started_process: immediate

batch: dispatched from queue

• A batch process differs from a started process:

- VOS places the batch command in a queue.

- Batch queue has priority and deferred dispatch.

- Batch job has automatic restart capability.

- Batch jobs are controlled by the BatchOverseer process.

Batch and Started Processes 11 - 5


VOS Fundamentals 303 Stratus®

Slide 11-4
The start_process Command
•• The
The start_process
start_process command
command

303 - VOS Fundamentals


ready:
ready: start_process
start_process 'display
'display personnel_file’
personnel_file’ -form
-form
--------------------
--------------------start_process
start_process-------------------------------------------------
-------------------------------------------------
command_line:
command_line: display
displaypersonnel_file
personnel_file
-process_name:
-process_name: display
display
-output_path:
-output_path: %class#d101>VOS_Fundamentals>vf1>display.out
%class#d101>VOS_Fundamentals>vf1>display.out
-priority:
-priority:
-privileged:
-privileged: no
no
-module:
-module:
-current_dir:
-current_dir: %class#d101>VOS_Fundamentals>vf1
%class#d101>VOS_Fundamentals>vf1
-wait:
-wait: no
no
-cpu_limit:
-cpu_limit:
-memory_pool:
-memory_pool: default
default

start_process
start_process ‘locate_files
‘locate_files *.cm
*.cm -root_dir
-root_dir (master_disk)’
(master_disk)’

The start_process Command


command_line: The command line to be executed.

-process_name: By default, derived from first name on the command line.


Displayed next to user_name in output of list_users.

-output_path: Path to where the output of the command will be written.


Default is .out added to first name on the command line.
-priority: Default is the same as your current process.
-privileged: Set to yes if command to be executed is a privileged cmd.
Only a privileged user can start a privileged process.
-module: Specify the module on which the process is to be started.
-current_dir: Sets the current directory of the started process.
-wait: Finish executing the command before returning to Ready.

-cpu_limit: Sets max number of seconds of CPU time to be consumed.


-memory_pool: Designate which memory_pool to run process. (1245 only)

11 - 6 Batch and Started Processes


Stratus® VOS Fundamentals 303
• Use the start_process command to start executing a non-interactive
command line immediately.

• Use list_users to see the process executing.

• Use stop_process to logout a process.

ready: stop_process display

Batch and Started Processes 11 - 7


VOS Fundamentals 303 Stratus®

Slide 11-5
The batch Command
•• The
The batch
batch command
command

303 - VOS Fundamentals


ready:
ready:batch
batch count_25.pm
count_25.pm -form
-form
--------------------
--------------------batch
batch--------------------
--------------------
command_line:
command_line: count_25.pm
count_25.pm
-process_name:
-process_name:
-output_path:
-output_path:
-process_priority:
-process_priority:
-queue_priority:
-queue_priority: 44
-privileged:
-privileged: no
no
-restart:
-restart: yes
yes
-queue:
-queue: normal
normal
-module:
-module:
-current_dir:
-current_dir: %class#d101>VOS_Fundamentals>vf1
%class#d101>VOS_Fundamentals>vf1
-defer_until:
-defer_until:
-control:
-control:
-after:
-after:

Education
Stratus
-cpu_limit:
-cpu_limit:
-notify:
-notify: no
no

The batch Command

• Use the batch command to submit a command line to a batch queue.

• New options with the batch command:


-queue_priority: Priority of the process in the batch queue. (9 – 0)
-restart: Restart process from beginning if module stops.
-queue: Name of batch queue that holds the request.
Default queue name is normal.
-defer_until: Defer running this process until after date_time.
-control: File to control the execution of the batch process.

-after: Don’t execute this process until process_name


(submitted by same user) has finished executing.
-notify: Notify user when the batch process terminates.

11 - 8 Batch and Started Processes


Stratus® VOS Fundamentals 303

Associated batch Commands

• Use list_batch_requests to see the jobs in the queue.

list_batch_requests -queue development

• Use list_users to see the process executing.

• Use update_batch_requests to modify a pending batch request.

update_batch_requests count_25 -notify

• Use cancel_batch_requests to remove jobs from the queue.


This will also stop a batch process if it is currently running.

cancel_batch_requests count_25

• Use stop_process to logout a batch job after it starts executing.

stop_process count_25

Batch and Started Processes 11 - 9


VOS Fundamentals 303 Stratus®
Summary of Commands

VOS Commands, their standard abbreviations & chapter page numbers

batch (8)
cancel_batch_requests, (cbr) (9)
list_batch_requests, (lbr) (9)
list_users, lu (7)(9)
start_process (6)
stop_process (7)(9)
update_batch_requests (9)

11 - 10 Batch and Started Processes


Stratus® VOS Fundamentals 303

Lab: Batch and Started Process

Purpose: Use the various batch and start process commands to execute and
monitor your batch processes.

1. Using the batch command, execute a command line that will list the files in
your home directory. When the job finishes, examine the output file to
verify that everything executed successfully.

2. Using the batch command, execute a command line that will display the file
tarts. Defer this batch process for at least one hour from the current time.

3. List all of YOUR batch jobs submitted to the batch queue.


Then, list everyone's batch jobs, including yours.

4. Using the update_batch_requests command, modify the pending job that


you submitted at step 2. Change the deferred time to the current time and
turn on the -notify option. Examine the results in the output file after you
are notified.

Optional

5. This time we want to initiate a non-interactive process using


start_process. Issue (via start_process) the command line that will
send a message to the instructor to go to lunch.

What command do you use to see if the non-interactive process is finished?

____________________________________________

When the process finishes, examine the output file for the results.

Batch and Started Processes 11 - 11


Stratus® VOS Fundamentals 303

Slide 12-1
303 - VOS Fundamentals
Chapter 12
Command
Command Macros
Macros II

Education
Stratus

Command Macros I 12 - 1
VOS Fundamentals 303 Stratus®

Slide 12-2
Objectives

•• Implement
Implement aa command
command macro
macro which
which executes

303 - VOS Fundamentals


executes
VOS
VOS commands
commands sequentially.
sequentially.

•• Implement
Implement aa command
command macro
macro which
which branches
branches on
on
aa condition.
condition.

•• Implement
Implement aa command
command macro
macro which
which executes
executes aa
program
program module
module or
or another
another command
command macro.
macro.

Education
Stratus
Objectives

When you have a set of commands that execute often, it is convenient to save that
sequence to be repeated many times. In this chapter, you will learn how to create
and use command macros.

At the end of this chapter, the student should be able to:

• Implement a command macro which executes VOS commands


sequentially.

• Implement a command macro which branches on a condition.

• Implement a command macro which executes a program module (.pm)


or another command macro (.cm).

12 - 2 Command Macros I
Stratus® VOS Fundamentals 303

Slide 12-3
Simple Command Macros
1 & simple.cm
2 &

303 - VOS Fundamentals


3 & All macro STATEMENTS start with an &
4 &
5 & This macro creates a file, shows that the file is there, and
6 & displays the pathname of your home directory
7 &
8 &
9 create_file abc
10
11 list abc
12
13 display_line My home directory is (home_dir)
14 &return

Education
Stratus
Simple Command Macros

• Macro file name must end with the .cm suffix.


• A macro file (.cm), in its simplest form, executes one line after another.
Each statement line can contain one of the following:
- VOS commands
- command functions
- user programs
- other command macros
- special macro statements
- abbreviations (Not recommended)

• Macro statements begin with an ampersand (&).


- A documentation line is a line that starts with &, then a space.
- &return is used to return to VOS command level or to a calling
macro.

• A macro is executed by entering the macro name on the command line.

Command Macros I 12 - 3
VOS Fundamentals 303 Stratus®

Slide 12-4
Continuation of Lines
1 & continuation.cm
2 &

303 - VOS Fundamentals


3 & Continuation of lines within a macro is accomplished via &+
4 &
5 display_line A link is an object that directs all refer&+
6 ences to itself onward to a file, a directory, or another link
7 &
8 print (home_dir)>abbreviations -indentation 5 &+
9 -line_numbers -notify
10 &
11 &return

Education
Stratus
Continuation of Lines

• &+ denotes the continuation of a macro line to the following line.

• All leading blanks on the continued line are discarded.

• If a space is necessary for correct syntax, place the space before the &+.

12 - 4 Command Macros I
Stratus® VOS Fundamentals 303

Slide 12-5
display_line vs &display_line
1 & display_line.cm
2 &

303 - VOS Fundamentals


3 & Both display_line and &display_line write text on the terminal.
4 & Only display_line writes values from command functions.
5 &
6 display_line 'Today is' (date)
7 display_line
8 &display_line (user_name) 'Have a nice day !!'
9 &return

Education
Stratus
display_line statement vs. &display_line command

• Both commands display data on the terminal.

• display_line:

- resolves command functions


- expands abbreviations (subsequent, all)
- suppresses single quotes on output
- does not respects spacing between items, unless single quoted

• &display_line:

- does not resolve command functions


- does not expand abbreviations
- does not suppress the single quotes on output
- respects spacing between items

Command Macros I 12 - 5
VOS Fundamentals 303 Stratus®

Slide 12-6
Macro Condition Statements
1 & condition.cm
2 &

303 - VOS Fundamentals


3 & &if...&then...&else... macro statements provide branching logic
4 & within a macro
5 &
6 &if (exists abc -file)
7 &then display_file_status abc
8 &else display_line File does not exist, ** creating file **;&+
9 create_file abc
10 &
11 &display_line File abc ready for use.
12 &return

Education
Stratus
Macro Condition Statements

• Macros can contain branching logic.

• &if...&then...&else...statements can control the execution of


commands and statements.

- Only controls one statement or command line


- Indentation for &then and &else is for readability, it is not
required
- &else must be on a separate line.
&if (exists abc -file)
&then truncate_file abc
&else create_file abc

- This is NOT ok:


&if (exists abc -file) &then display_file_status &else
create_file abc

12 - 6 Command Macros I
Stratus® VOS Fundamentals 303

Macro Condition Statements

Slide 12-7
Using nested &if
1 & nested_if.cm
2 &

303 - VOS Fundamentals


3 & When using nested ifs, indentation greatly aids the
4 & clarity of the code for the human reader
5 &
6 &if (exists abc -file)
7 &then &display_line The file, abc, does exist.
8 &if (exists goofy -file)
9 &then &display_line The file, goofy, does exist.
10 &else &if (exists pluto -file)
11 &then &display_line The file, pluto, does exist.
12 &else &display_line Neither the files goofy &+
13 or pluto exist.
14 &return

Education
Stratus
Macro Condition Statements (continued)
• Nested &if statements allow the layering of multiple &if statements.
Note: Requires VOS 12.2 or higher.

• The command function (exists) tests for the existence of a file,


directory or a link.

(exists PATH_NAME [OBJECT_TYPE])

PATH_NAME can be a star name.


OBJECT_TYPE can be -file, -directory, or -link.

The command function resolves to the value 1 (true) if the object


specified by PATH_NAME exists, or 0 (false) if not found.

Command Macros I 12 - 7
VOS Fundamentals 303 Stratus®

Macro Condition Statements

Slide 12-8
Using do-group
1 & do_group.cm
2 &

303 - VOS Fundamentals


3 & A do-group allows multiple statements to execute
4 & with either the &then or the &else statements.
5 &
6 &if (exists abc -file)
7 &then &do
8 display_line The file abc exists. Here is the file status.
9 display_line
10 display_file_status
11 &end
12 &else &do
13 &display_line The file abc does not exist.
14 &display_line The file is being created.
15 create_file abc
16 &end
17 display_line The file abc is ready for use.
18 &return

Education
Stratus
Macro Condition Statements (continued)

• The use of the do-group requires VOS 13.3.0 or higher.

• The &do command defines the beginning of a sequence of


command-macro processor statements.

• The &end command defines the end of a sequence of


command-macro processor statements that begins with a
&do command.

• The command-macro processor executes the statements inside the


&do loop once sequentially.

12 - 8 Command Macros I
Stratus® VOS Fundamentals 303

Slide 12-9
Changing the Flow of Execution
1 & execution_flow.cm
2 &

303 - VOS Fundamentals


3 & Combination of &if...&then...&else &goto...&label...
4 &
5 &if (time) < 12:00:00
6 &then &goto MORNING
7 &
8 display_line The time is (time -long)
9 display_line Good afternoon
10 &return
11 &
12 &label MORNING
13 display_line The time is (time -long)
14 display_line Good morning
15 &return

Education
Stratus
Changing the Flow of Execution

• &goto with &label is another way to change the flow of execution in a


macro. &label flags the destination of the &goto.

• Arithmetic and logical operators have standard meanings:

+ (add), - (subtract),
* (multiply), / (divide),
= (equal to), ^= (not equal to),
> (greater than), < (less than),
& (and), | (or).

Command Macros I 12 - 9
VOS Fundamentals 303 Stratus®

Slide 12-10
Programs and other Macros
1 & pm_cm_macro.cm
2 & Programs and other Command Macros can be executed within a macro.

303 - VOS Fundamentals


3 &
4 display_line
5 display_line count_25.pm to be executed
6 &
7 count_25.pm
8 &
9 display_line show_time.cm to be executed
10 display_line
11 &
12 show_time.cm
13 &display_line show_time.cm has been executed and returned to the
pm_cm_macro.cm
14 &return

Education
Stratus
Programs and Other Macros

• Program modules (.pm) and other command macros can be executed


from within a macro.

• When specifying program and macro names, if programs are not part of
the command search path, use the full path name including the suffix for
the file.

• Called Macro

1 & show_time.cm
2 & THIS MACRO IS EXECUTED BY PM_CM_MACRO.CM
3 &
4 display_line The time is (time -long)
5 &return

12 - 10 Command Macros I
Stratus® VOS Fundamentals 303

Summary of Macro Statements

Command Macro Statements & chapter page numbers

& documentation (3)


&display_line (5)
&if .... &then .... &else (6)
&goto ... &label (8)
&return (3)
&+ (4)

Command Functions & chapter page numbers

(exists pathname [-file]) (6,7)


(date) (5)
(home_dir) (3,4)
(time) (8)
(time -long) (8)
(user_name) (5)

Command Macros I 12 - 11
VOS Fundamentals 303 Stratus®

Lab 1: Command Macros

Purpose: To use an editor (either edit or emacs) to create command macros


and then execute them, debugging them as necessary.

Do not log these exercises.

1. Create a command macro which will:

Display the time

Display the name of your current directory

Display the string:

The following files are waiting in the print queue:

List all the requests in the print queue (use -all arg)

Using the &display_line statement, display a string that indicates


the macro finished executing.

Name this macro print_check.cm.

2. Create a macro called view_time.cm that will display the time in long
format. Before the time prints, have a greeting message write out on the
terminal that includes your person_name.

Hints: This macro will require you to use the (person_name) and
(time -long)function

3. Modify print_check.cm so that it displays the time by calling your


view_time.cm macro.

Name this new macro, print_check2.cm

12 - 12 Command Macros I
Stratus® VOS Fundamentals 303

Lab 1: Command Macros (continued)

4. Create a command macro that will check for the existence of a file named A.
If the file exists, the macro should display "Yes, that file is here." If the file
does not exist, it should display "No, that file is not here."
Use the &label and &goto macro statements.

Name this macro file_check.cm

Test your macro by executing it when file A does not exist and when file A
does exist. Create a file named A for this purpose.

Command Macros I 12 - 13
Stratus® VOS Fundamentals 303

Slide 13-1
303 - VOS Fundamentals
Chapter 13
Command
Command Macros
Macros II
II

Education
Stratus

Command Macros II 13 - 1
VOS Fundamentals 303 Stratus®

Slide 13-2
Objectives

•• Implement
Implement aa command
command macro
macro which
which checks
checks the
the

303 - VOS Fundamentals


exit
exit status
status ofof aa VOS
VOS command.
command.
•• Implement
Implement aa command
command macro
macro which
which creates
creates
variables.
variables.
•• Implement
Implement aa command
command macro
macro which
which branches
branches onon
input
input to
to the
the macro
macro from
from aa file
file or
or from
from aa terminal
terminal
query.
query.
•• Implement
Implement an an enhanced
enhanced start_up.cm
start_up.cm macro.
macro.

Education
Stratus
Objectives

At the end of this chapter, the student should be able to:

• Implement a command macro which checks the exit status of a VOS


command.

• Implement a command macro which creates variables.

• Implement a command macro, which branches on input to the macro


from a file or from a terminal query.

• Implement an enhanced start_up.cm macro.

13 - 2 Command Macros II
Stratus® VOS Fundamentals 303

Checking a Command’s Status in

Slide 13-3
a Macro
1 & check_status_do.cm
2 &

303 - VOS Fundamentals


3 & Use (command_status) function to check for successful
4 & execution.
5 &
6 display new_file
7 &
8 &if (command_status) ^= 0
9 &then &do
10 display_line The value in the COMMAND STATUS &+
11 after displaying new_file is: &+
12 (command_status)
13 &return 9999
14 &end
15 &return 0

Education
Stratus
Checking a Command's Status In a Macro

• The command status code, also known as a return code, is a number that
indicates the success of execution of a VOS command.

- If the command status code is 0, this indicates a successful


execution of a VOS command.

• The command function (command_status) returns the status code


number of the most recently executed VOS command.

• The &return statement can send a return code number to


(command_status) so another macro can determine the result of a
called macro.

• Each &do statement must have a corresponding &end statement.


This is known as a do-group.

Command Macros II 13 - 3
VOS Fundamentals 303 Stratus®

Allowing a Macro to Provide

Slide 13-4
Input to a Program
1 & lotto_script.cm
2 &

303 - VOS Fundamentals


3 & Input data from within macro file rather than from
4 & the terminal.
5 & Macro statements are &attach_input and &detach_input
6 &
7 &attach_input
8 lottery.pm
9 Mickey Mouse
10 23 Main Street
11 Orlando
12 &detach_input
13 &return

Education
Stratus
Allowing a Macro to Provide Input to a Program

• &attach_input redirects terminal input so that it comes from the


command macro.

• &detach_input returns terminal input back to the terminal.

• This is useful for testing programs consistently with the same data.

13 - 4 Command Macros II
Stratus® VOS Fundamentals 303

Slide 13-5
Setting Variable Values

1 & set_vars.cm

303 - VOS Fundamentals


2 &
3 & Macros can have VARIABLE DEFINITIONS with the &set statement
4
5 &set x 123
6 &set y 'hello world'
7 &set_string z Goodbye world
8
9 &display_line
10 &display_line The value of x is: &x&
11 &display_line The value of y is: &y&
12 &display_line The value of z is: &z&
13 &display_line
14
15 &return

Education
Stratus
Setting Variable Values

• Within a macro, variables can be created using &set or &set_string

• &set sets a variable to a single item. Multiple items must be enclosed in


quotes to be a text string. Can use the variable in an arithmetic operation.
&set x 123
&set y 'hello world'

• &set_string sets a variable to multiple items with spaces creating a text


string. You can NOT use the variable in an arithmetic operation.
&set_string y Goodbye world

• To use the value of a variable, refer to the variable with its name
enclosed in ampersands &variable_name&.
&display_line The value of xyz is: &xyz&

Command Macros II 13 - 5
VOS Fundamentals 303 Stratus®

Slide 13-6
Testing Variables

1 & test_vars_.cm
2 &

303 - VOS Fundamentals


3 & Macros can have VARIABLE DEFINITIONS which can be
4 & subsequently tested.
5 &
6 &set counter 1
7 &
8 &label LOOP
9 display_line &counter&
10 &
11 &set counter &counter& + 1
12 &if &counter& < 10
13 &then &goto LOOP
14 &
15 &display_line DONE!
16 &return

Education
Stratus
Testing Variables

• Variables must be initialized before they can be used or tested.

• To test the value of an arithmetic variable, refer to the variable with its
name enclosed in ampersands: &variable_name&.
&if &counter& < 10

• To test the value of a variable which is a text string, refer to the variable
with its name enclosed in ampersands, but precede the variable name
with a $ (dollar sign): &$variable_name&.
&if &$y& = 'hello world'
&then &display_line We are out here

13 - 6 Command Macros II
Stratus® VOS Fundamentals 303

Slide 13-7
Testing Variables

1 & test_vars_while.cm
2 &

303 - VOS Fundamentals


3 & Macros can have VARIABLE DEFINITIONS which can be
4 & subsequently tested.
5 &
6 & A while loop may be used to do the testing.
7 &
8 &set counter 1
9 &while &counter& <= 10
10 &display_line &counter&
11 &set counter &counter& + 1
12 &end
13 &
14 &display_line DONE!
15 &return

Education
Stratus
Testing Variables

• If you are running VOS 12.2 or higher, you can get the same results
using a &while/&end loop.

• The &while/&end loop is used to continue the execution of a statement


or statements as long as the test evaluates to true.

Command Macros II 13 - 7
VOS Fundamentals 303 Stratus®

Getting a Macro to Prompt a

Slide 13-8
User
1 & ask_demo.cm
2 &

303 - VOS Fundamentals


3 & ASK a USER QUESTIONS AND ALSO PROVIDE POSSIBLE
RESPONSES
4 & SET A VARIABLE TO A RESPONSE
5 &set name (ask 'What is your name? ' )
6 &set answer (ask 'Would you like some ice cream?' &+
7 '(yes,y) = yes (no,n) = no' )
8 &if &answer& = no
9 &then &goto END
10 display_line
11 &set reply (ask 'What flavor of ice cream would you prefer ?' &+
12 '(vanilla,va) = vanilla (coffee,co) = coffee &+
13 (chocolate, ch) = chocolate' )
14 &
15 &display_line Here is a scoop of &reply& ice cream
16 &label END

Education
Stratus
17 &display_line Have a nice day &name&
18 &return

Getting a Macro to Prompt a User

• The (ask) command function allows you to set up a prompt string.

- The (ask) function has an optional response string that limits a


user's choice to certain predetermined responses

(ask [‘PROMPT’] [RESPONSE_QUALIFIER] )

• The (ask) command function writes the string specified by


PROMPT and any string specified by RESPONSE_QUALIFIER to the
terminal_output port.

• Then it reads the user-supplied response string from the terminal


port and displays it on a new line or can be put into a variable.

13 - 8 Command Macros II
Stratus® VOS Fundamentals 303

Using a Macro to

Slide 13-9
Read from a File
1 & read.cm

303 - VOS Fundamentals


2 &
3 & Use the file class or some other file you may have
4
5 &set file_name (ask 'Enter a file name: ')
6 &set record_num 1
7 &label LOOP
8 &set record (contents &file_name& &record_num& -hold)
9 &if (end_of_file &file_name&) = 1
10 &then &return
11 &display_line &record&
12 &set record_num &record_num& + 1
13 &goto LOOP

Education
Stratus
Using A Macro to Read from a File

• A variable can be set to the contents of a file (or a record from a file)
using the (contents) command function.

(contents PATH_NAME [RECORD_NUMBER] [OPEN_STATUS])

- The maximum size of the variable is 256 characters.


- The -hold argument holds the file open.

• Macro variables can be referenced inside command functions.

• (end_of_file) function will test if you are at the end of a file.


1 is true, 0 is false.

Command Macros II 13 - 9
VOS Fundamentals 303 Stratus®

Using a Macro to

Slide 13-10
Write to a File
1 & redirect.cm

303 - VOS Fundamentals


2 &
3 attach_default_output outfile
4 &set file_name (ask 'Enter a file name: ')
5 &set record_num 1
6 &label LOOP
7 &set record (contents &file_name& &record_num& -hold)
8 &if (end_of_file &file_name&) = 1
9 &then &goto WRAP_UP
10 &else &display_line &record&
11 &set record_num &record_num& + 1
12 &goto LOOP
13 &label WRAP_UP
14 detach_default_output
15 &display_line Records have been placed in a file called: outfile

Education
Stratus
Using A Macro to Write to a File

• Macros can write to a file by redirecting the output from the terminal to a
file with attach_default_output

- -append will append output to the file, otherwise data in an


existing file is deleted.

• detach_default_output is needed before the macro finishes so the file


containing the redirected output can close and the normal terminal output
can resume.

13 - 10 Command Macros II
Stratus® VOS Fundamentals 303

Slide 13-11
start_up.cm Command Macro

303 - VOS Fundamentals


1 & start_up.cm
2 &
3 use_abbreviations
4 &if (process_type) = interactive
5 &then display_notices
6 &return

Education
Stratus
start_up.cm Command Macro

• If the start_up.cm macro resides in your home directory, it will


execute automatically when you login before you see the ready prompt.
• On initial login CRTL-BREAK and interrupt are disabled while the macro
executes.
• All logins execute your start_up.cm.
- interactive login.
- subprocess login.
- non-interactive logins:
batch
start_process
• If the start_up.cm is interactive (result of testing (process_type))
- The display_notices command displays a system file.
This file is used to convey information to all users.
• Use the start_up.cm macro to set terminal parameters, delete backup
files, display system notices, etc., when you login.

Command Macros II 13 - 11
VOS Fundamentals 303 Stratus®

Slide 13-12
Debugging Macros

1 & debug1.cm
2 &

303 - VOS Fundamentals


3 & Use &echo in macro statements to debug and test your macros.
4
5 &echo command_lines macro_lines
6 &set file (ask 'Enter a filename: ')
7 create_file &file&
8 &if (exists &file& -file)
9 &then list &file&
10 &echo no_command_lines no_macro_lines
11 delete_file &file&
12 &display_line The macro is finished and &file& file has been deleted
13 &
14 &return

Education
Stratus
Debugging Command Macros

• &echo controls the display of statements in your macro as the macro


runs. It can be placed throughout the macro to turn the types of lines to
be displayed ON and OFF.

• The &echo statement will allow you see what is being passed and
executed within a macro.

- &echo command_lines: display only VOS commands

- &echo macro_lines: display only macro statements

- Precede control line with no_ to turn off display:

&echo no_macro_lines

13 - 12 Command Macros II
Stratus® VOS Fundamentals 303

Slide 13-13
Debugging Macros
1 & debug2.cm
2 &

303 - VOS Fundamentals


3 &echo input_lines
4 &attach_input
5 lottery.pm
6 Donald Duck
7 33 Main Street
8 Orlando
9 &detach_input
10 &return

Education
Stratus
Debugging Command Macros (continued)

• &echo input_lines: display only input data lines

Command Macros II 13 - 13
VOS Fundamentals 303 Stratus®

Slide 13-14
Debugging Macros

1 & debug3.cm

303 - VOS Fundamentals


2 &
3 & Use &mode no_execute to debug and test your macros.
4 &
5 &
6 &mode no_execute
7 &echo command_lines
8 &
9 batch list_users
10 &
11 &mode execute
12 list_batch_requests -all
13 &
14 &return

Education
Stratus
Debugging Command Macros (continued)

• &mode no_execute suppresses the execution of commands.

• Can be used to check the syntax of commands.

• &mode execute turns the execution for commands back on.

13 - 14 Command Macros II
Stratus® VOS Fundamentals 303
Summary of Commands and Command Functions

VOS Commands & chapter page numbers


attach_default_output (10)
detach_default_output (10)
display_notices (11)

Command Functions & chapter page numbers


(ask prompt [response]) (8)
(ask string [response string]) (8)
(command_status) (3)
(contents filename [record_num] [-hold]) (9)
(end_of_file filename) (9)

Command Macro Statements & chapter page numbers


&attach_input .... &detach_input (4)
&do ... &end (3)
&echo (12)
&mode (14)
&return [return_value] (3)
&set (5)
&set_string (5)
&variable& (5)
&$variable& (6)
&while ... &end (7)

Command Macros II 13 - 15
VOS Fundamentals 303 Stratus®

Lab 2: Command Macros

Purpose: To use an editor (either edit or emacs) to create command macros


and then execute them, debugging them as necessary.

It is not necessary to log these exercises.

1. The program auto.pm should be in your home directory.

Execute the program giving input from your terminal as the program
requests it. (Don't use $ or comma in the amount.)

Now that you have seen the program execute, create a command macro
called purchase.cm that will supply the three appropriate answers so that
the program can receive its input from the macro rather than the terminal.

Note: The Color and Model that you entered do not display on the output of
purchase.cm.

2. Create a command macro that will count by 5's, starting at 20, and finishing
at 100. Display the value of the counter each time you add 5.

Name your macro by_5.cm.

Test your macro by using &echo and &mode no_execute statements within it.

Execute as a non-interactive process. After the macro executes, display the


.out file.

13 - 16 Command Macros II
Stratus® VOS Fundamentals 303

Lab 2: Command Macros (continued)

3. Edit your start_up.cm to:

Test your process type:

If it is batch, return from the macro.

If it is subprocess, make the cursor be a blinking block.

If your process type is interactive, the macro should ask if you want to read
the system notices file and, based on your response, the macro will
display_notices or return.

Test your macro by using &echo and &mode no_execute statements within
it.

4. Copy file_check.cm to file_check2.cm. Modify file_check2.cm so it sends a


return code of 7777 when the file doesn't exist. Create another macro
test_execute.cm. that will call the file_check2.cm and test for the return code
7777. If the return code is 7777 then it should create the file A and display a
message the file is now created.

Command Macros II 13 - 17
VOS Fundamentals 303 Stratus®

Lab 2: Command Macros (continued)

Optional

5. Copy by_5.cm to by_5_2.cm . Modify by_5_2.cm so it will ask the user if


he or she would like to write the output to a file. If the response is yes, ask
for the name of a file, and then continue with the rest of the macro.

Note: The macro must do a detach_default_output before it finishes.

6. Copy purchase.cm to purchase2.cm. Modify purchase2.cm so the input


comes from a file.

Hint: The file with the data in it will have 3 records.

13 - 18 Command Macros II
Stratus® VOS Fundamentals 303

Command Macros II 13 - 19
Stratus® VOS Fundamentals 303

Slide 14-1
303 - VOS Fundamentals
Chapter 14
Macro
Macro Input
Input Parameters
Parameters

Education
Stratus

Macro Input Parameters 14 - 1


VOS Fundamentals 303 Stratus®

Slide 14-2
Objectives

•• Implement
Implement aa command
command macro
macro which
which requires
requires

303 - VOS Fundamentals


input
input parameters
parameters

Macro Input Parameters

Another way to pass data into a macro is through input parameters. Input
parameters allow the user to create macros that look like VOS commands and have
similar argument types as the VOS commands. In this chapter, you learn how to
define and validate input parameters.

At the end of this chapter, the student should be able to:

• Implement a command macro which requires input parameters.

14 - 2 Macro Input Parameters


Stratus® VOS Fundamentals 303

Slide 14-3
Input Parameters
1 & PARAMETERS.CM
2 &
3 & Input parameters are used to pass command line arguments into a macro

303 - VOS Fundamentals


4 &
5 & A Parameter Block must come before any statements except comments.
6 &
7 &begin_parameters
8 my_file
9 counter
10 today
11 person
12 &end_parameters
13 &
14 &display_line My_file value is: &my_file&
15 &display_line Counter value is: &counter&
16 &display_line Today value is: &today&
17 &display_line Person value is: &person&
18 &
19 &return

Input Parameters

• Input parameters give command macros the appearance of VOS


commands.

- lineal format
- CRT format by [DISPLAY FORM] or –form
- -usage option

• Input parameters are special variables

- variable values set from arguments


- referenced like other macro variables (&parameter&)

• There are three types of parameters, just like there are three types of
command arguments:

- Positional, Switch, Option

Macro Input Parameters 14 - 3


VOS Fundamentals 303 Stratus®

Slide 14-4
Argument Specifiers
1 & SPECIFIERS.CM
2 &
3 & Parameters may have argument specifiers - the default specifier

303 - VOS Fundamentals


4 & is string.
5 &
6 & Positional Format: VARIABLE SPECIFIER
7 &
8 &begin_parameters
9 my_file name
10 counter number
11 today date_time
12 person name
13 &end_parameters
14 &
15 &display_line My_file value is: &my_file&
16 &display_line Counter value is: &counter&
17 &display_line Today value is: &today&
18 &display_line Person value is: &person&
19 &
20 &return

Input Parameters with Argument Specifiers

• Parameters may have argument specifiers. Argument specifiers are an


easy way to validate data coming into a macro.

• Argument Specifiers: (can only have one per parameter)

date_time
module_name
pathname
name
user_name
number
string

14 - 4 Macro Input Parameters


Stratus® VOS Fundamentals 303

Slide 14-5
Labels
1 & LABELS.CM
2 &
3 & Labels are used in parameter definitions to help the user fill in the

303 - VOS Fundamentals


4 & CRT format
5 &
6 & Positional Format: VARIABLE LABEL:SPECIFIER
7 &
8 &
9 &begin_parameters
10 my_file filename:name
11 counter quantity:number
12 today current_date:date_time
13 person clerk:name
14 &end_parameters
15 &
16 &display_line My_file value is: &my_file&
17 &display_line Counter value is: &counter&
18 &display_line Today value is: &today&
19 &display_line Person value is: &person&
20 &
21 &return

Input Parameters with Labels


• Labels for positional parameter provide meaningful prompts in the
macro's display form, but are not required.

Macro Input Parameters 14 - 5


VOS Fundamentals 303 Stratus®

Slide 14-6
Qualifiers
1 & QUALIFIERS.CM
2 &
3 & Parameters may be further restricted with ARGUMENT QUALIFIERS.

303 - VOS Fundamentals


4 &
5 & Positional Format: VARIABLE LABEL:SPECIFIER, QUALIFIER(S)
6 &
7 &begin_parameters
8 my_file filename:name, req, length(15)
9 counter quantity:number, min(10), max (150)
10 today current_date:date_time
11 person clerk:name, allow(Mary, John, Janet)
12 &end_parameters
13 &
14 &display_line My_file value is: &my_file&
15 &display_line Counter value is: &counter&
16 &display_line Today value is: &today&
17 &display_line Person value is: &person&
18 &
19 &return

Input Parameters with Qualifiers

• Argument Qualifiers are separated from the specifier by a comma.

• Argument Qualifiers (can use none, one, or more)

allow (list [ ,(associated list)] )


hidden
word
longword
length (integer)
max (integer)
min (integer)
required
noform

14 - 6 Macro Input Parameters


Stratus® VOS Fundamentals 303

Slide 14-7
Default Values
1 & DEFAULTS.CM
2 &
3 & Parameters may be given default values.

303 - VOS Fundamentals


4 &
5 & Positional Format: VARIABLE LABEL:SPECIFIER, QUALIFIERS(S),
=DEFAULT
6 &
7 &begin_parameters
8 my_file filename:name, required, =book
9 counter quantity:number, min(10), max (150), =100
10 today current_date:date_time, ='(date_time)'
11 person clerk:name, allow(Mary, John, Janet), =Janet
12 &end_parameters
13 &
14 &display_line My_file value is: &my_file&
15 &display_line Counter value is: &counter&
16 &display_line Today value is: &today&
17 &display_line Person value is: &person&
18 &
19 &return

Input Parameters with Default Values

• Default values are separated from argument specifiers and qualifiers by a


comma. The value is preceded by an equal sign (=).

• Default values are assigned to parameters when no other value is given.

• If the Default value is the value of a Command Function, the Command


Function must be enclosed with single quotes.

Macro Input Parameters 14 - 7


VOS Fundamentals 303 Stratus®

Slide 14-8
Option Parameters
1 & OPTION.CM
2 &
3 & Parameters may be defined as OPTION PARAMETERS.

303 - VOS Fundamentals


4 &
5 & Option Format:
6 & VARIABLE LABEL:option (-KEYWORD), SPECIFIER,
QUALIFIER(S), =DEFAULT
7 &
8 &begin_parameters
9 my_file filename:name, required, =book
10 count option (-count) number, min(10), max (150), =100
11 &end_parameters
12 &
13 &display_line My_file value is: &my_file&
14 &display_line Count value is: &count&
15 &
16 &return

Option Type Input Parameters

• Option parameters must be designated as such and must have keywords


that are preceded by a hyphen and enclosed in parentheses.

• Option parameters take keywords along with a value.

• Option parameters can use Specifiers, Qualifiers and Default Values.

14 - 8 Macro Input Parameters


Stratus® VOS Fundamentals 303

Slide 14-9
Switch Parameters
1 & SWITCH.CM
2 &
3 & Parameters may be defined as SWITCH PARAMETERS.

303 - VOS Fundamentals


4 &
5 & Switch Format:VARIABLE switch (-KEYWORD),QUALIFIER(S),
=DEFAULT
6 &
7 &begin_parameters
8 my_file filename:name, required, =book
9 count option(-count)number, min(10), max (150), =100
10 on_variable switch(-dump), =1
11 off_variable switch(-demo), =0
12 &end_parameters
13 &
14 &display_line My_file value is: &my_file&
15 &display_line Count value is: &count&
16 &display_line on_variable value is &on_variable&
17 &display_line off_variable value is &off_variable&
18 &
19 &return

Switch Type Input Parameters

• Switch parameters must be designated as such and must have keywords


that are preceded by a hyphen and enclosed in parentheses.

• Switch parameter values equate to: 1 if yes and 0 if no.

- A default value can be used.

• Switch parameters can use only two qualifiers: noform and hidden.

Macro Input Parameters 14 - 9


VOS Fundamentals 303 Stratus®

Slide 14-10
&end_parameters
1 & END_PARAMETERS.CM
2 &
3 & &end_parameters STATEMENT can have qualifiers.

303 - VOS Fundamentals


4 &
5 &begin_parameters
6 my_file filename:name, required, =book
7 count option(-count)number, min(10), max (150), =100
8 toggle switch(-toggle), =1
9 &end_parameters form
10 &
11 &display_line My_file value is: &my_file&
12 &display_line Count value is: &count&
13 &display_line Toggle value is: &toggle&
14 &
15 &return

&end_parameters Qualifiers

• &end_parameters qualifiers can further restrict how a macro is used.

• &end_parameters qualifiers (can use none, one or more)

form
2col
privileged, priv

14 - 10 Macro Input Parameters


Stratus® VOS Fundamentals 303

Summary of Macro Statements

Macro Statements and parameter types & chapter page numbers

&begin_parameters (3)
&end_parameters (3)
&end_parameters qualifiers (10)
form
2col
privileged, priv
switch type input paramters (9)
option type input paramters (8)

Argument Specifiers

date_time (4)
module_name (4)
name (4)
number (4)
pathname (4)
string (4)
user_name (4)

Argument Qualifiers

allow(list) (6)
hidden (6)
length(integer) (6)
longword (6)
max(integer) (6)
min(integer) (6)
noform (6)
required (6)
word (6)

Macro Input Parameters 14 - 11


VOS Fundamentals 303 Stratus®
Lab: Command Macros and Input Parameters

Purpose: To use an editor (either edit or emacs) to create command macros that
use various complexities of input parameter descriptions

1. Create a command macro which will set up the following input


parameters as positional parameters.
(no argument specifiers or qualifiers are required)

The customer's name

The item purchased

A quantity

A price

Create a display of this information similar to the example below:

Include in your macro statements to display the values of all the


parameters. Add text to your display that indicates the names of the
variables being displayed.

SALES ORDER

CUSTOMER:
ITEM:
QUANTITY:
PRICE:

Execute the macro giving arguments with [DISPLAY FORM].

2. Modify your command macro to add labels, specifiers and qualifiers to


the parameters as follows:

All of the fields should be required.


The customer's name, the item and the price must be strings.
The quantity must be a number (i.e. integer).

Execute the macro giving arguments with [DISPLAY FORM].

14 - 12 Macro Input Parameters


Stratus® VOS Fundamentals 303

Lab: Command Macros and Input Parameters (continued)

3. Modify your command macro to further qualify the parameters.

The customer's name is to be restricted to 15 characters.


The item purchased can only allow: Magazine, Calendar, Paperback.
The quantity should have a minimum value of 1 and a maximum value
of 10.

Execute the macro giving arguments with [DISPLAY FORM].

4. Modify your command macro to add a default value: item should default to
Paperback.

Test the macro by first giving a value to item and then not giving a value to
item.

5. Modify your command macro so that &end_parameters requires a form to


always appear on the screen.

Macro Input Parameters 14 - 13


VOS Fundamentals 303 Stratus®

Lab: Command Macros and Input Parameters (continued)

Optional

6. Modify your command macro to calculate the total cost and display this
cost.
Total cost is calculated from (quantity * price).

SALES ORDER

CUSTOMER:
ITEM:
QUANTITY:
PRICE:

TOTAL COST:

7. Add a switch parameter to your parameter block. When a keyword is


entered on the command line, the total cost should be calculated. When the
keyword is not entered, the total cost should not be calculated.

8. Add statements to your command macro so that the date and the user_name
are displayed each time the program executes. The user_name should
appear after Clerk:. Your macro should display the information similar to
that below:

SALES ORDER

DATE:
CLERK:

CUSTOMER:
ITEM:
QUANTITY:
PRICE:

TOTAL COST:

14 - 14 Macro Input Parameters


Stratus® VOS Fundamentals 303

Slide A-1
303 - VOS Fundamentals
Appendix A
For
For More
More Information
Information

Education
Stratus

Appendix A - 1
VOS Fundamentals 303 Stratus®
Appendix A

For More Information

VOS Commands Reference Manual (R098)


VOS Emacs User's Guide (R093)
VOS Commands User's Guide (R089)
VOS Reference Manual (R002)

Appendix A - 2
Stratus® VOS Fundamentals 303

Slide B-1
303 - VOS Fundamentals
Appendix B
Edit/Emacs
Edit/Emacs Help
Help Sheet
Sheet

Education
Stratus

Edit/Emacs Help Sheet Appendix B - 1


VOS Fundamentals 303 Stratus®
VOS Full Screen EDITOR

Quick Reference by Topic


BUFFERS
Create a buffer [MENU]-B
Move to buffer [MENU]-B
List buffers [MENU]-1

CANCEL and QUIT


Cancel a request [CANCEL]
Cancel a request [CTRL]-K] [BREAK]
Quit [MENU]-Q

CURSOR POSITIONING
Back a character LT ARROW
Forward a character RT ARROW
Backward by word [WORD]-LT ARROW
Forward by word [WORD]-RT ARROW
Beginning of line [GO TO]-LT ARROW
End of line [GO TO]-RT ARROW
Down a line DN ARROW
Up a line UP ARROW
Top of screen [GO TO]-UP ARROW
Bottom of screen [GO TO]-DN ARROW
Next screen [SHIFT]-DN ARROW
Previous screen [SHIFT]-UP ARROW
Beginning of buffer [GO TO]-[LINE]
-UP ARROW
End of buffer [GO TO]-[LINE]
-DN ARROW

DELETING TEXT
Character [BACKSPACE]
Character [DEL]
Line [DELETE]-RT ARROW
Block [MARK]...[DELETE]

Appendix B - 2 Edit/Emacs Help Sheet


Stratus® VOS Fundamentals 303
VOS Full Screen EDITOR (continued)

ENTERING TEXT
Carriage return [RETURN]
Tab [TAB]
Overlay/Insert [MENU]-O

FILES
Read a file [MENU]-R
Read a file [MENU]-C
Write a file [MENU]-W

GETTING HELP
Get help [HELP]

MOVING TEXT
Delete a line [DELETE]-RT ARROW
Delete a block [MARK]...[DELETE]
Retrieve text [INSERT SAVED]
Save a block [MARK]...[SAVE]

REPEATING REQUESTS
The next request [REPEAT]
The last request [REPEAT LAST]

SCREEN DISPLAY
Show line numbers [MENU]-N
Redisplay screen [REDISPLAY]

SCROLLING
Scroll text up [SCROLL]-UP ARROW
Scroll text down [SCROLL]-DN ARROW
Scroll text right [SCROLL]-RT ARROW
Scroll text left [SCROLL]-LT ARROW

SEARCHING
Global replace [MENU]-G
Search forward [SEARCH]-DN
Search backward [SEARCH]-UP ARROW

Edit/Emacs Help Sheet Appendix B - 3


VOS Fundamentals 303 Stratus®
EMACS

Quick Reference by Topic


BUFFERS
Create a buffer ^X-B
Move to buffer ^X-B
List buffers ^X-^B

CANCEL and QUIT


Cancel a request ^C
Quit [ESC]-Q

CURSOR POSITIONING
Back one character LT ARROW
Forward by character RT ARROW
Backward by word [ESC]-B
Forward by word [ESC]-F
Beginning of line ^A
End of line ^E
Down a line DN ARROW
Up a line UP ARROW
Top of screen [ESC]-A
Bottom of screen [ESC]-E
Next screen [ESC]-N
Previous screen [ESC]-P
Beginning of buffer [ESC]-<
End of buffer [ESC]->

DELETING TEXT
Character [BACKSPACE]
Character [DEL]
Line ^K
Block ^@...^W

ENTERING TEXT
Carriage return [RETURN]
Tab [TAB]
Overlay/Insert [ESC]-_

Appendix B - 4 Edit/Emacs Help Sheet


Stratus® VOS Fundamentals 303
EMACS (continued)

FILES
Read a file ^X-^R
Read a file ^X-^F
Write a file ^X-^W

GETTING HELP
Get help [ESC]-H

MOVING TEXT
Delete a line ^K
Delete a block ^@...^W
Retrieve text ^Y

REPEATING REQUESTS
Repeat next request [ESC]-number

SCREEN DISPLAY
Display line number [ESC]-=
Redisplay screen ^V

SCROLLING
Scroll to next screen [ESC]-N
Scroll to prev. screen [ESC]-P

SEARCHING
Global replace [ESC]-^R
Search forward [ESC]-S
Search backward ^R

Edit/Emacs Help Sheet Appendix B - 5


VOS Fundamentals 303 Stratus®

Appendix B - 6 Edit/Emacs Help Sheet


Stratus® VOS Fundamentals 303

Slide C-1
303 - VOS Fundamentals
Appendix C
Header
Header and
and Footer
Footer Keywords
Keywords for
for print
print Command
Command

Education
Stratus

Appendix C - 1
VOS Fundamentals 303 Stratus®
Header and Footer Keywords for print Command

* -header text

print the text on the second line from the top of each page

print personnel_file -header Stratus

* -footer text

print the text on the second line from the bottom of each page

print personnel_file -footer 'Stratus Computer'

* Parameters available for header/footer lines

&date_time&

&file_name&

&page_number&

&user_name&

print personnel_file -footer 'Page: &page_number&'

Appendix C - 2
Stratus® VOS Fundamentals 303

Slide D-1
303 - VOS Fundamentals
Appendix D
Favorite
Favorite Abbreviations
Abbreviations

Education
Stratus

Appendix D - 1
VOS Fundamentals 303 Stratus®
Favorite Abbreviations

Stratus Education instructors provided their favorite abbreviations for your


consideration and possible use. Note: A blank line appears after each
abbreviations so you can more easily read it. Also some of these abbreviations are
shown on more than one line. This is due to the size of this paper. Remember, in
your abbreviations file, an abbreviation can be only one line long (300
characters)!

all cd by (current_dir)

all hd by (home_dir)

first edco by edit &1&.cobol &1&.error -num_windows 2


-buffer_names 1 2 -initial_shorthand e

first edc by edit &1&.c &1&.error -num_windows 2


-buffer_names 1 2 -initial_shorthand e

first edp by edit &1&.pl1 &1&.error -num_windows 2


-buffer_names 1 2 -initial_shorthand e

first emacs by emacs &f1& -backup -keystrokes

first emco by emacs &1&.cobol &1&.error -num_windows 2

first emc by emacs &1&.c &1&.error -num_windows 2

first emp by emacs &1&.pl1 &1&.error -num_windows 2

first aba by use_abbreviations -off;


emacs (home_dir)>abbreviations;
use_abbreviationsirst

first abl by display (home_dir)>abbreviations -match &1&

first add_hex by display_line (calc (decimal &1&x)


(decimal &2&x) )

first any by list -all &1&

first ccd by change_current_dir &1&; display_current_dir

first cd2 by display_line 'Old dir: '(current_dir);


change_current_dir &1&;
display_line 'New dir: '(current_dir)

Appendix D - 2
Stratus® VOS Fundamentals 303
Favorite Abbreviations (continued)

first cdd by display_line '...I assume you really meant "ccd" Fumblefingers';
change_current_dir &1&;display_current_dir

first clean1 by delete_file *backup (home_dir)>_edit (home_dir)>_emacs-no_ask -brief;


delete_file (ask 'Another star_name?' pathname) -no_ask -brief

first clean2 by delete_file *backup (home_dir)>_edit* (home_dir)>_emacs -no_ask -brief;


delete_file (unquote (ask 'Enter more star_names:')) -no_ask -brief

first clear by display_line (byte 27)(byte 02)

first cpr by cancel_print_requests * -user (user_name)

first dcf by display_line 'The ' &f1& 'is '(&f1&)

first eab by use_abbreviations -off;


edit (home_dir)>abbreviations&1&;
use_abbreviations (home_dir)>abbreviations&1&

first edab by edit abbreviations;use_abbreviations

first elog by stop_logging

first l by list -all

first lbr by list_batch_requests -all

first ldm by list -sort date_modified

first letter by print &1& -queue spin &f2&;


list_print_requests -queue spin -all

first logedit by stop_logging; emacs (home_dir)>&1&_log

first logprint by stop_logging; print (home_dir)>&1&_log


-notify &f2&

first lpr by list_print_requests -all


-interval 1 -admin usage

first move by move_file

first num by display (home_dir)>phone_info>numbers


-match &f1& -min_lines 3

Appendix D - 3
VOS Fundamentals 303 Stratus®
Favorite Abbreviations (continued)

first pos by position

first q by quit

first ra by remove_access -form

first rda by remove_default_access -form

first rn by rename &1& &2&

first s by step

first sed by set_expiration_date&1& (date_time) -form

first send by send_message &1& (unquote (quote &f2&))


-system

first sendm by send_message &1& -system


(unquote (quote &f2&))

first slog by start_logging (home_dir)>&1&_log

first src by source

first ss by source;step

first sss by set_safety_switch &1& -form

first status by display_line (byte 27)(byte 20) &1& &f2&

first steady by set_terminal_parameters -cursor_format


-steady_block

first stnp by set_terminal_parameters -pause_lines 0

first stp by set_terminal_parameters

first stpp by set_terminal_parameters -pause_lines 23

first tsc by test_system_calls

first uci by update_channel_info

first unlinkn by unlink &f1& -no_ask

first up by change_current_dir <;display_current_dir

Appendix D - 4
Stratus® VOS Fundamentals 303
Favorite Abbreviations (continued)

first vvf by display_line 'Move your fingers to the left.';


display_line 'Old dir:'(current_dir);
change_current_dir &1&;
display_line 'New dir: '(current_dir)

first wc by where_command

first wl by who_locked

first wlt by who_locked (terminal_name)

subsequent -bn by -buffer_names

subsequent -f by -footer ' Page &page_nmber& '

subsequent -ln by -line_numbers

subsequent -m1 by -module m1

subsequent -m2 by -module m2

subsequent -na by -no_ask

subsequent -priv by -privileged

subsequent -q by -queue

subsequent -st by -statistics

subsequent -ttp by -terminal_type

subsequent -u by -usage

subsequent f by -form

subsequent gn by (group_name)

subsequent mmi by (person_name)

subsequent tn by (terminal_name)

Appendix D - 5
VOS Fundamentals 303 Stratus®

Appendix D - 6
Stratus® VOS Fundamentals 303

Slide E-1
303 - VOS Fundamentals
Appendix E
Introduction
Introduction to
to editing
editing using
using emacs
emacs

Education
Stratus

Introduction to Editing using emacs Appendix E - 1


VOS Fundamentals 303 Stratus®

Slide E-2
Objectives

•• Describe
Describe the
the terminal
terminal keyboard
keyboard keys.
keys.

303 - VOS Fundamentals


•• Input
Input text
text into
into an
an emacs
emacs buffer.
buffer.
•• Invoke
Invoke help
help to
to refer
refer to
to the
the emacs
emacs requests
requests and
and
commands.
commands.
•• Save
Save emacs
emacs buffers
buffers toto files
files and
and end
end the
the emacs
emacs
session.
session.

Education
Stratus
Objectives

The emacs command is a system command that calls a Full Screen Editor and
enables you to begin editing a file. Along with the emacs requests, you need to
learn a few simple system commands that help you examine your files.

At the end of this chapter, the student should be able to:

• Describe the terminal keyboard keys.


• Input text into an emacs buffer.
• Invoke help to refer to the emacs requests and commands.
• Save emacs buffers to files and end the emacs session.

Appendix E - 2 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303

Slide E-3
Terminal Keyboard

303 - VOS Fundamentals


•• Overview
Overview of
of Terminal
Terminal Keyboard
Keyboard

Education
Stratus
The Terminal Keyboard

• The keyboard consists of:

- Standard typewriter keys

- Cursor positioning keys

- Function keys are not used in emacs unless you assign them

- Special keys which are the keys with lettering or symbols on them.
(eg., [DEL], [ _ ]

Introduction to Editing using emacs Appendix E - 3


VOS Fundamentals 303 Stratus®

Slide E-4
Starting an emacs session

303 - VOS Fundamentals


•• The emacs Command
The emacs Command

–– ready:
ready: emacs
emacs

•• Default emacs Buffer


Default emacs Buffer

Education
Stratus
Starting an Emacs Session

• The emacs Command

- To call up the EMACS Full Screen Editor, enter the emacs


command.
ready: emacs
- The Full Screen Editor allows you to enter and modify text while
viewing the total screen area.

• Default emacs Buffer

- When you execute the emacs command, VOS positions the cursor
in a storage area known as a buffer.
- The default buffer is the initial buffer where VOS places the
cursor. This buffer is called window1
- The default buffer is empty when you do not specify the file name
on the command line.

Appendix E - 4 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303

Slide E-5
Default emacs Buffer

Working

303 - VOS Fundamentals


Information is written here. What you see is this
Buffer

Lines 1-20

System
(letter) %class#d101>VOS_Fundamentals>vf1>letter
Area
Status
Line

Education
Stratus
Default Emacs Buffer (continued)

• The default buffer is not used when you follow the emacs command with
the filename of a specific file on the command line. emacs will create a
buffer based on the filename
ready: emacs letter

• The working area will only show 1 - 21 lines of a file at a time.

• Line 22 shows the buffer name in parenthesis followed by a pathname for


a file, if a file was loaded to the buffer.

• Lines 23 and 24 are used by emacs for prompting.

• Line 25 is the system status line.

Introduction to Editing using emacs Appendix E - 5


VOS Fundamentals 303 Stratus®
Emacs Requests

Methods of Executing Emacs Requests

• Requests in emacs are made up of key sequence requests or command


requests. There are no function keys, other than arrow keys, return,
backspace, and del key.

• All emacs key sequences have corresponding commands.

• There are some requests which just have a command and no key
sequence.

• All commands requests are preceded by the key sequence request esc-r,
which means execute command.

• All key sequences are made up of the key esc or ctrl followed by a
character.

• The ctrl key is held down when followed by a character.

• In this guide, the symbol for the ctrl key is the ^ (circumflex) symbol.
Also, key sequences that represent a two pattern key sequence or an esc
are noted with a - (hyphen).
esc-r ^x-^v

Appendix E - 6 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303

Slide E-6
Termination in emacs

303 - VOS Fundamentals


•• Terminating
Terminating aa request
request before
before itit executes
executes

•• Terminating
Terminating aa request
request while
while itit is
is executing
executing

•• Terminating
Terminating emacs
emacs

Education
Stratus
Termination in emacs

Terminating Emacs Requests

• Terminating a request before it executes is done by the request, ^ c.

- For example, when you get prompted from esc-h, you could do a
^ c and cancel that request.

• Terminating a request while it is executing is done by;


[ctrl]-[break]

- For example, a macro that executes and gets in a loop.

• Terminating emacs is done by the request ^ q or esc-q.

Introduction to Editing using emacs Appendix E - 7


VOS Fundamentals 303 Stratus®

Slide E-7
HELP
esc-h
esc-h
Subject:
Subject: <---
<---type
typeininaacommand
commandor
orpress
press[RETURN]
[RETURN]

303 - VOS Fundamentals


^@
^@ set
setmark
mark
^A
^A beginning_of_line
beginning_of_line
^B
^B backward_char
backward_char
^C
^C cancel
cancel
^D
^D delete_char_forward
delete_char_forward
^E
^E end_of_line
end_of_line
^F
^F forward_char
forward_char
^G
^G go_to_line
go_to_line
^H
^H delete_char_backward
delete_char_backward
^K
^K kill_right
kill_right
^L
^L move_line
move_line
^N
^N next_line
next_line

Education
Stratus
Help

The Emacs help will provide a listing of the key sequences and commands.

• The request for help (esc-h) will prompt you for which request you want
help on. If you type a portion of the command, it will list all requests and
commands that match that string.

- The [RETURN] key alone will list all key sequence requests followed
by their corresponding command. Some commands may not have a
key sequence.

• All output from the help request will be placed in the help buffer. Each
time you use the help request, it will overlay the previous information in
the help buffer.

• To return to your buffer, issue the request go_to_buffer, or ^x-b


followed by a [RETURN].

Appendix E - 8 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303

Slide E-8
Line of Text

303 - VOS Fundamentals


•• Length
Length of
of aa line
line of
of text
text

•• End
End of
of aa line
line of
of text
text

Education
Stratus
Line of Text

• There is no limit to the length of a line of text, (maximum record size is


32,767). If the text exceeds the terminal width size, the text will wrap
with a plus sign (+) at the beginning of the next line on the terminal.

• A hidden line-separating character defines each line of text in the emacs


buffer.

- Press the [RETURN] key when you want to end a line of text or to
create a new line. Cursor will move to the next line.
Note: ^m will do the same as [RETURN].

- ^o,open_line will open a new line, but leave the cursor in the same
location.

Introduction to Editing using emacs Appendix E - 9


VOS Fundamentals 303 Stratus®
Simple Modifications to Text

You can modify your file by positioning the cursor and inserting or deleting.

• Insert text at the cursor position.

• You can delete character in two directions either:


backward [backspace] or ^h
forward [del] or ^d

• Position the cursor on a line by the following:

- Pressing the arrow keys


up, down, left, or right

- Key requests

^f forward a character
^b backward a character
^a beginning of line
^e end of line
^n next line
^p previous line

Appendix E - 10 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303
Saving a File

Naming a File

• A file is a unit of information.

• A file can contain data, addresses, programs, etc.

• A file name consists of 1 to 32 contiguous characters alphanumeric with


upper and lower case unique.

Writing a File

You issue the write request to save the contents of your text buffer.

• Emacs will write the contents of the text buffer to permanent storage in a
file when you do any of the follow steps:

^x-^w write_file, will prompt for a file name

^x-^s save_file, will save to the current file pathname

^x-^v save_file, will save to the current file pathname

• emacs will display the path name of the file it writes.


%class#d01>VOS_Fundamentals>vf1>letter

• You can append an emacs buffer to a file with:


^x-^a
Append to pathname: Å- enter file name

Introduction to Editing using emacs Appendix E - 11


VOS Fundamentals 303 Stratus®
Writing a File with a Name

• Once you have named a file, you don't have to re-enter its name when
you write it (save it to disk). The path name becomes the default name,
making it unnecessary to re-enter the name.

1. ^x-^w

2. Prompts for path name

Output path name: [RETURN]

• There are two key request which will do the same as the above example,
and save to the current pathname.
x-^s or ^x-^v

If no pathname exist, an error will be displayed

Appendix E - 12 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303
Ending an Emacs Session

After you write the contents of the emacs buffer, you can either continue the emacs
session or you can exit it.

• Following the write_file request, the cursor returns to its position in the
emacs buffer.

• To exit the emacs session:


esc-q or ^q

• The operating system returns the cursor to the command level.


ready 12:52:15

• If you try to quit without writing the most recent changes, emacs displays
the following message:
Buffer (buffer_name) is modified Quit?

• To avoid the message, you can perform the command quit_force. All
commands are executed with the request sequence esc-r
Request? quit_force

Introduction to Editing using emacs Appendix E - 13


VOS Fundamentals 303 Stratus®

Slide E-9
Results from an emacs session

303 - VOS Fundamentals


•• Keystrokes
Keystrokes and
and Backup
Backup files
files
ready:
ready: emacs
emacs letter
letter -keystrokes
-keystrokes -backup
-backup

ready:
ready: list
list
Files: 3,
Files: 3, Blocks:
Blocks: 33
ww 11 _emacs.t13.7
_emacs.t13.7
ww 11 letter
letter
ww 11 letter.backup
letter.backup

Education
Stratus
Results from Emacs

emacs can generate several files.

• It creates and writes your text file to disk.

• The system records your emacs session keystrokes in a specific keystrokes


file if you use the -keystrokes argument in emacs.

• The system saves your previous text file if you use the -backup argument
in emacs.

Note: The operating system only stores one backup copy per file and only if the
filename is 25 characters or less.

Appendix E - 14 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303
Summary of Emacs Requests

EMACS REQUESTS
ACTIVITY REQUEST
Get help esc-h
(back to original buffer) ^x-b-[CR]

Cancel a request ^c or ^[BREAK]

Leave emacs ^q or esc-q


quit_force

Enter a new line [CR] or ^m or ^o

Delete a character: forward [BACK SPACE] or ^h


backward [DEL] or ^d

Position the cursor arrow key

forward a character ^f or ∅

backward a character ^b or ♦

beginning of line ^a

end of line ^e

next line ^n or ¬

previous line ^p or 

Save a file ^x-^w


^x-^s
^x-^v

Append to pathname ^x-^a

Introduction to Editing using emacs Appendix E - 15


VOS Fundamentals 303 Stratus®
Summary of VOS Commands

VOS COMMANDS
ACTIVITY COMMAND
ARGUMENTS

Invoke emacs emacs (3) file name


-keystroke
-backup

Appendix E - 16 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303
Lab: Introduction to Editing using emacs

Purpose: To use VOS commands to log onto the system and use basic commands
and emacs requests to create, save, and print files and also to view the results in
your home directory.

Begin this exercise after you receive your login name and password information
from your instructor:

1. Log into the system.

2. Create an emacs buffer by invoking emacs alone on the command line.

a. Is there a pathname?

What is it, and why or why not?

Is there a buffer name?

What is it, and why or why not?

b. Type a couple of short paragraphs explaining your major job


responsibilities.

c. Move around with the arrow keys and use the [RETURN] key to skip a line
between paragraphs. Also try the open_line request.

d. Use the on-line help facility to get some help on the following emacs
request: write

Introduction to Editing using emacs Appendix E - 17


VOS Fundamentals 303 Stratus®
Lab: Introduction to Editing using emacs (continued)

e. Save the document your created with the name job1 and quit the emacs
session.
Note: You are not in your original buffer.

f. List the files. Is job1 there?

g. Is there a keystrokes file? (If present, what is its name?)

3. This time, create an emacs buffer by invoking emacs with the name of a file that
does not exist, such as job2.

a. Is there a pathname?

What is it, and why or why not?

Is there a buffer name?

What is it, and why or why not?

b. Type in a couple of paragraphs that explain what you like to do when you
are not working. Again, use [RETURN], [DEL] and [BACKSPACE] to manually
format your document as you create it.

Appendix E - 18 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303
Lab: Introduction to Editing using emacs (continued)

c. When you finish, attempt to quit your emacs session without writing
(saving) the file. What does the message say?

d. Return to your emacs session.

e. Write (save) this file to disk keeping the default file name, then quit
emacs. There are 3 ways this could be done what are they?

f. List the files in your directory to be sure that job2 is there. Is it?

g. Do you have a keystroke file?

Why?

Introduction to Editing using emacs Appendix E - 19


VOS Fundamentals 303 Stratus®
Lab: Introduction to Editing using emacs (continued)

4. Modify the file job1 that you created a moment ago by invoking emacs using
both -keystrokes and the -backup arguments.

a. Move the cursor to the beginning of the second paragraph and insert a
new paragraph that explains what you would do if you won the lottery.

b. Be sure that all the paragraphs are separated by a blank line.

c. Save this file with the default name (job1) and quit the emacs session.

d. Now, list the files. Is there a keystroke file?

e. Display the contents of both job1 and job1.backup. What has happened?

Appendix E - 20 Introduction to Editing using emacs


Stratus® VOS Fundamentals 303

Slide F-1
303 - VOS Fundamentals
Appendix F
Editing
Editing Text
Text using
using emacs
emacs

Education
Stratus

Editing Text using emacs Appendix F - 1


VOS Fundamentals 303 Stratus®

Slide F-2
Objectives

303 - VOS Fundamentals


•• Move
Move the
the cursor
cursor quickly
quickly and
and easily
easily throughout
throughout
emacs.
emacs.

•• Perform
Perform efficient
efficient methods
methods of
of modifying
modifying text.
text.

•• Tabulate
Tabulate text.
text.

Education
Stratus
Objectives

When you're using emacs, file manipulation is easy. With it, you can quickly
insert, modify, or just view text. You can also move easily through a buffer by
combining the arrow keys.

At the end of this chapter, the student should be able to:

• Move the cursor quickly and easily throughout emacs.


• Perform efficient methods of modifying text.
• Tabulate text.

Appendix F - 2 Editing Text using emacs


Stratus® VOS Fundamentals 303

Slide 7-2
Moving the Cursor

•• You
You can
can move
move the
the cursor
cursor by
by groups
groups of
of characters.
characters.

303 - VOS Fundamentals


•• A
A word
word is
is aa group
group of
of alphanumeric
alphanumeric characters,
characters,
ending
ending with
with aa space.
space.

•• AA line
line is
is aa group
group of
of characters,
characters, which
which ends
ends with
with aa
line-separating
line-separating character.
character.

•• A
A screen
screen is
is the
the display
display area
area for
for text.
text.

Categories of Cursor Positioning


You can move the cursor by groups of characters.

• Word

esc-f forward, esc-b backward.

• A line is a group of characters, which ends with a line-separating


character:

^a beginning, ^e end.

Editing Text using emacs Appendix F - 3


VOS Fundamentals 303 Stratus®
Categories of Cursor Positioning (continued)

• A screen is the display area for text (80 by 20 ).

esc-a Beginning of the screen


esc-e End of the screen
esc-n Next screen
esc-p Previous screen
^L Make current line, screen top
esc-< Beginning of the buffer
esc-> End of the buffer

Appendix F - 4 Editing Text using emacs


Stratus® VOS Fundamentals 303

Slide 7-3
Move Directly to a Line

•• There
There are
are no
no line
line numbers
numbers in in emacs.
emacs. If
If you
you need
need to
to

303 - VOS Fundamentals


find
find out
out your
your location
location (line
(line number
number and
and column
column
position)
position) perform
perform thethe request count_lines or
request count_lines or
esc-=
esc-=
–– line
line 25
25 of
of 35,
35, column
column 10
10
•• There
There are
are two
two ways
ways toto position
position to
to aa line
line number,
number,
both
both ways
ways useuse the go_to_line request.
the go_to_line request.
•• Note: toggle_go_to_line_mode is
Note: toggle_go_to_line_mode is aa command
command withwith
no
no key
key sequence.
sequence. ItIt is
is only
only executed
executed by by esc-r
esc-r

Move Directly to a Line

• There are no line numbers in emacs. If you need to find out your location
(line number and column position) perform the request count_lines or
esc-=

-line 25 of 35, column 10

• There are two ways to position to a line number, both ways use the
go_to_line request.

- Use the following two requests: esc line_number ^g


Issue the command toggle_go_to_line_mode so you are
prompted when ^g is performed: ^g Line number:

Note: toggle_go_to_line_mode is a command with no key sequence. It is only


executed by esc-r

Editing Text using emacs Appendix F - 5


VOS Fundamentals 303 Stratus®

Slide 7-4
Repeating a Sequence

•• The
The esc
esc key
key is
is known
known as as the
the argument
argument parameter
parameter

303 - VOS Fundamentals


key.
key. All
All emacs
emacs requests
requests areare commands
commands issued issued by
by
key
key sequences
sequences and
and the
the commands
commands can can take
take
arguments.
arguments.
•• Emacs
Emacs repeats
repeats operations
operations by by using
using the
the esc
esc key
key
argument
argument andand typing
typing in in the
the number
number of of
occurrences.
occurrences. In In the
the system
system area
area of
of the
the screen
screen you'll
you'll
see
see the
the word
word argument
argument and and the
the number
number of of times.
times.

Repeating a Sequence Multiple Times with the Argument key

• The esc key is known as the argument parameter key. All emacs requests
are commands issued by key sequences and the commands can take
arguments. An example of this is the goto line sequence.
esc line_number ^g

• emacsrepeats operations by using the esc key argument and typing in the
number of occurrences. In the system area of the screen you'll see the
word argument and the number of times.

• An example, move the cursor 5 lines forward from where it is.


esc 5 ^n

• An example of repeating a keystroke like the * (asterisk) 80 times.

Appendix F - 6 Editing Text using emacs


Stratus® VOS Fundamentals 303
esc 80 <-- argument: 80 will be in the system area

Editing Text using emacs Appendix F - 7


VOS Fundamentals 303 Stratus®

Slide 7-5
Search for a String

•• AA search
search string
string isis the
the sequence
sequence of of characters
characters to to

303 - VOS Fundamentals


locate.
locate.
•• To
To repeat
repeat the
the last
last request,
request, issue
issue the
the key
key sequence
sequence
^s..
^s

•• Modify
Modify thethe search
search pattern
pattern is
is by
by doing
doing aa
yank_prompt esc-y..
yank_prompt esc-y
•• To
To perform
perform aa caseless
caseless search,
search, you
you need
need to
to set
set the
the
caseless
caseless mode
mode on on set_mode caseless_search on.
set_mode caseless_search on.

Search for a String

• A search string is the sequence of characters to locate. A search string


must all be on the same line. The search begins at the cursor and stops at
the first occurrence. It looks for the exact match. There are two search
directions.
^s or esc-s
Search:
^r
Reverse search:

• To repeat the last request, issue the key sequence ^s.

Appendix F - 8 Editing Text using emacs


Stratus® VOS Fundamentals 303
Search for a String (continued)

• Modify the search pattern is by doing a yank_prompt.


^s
Search ('apple'): esc-y
^-- this will yank apple into the prompt so it can be modified

• To perform a caseless search, you need to set the caseless mode on


set_mode caseless_search on.

Editing Text using emacs Appendix F - 9


VOS Fundamentals 303 Stratus®

Slide 7-6
Global Search and Replace

•• To
To replace
replace each
each occurrence
occurrence of of aa string
string from
from the
the

303 - VOS Fundamentals


current
current cursor
cursor position
position to
to the
the end
end ofof the
the buffer,
buffer,
press:
press:
esc-^r
esc-^r
Replace:
Replace: <--
<-- enter
enter the
the search
search pattern
pattern
Replace
Replace 'search pattern' by : <-- enter
'search pattern' by : <-- enter the
the
replace string
replace string

–– The
The replace
replace command
command queries
queries you
you with
with aa list
list of
of 44
choices
choices

Global Search and Replace

You can replace each occurrence of a string in the buffer with another string.

• To replace each occurrence of a string from the current cursor position to


the end of the buffer, press:
esc-^r
Replace: <-- enter the search pattern
Replace 'search pattern' by : <-- enter the replace string

• The replace command queries you with a list of 4 choices:

space bar to replace that match


. (period) to replace and stop
cr (carriage return) to skip
! (exclamation) to reset ALL matches
^c to abort the global replace

Appendix F - 10 Editing Text using emacs


Stratus® VOS Fundamentals 303

Slide 7-7
Altering Text

•• Overlay
Overlay

303 - VOS Fundamentals


–– You
You modify
modify text
text in
in the
the text
text buffer
buffer by
by inserting
inserting or
or by
by
overwriting
overwriting the
the text.
text.

•• Changing
Changing to
to Upper/Lower
Upper/Lower Case
Case
–– Changing
Changing case
case to
to altering
altering text
text can
can be
be done
done in
in several
several
ways:
ways:

Overlay
You modify text in the text buffer by inserting or by overwriting the text.

• The insert mode (default mode) adds characters to the text. Insert text
by positioning the cursor on a line and typing the new characters.
• You can type over characters under the cursor in the overlay mode. This
mode is set by the command toggle_overlay_mode: esc- or esc-r.
To return to insert mode, issue the command again

Changing to Upper/Lower Case


Changing case to altering text can be done in several ways:

• Changing the case of the whole word

esc-u Upper case


esc-L Lower case
• Capitalizing a word: esc-c First letter of a word

Editing Text using emacs Appendix F - 11


VOS Fundamentals 303 Stratus®

Slide 7-8
Deleting and Copying Text

•• Marking
Marking Text
Text

303 - VOS Fundamentals


•• Deleting
Deleting Text
Text

•• Copying
Copying Text
Text

Marking Text

• To work with a region of text, you need to set a mark. ^@


• Once the mark is set move your cursor to another location. From this
point to the mark, you can delete or save that text.
• Check the boundaries of a marked region with exchange_point_mark ^x-^x

Deleting Text

• Word deletion: esc-d forward, esc-^h backward


• Line deletion: ^k right, ^] left
• Block deletion: ^w

Copying Text

• Copying Text: ^esc-w copies a region based on the mark

Appendix F - 12 Editing Text using emacs


Stratus® VOS Fundamentals 303

Editing Text using emacs Appendix F - 13


VOS Fundamentals 303 Stratus®

Slide 7-9
Retrieving Text

•• Retrieve
Retrieve the
the text
text from
from the
the head
head of
of the
the kill
kill ring
ring

303 - VOS Fundamentals


with
with the
the yank
yank request.
request.

•• To
To yank
yank aa previous
previous item
item in
in the
the kill
kill ring.
ring.

•• To
To discard
discard what
what is
is at
at the
the head
head of
of the
the kill
kill buffer.
buffer.

•• You
You can
can merge
merge kills
kills together.
together.

Retrieving Text

The kill ring is set up for the retrieval of text. This buffer can not be viewed,
edited, or saved to a file. However you can cycle among the 10 items on the kill
ring.

• Retrieve the text from the head of the kill ring with the yank request, ^y.

• To yank a previous item in the kill ring, leave the cursor at the beginning
of the previous yank and use the wipe_and_yank_previous request
esc-^y.

• To discard what is at the head of the kill buffer so you can yank the next
item, use the request delete_last_kill, esc-^k

Appendix F - 14 Editing Text using emacs


Stratus® VOS Fundamentals 303

Slide 7-10
Formatting Text - Tabs

•• Tabs
Tabs

303 - VOS Fundamentals


•• Relative
Relative Tabbing
Tabbing

Formatting Text

Tabs

• The default tab positions are set every five spaces apart. [TAB] Move the
cursor along a line according to the default tab stop.

Relative Tabbing

• Relative tabbing allows the cursor to move quickly from one column to
another. \
• Before using, you have to set up the spacing for the first line of data.
(Relative tab positions are determined by the previous line spacing
between the characters).
• To enter the succeeding columns, press: esc-[TAB]

Editing Text using emacs Appendix F - 15


VOS Fundamentals 303 Stratus®

Summary of Editing Text Using Emacs

EMACS REQUESTS
ACTIVITY REQUEST
Move through the buffer forward esc-f
backward esc-b
beginning ^a
end ^e
Beginning of the screen esc-a
End of the screen esc-e
Next screen esc-n
Previous screen esc-p
This line to screen top ^L
Beginning of the file esc-<
End of the file esc->
Display line number esc-=
Go to line number esc line_number ^g
Repeat request esc number
Search for a string: forward ^s or esc-s
reverse ^r
Turn on caseless search esc-r
Request: set_mode casesless_search
on
Yank a prompt esc-y
Global search and replace esc-^r
Insert/Overlay text esc-_
Changing word case: UPPER esc-u
lower esc-L
Initial esc-c

Appendix F - 16 Editing Text using emacs


Stratus® VOS Fundamentals 303
Summary of Editing Text Using Emacs (continued)

EMACS REQUESTS (continued)


ACTIVITY REQUEST
Delete text forward a word esc-d
backward a word esc-^h
right of the cursor ^k
left of the cursor ^]
region of text ^@ move cursor ^w

Copy text ^@ move cursor esc w


Yank text ^y
Yank previous kill ring text esc-^y
Discard item from kill ring esc-^k
Merge next with previous kill esc-^w
Tabulate text [tab]
esc-[tab]

Editing Text using emacs Appendix F - 17


VOS Fundamentals 303 Stratus®
Lab: Editing Text using emacs

Purpose: To practice using emacs requests to efficiently move within an edit


buffer, to modify text and use tabs.

1. In your directory there is a file named abbreviations. Invoke emacs with the
name of this file.

a. Use the arrow keys to move up, down, right and left in this file until you
feel comfortable. Remember [shift] arrow keys as well.

b. Use the key sequences that will do the same as step a.


left and right arrow = ____________________________
up and down arrow = ____________________________
shift left and right =_____________________________
shift up and down = _____________________________

c. Turn on the line_number prompt.

d. Move to the last line in the screen with the request__________ Move to
last line in file with the request __________________

e. Move to the top of the screen with the request _____________ Move to
the top of the file with the request _______________

f. Use the request to go to line 50 of the file. What does this line of text
say?___________________________________________________
There are two ways step f could have been done what are they?

g. What request will verify your location? __________________

h. When you are finished, quit this emacs session.

Appendix F - 18 Editing Text using emacs


Stratus® VOS Fundamentals 303

Lab: Editing Text using emacs (continued)

2. The following exercise allows you to practice searching techniques. Invoke


emacs with the file, Ada/ADA, then:

a. Do a case-sensitive search forward for every occurrence of the woman's


name, 'Ada '. (Include "Ada's" in your count.) How many did you
find?______

b. Do a case-sensitive search in reverse for every occurrence of the acronym


'ADA' (American Dental Association). How many did you
find?__________

c. Lastly, go to the top of the buffer, then do a caseless search of the


document to find every occurrence of the string 'ada' (regardless of
location). How many did you find?___

d. When you are finished, quit this emacs session.

3. Edit a file named computers_and_technology The following exercise


demonstrates global searching techniques.

a. Globally search this document and replace every occurrence of


'technology' with 'TECHNOLOGY'.

b. Again, globally search this document and change every occurrence of the
word 'computer' to 'COMPUTER'.

c. Lastly, do a global search and replace with a query to selectively change


every other 'COMPUTER' back to 'computer'. How many replacements
did you make in the file?

Editing Text using emacs Appendix F - 19


VOS Fundamentals 303 Stratus®

Appendix F - 20 Editing Text using emacs


Stratus® VOS Fundamentals 303

Slide G-1
303 - VOS Fundamentals
Appendix G
Emacs
Emacs Timesaving
Timesaving Techniques
Techniques

Education
Stratus

Emacs Timesaving Techniques Appendix G - 1


VOS Fundamentals 303 Stratus®

Slide G-2
Objectives

303 - VOS Fundamentals


•• Define
Define macros.
macros.
•• Read
Read several
several files
files into
into an
an emacs
emacs session.
session.
•• Display
Display files
files in
in several
several windows.
windows.
•• Create
Create new
new key
key requests.
requests.
•• Execute
Execute system
system commands
commands from from emacs.
emacs.
•• Set
Set emacs
emacs switches
switches thatthat are
are suitable
suitable for
for them.
them.

Education
Stratus
Emacs Timesaving Techniques

This chapter covers some of the techniques that make emacs easier for you. This
section demonstrates how to combine basic techniques to create macros, bring
several files into one emacs session, and to issue system commands without
leaving your emacs session.

At the end of this chapter, the student should be able to:

• Define macros.
• Read several files into an emacs session.
• Display files in several windows.
• Create new key requests.
• Execute system commands from emacs.
• Set emacs switches that are suitable for them.

Appendix G - 2 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-2
Macros in emacs

•• Macro
Macro Description
Description

303 - VOS Fundamentals


–– AA macro
macro isis aa series
series of
of keystrokes
keystrokes that
that execute
execute as
as one
one
request
request (a
(a script).
script). Macros
Macros consist
consist of
of emacs
emacs requests,
requests,
commands, and
commands, and text.text.

•• Implementing
Implementing macros
macros

•• Executing
Executing macros
macros

• Implementing macros

Define the macro by:

1. esc-( <-- starts the recording


2. perform your key requests
3. esc-) <-- end the recording

When you end the macro, the macro is stored in the macro buffer. Only
one macro can be in the (unnamed) macro buffer.

• Executing macros

1. esc-m <-- executes what is in the macro buffer


2. esc-r
3. Request: macro_name <-- executes a saved macro.

Emacs Timesaving Techniques Appendix G - 3


VOS Fundamentals 303 Stratus®

Slide 8-3
Macros in emacs (continued)

•• Macro
Macro commands
commands

303 - VOS Fundamentals


•• All
All macros
macros are
are found
found in
in aa file
file called
called
emacs_keystroke_macros under aa users
emacs_keystroke_macros under users home
home
directory.
directory.

Macros in emacs (continued)

• Macro commands

- If you never save the macro buffer to a macro name, then that
macro is gone when you leave emacs

- The execute request (esc r) will execute the following


commands:

save_macro: saves the macro buffer to a name


list_macros: will show you a list of saved macros
delete_macro: will delete a saved macro
show_macro: will display to a buffer what the macro will do

• All macros are found in a file called emacs_keystroke_macros under a


users home directory.

Appendix G - 4 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303
Macros in emacs (continued)

Macro that Writes and Quits

In emacs, when you save a file, it does not quit nor does it have a command that
will do a save and quit, so here is a perfect example of using a macro to combine
some keystrokes

The following steps will define a write and quit macro

1. Enter emacs with two files

2. Modify both buffers with the files.

3. Now start recording the macro, esc (

4. Issue the request save_file , ^x^v

5. Issue the request quit, esc q or ^q

6. Emacs will respond with a question, type in n

7. Stop recording the macro, esc )

8. Issue the command save_macro; when prompted, give it a name, for example:
write_quit

9. Now change to the other modified buffer and test.

Emacs Timesaving Techniques Appendix G - 5


VOS Fundamentals 303 Stratus®

Mapping Keys to Requests and

Slide 8-4
Macros
•• You
You execute
execute aa macro
macro by
by the
the execute
execute request
request ((esc
esc rr))

303 - VOS Fundamentals


sequence
sequence followed
followed by
by the
the macro
macro name,
name, but
but you
you can
can
simplify
simplify things
things by
by mapping
mapping your
your macro
macro or
or other
other
requests
requests to
to undefined
undefined key
key sequences.
sequences.

•• Mapping
Mapping requests
requests and
and macros
macros is
is done
done by
by the
the
command set_key .. However
command set_key However you
you need
need to
to know
know the
the
key
key sequence
sequence so
so you
you can
can map
map the
the request.
request.

Mapping Keys to Requests and Macros

• Mapping requests and macros is done by the command set_key.


However you need to know the key sequence so you can map the request.

- Interpreting key sequences is performed by esc ?

esc-?
esc-t <-- type in the sequence
esc-t = undefined

- Another way to find out what the key sequence is by esc `

esc-`
F1 <-- Press the function key
`01a
^x-^
^AA <-- Emacs interprets the data

Appendix G - 6 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Mapping Keys to Requests and

Slide 8-5
Macros (continued)
•• Assigning
Assigning aa key
key has
has several
several rules.
rules.

303 - VOS Fundamentals


–– The
The sign
sign for
for control
control isis ^^ (circumflex)
(circumflex)
–– The
The sign
sign for
for escape
escape isis the
the word
word esc
esc upper
upper or
or lower
lower
–– To
To string
string two
two key
key sequences
sequences together
together use
use aa –– (hyphen)
(hyphen)
–– You
You cancan distinguish
distinguish upper
upper fromfrom lower
lower case
case letters
letters with
with
the
the `` (accent
(accent grave)
grave) character.
character. Otherwise
Otherwise case
case doesn't
doesn't
matter.
matter.
esc-r
esc-r
Request:
Request: set_key
set_key
Key
Key name:
name: ^A-A
^A-A
Request
Request name:
name: write_quit
write_quit

Mapping Keys to Requests and Macros (continued)

Assigning a key has several rules.

• The sign for control is ^ (circumflex)

• The sign for escape is the word esc upper or lower

• To string two key sequences together use a – (hyphen)

• You can distinguish upper from lower case letters with the ` (accent
grave) character. Otherwise case doesn't matter.
esc-r
Request: set_key
Key name: ^A-A
Request name: write_quit

Emacs Timesaving Techniques Appendix G - 7


VOS Fundamentals 303 Stratus®

Slide 8-6
Defining Multiple Buffers

•• Create
Create Several
Several Buffers
Buffers for
for Existing
Existing Files
Files

303 - VOS Fundamentals


•• Display
Display Listing
Listing of
of Buffers
Buffers
letter1: (current)
%educ#d102>Education>Al_Rizo>letter1

letter2:
%educ#d102>Education>Al_Rizo>lette2

window1:

buffer list:

(buffer list) __________________________________

Create Several Buffers for Existing Files

• You may use multiple buffers to edit several files during the same emacs
session.

• There is no limit to the number of buffers.

• You can create several buffers by specifying the file names that you wish
to edit on the command line.
emacs letter1 letter2

• The operating system creates a buffer for each file and gives this the
same name as the file. There is one default buffer called window1. This
buffer is not used when a file name is given.

Display Listing of Buffers


• To list the buffers issue the request ^x-^b

Appendix G - 8 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Move to an Existing Buffer

Slide 8-7
Create a New Buffer
•• Move
Move to
to an
an Existing
Existing Buffer
Buffer

303 - VOS Fundamentals


–– You
You can
can move
move the
the cursor
cursor between
between existing
existing buffers
buffers with
with aa
menu
menu request.
request.

•• Create
Create aa New
New Buffer
Buffer

Move to an Existing Buffer

• The buffer request will always toggle between the current buffer and the
previous buffer examined. If the buffer you want is not shown inside the
prompt then type in the buffer name.

• To change to a different buffer: ^x-b


Buffer name (letter2):

• Another way is by selection from the list.

1. ^x-^b will list the buffers


2. move your cursor to the buffer you want to change to
3. ^x-b will change buffers and the prompt will default

Emacs Timesaving Techniques Appendix G - 9


VOS Fundamentals 303 Stratus®
Move to an Existing Buffer (continued)

Create a New Buffer

• To create a new buffer: ^x-b

Buffer name(letter2):

Give a new name.

*A buffer name can be 32 characters long

Appendix G - 10 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Read a File into the Buffer

Slide 8-8
Changing Buffers
•• Read
Read aa File
File into
into the
the Text
Text Buffer
Buffer

303 - VOS Fundamentals


^x-^r
^x-^r
Input
Input pathname:
pathname: <---
<--- type
type existing
existing file
file name
name

•• Changing
Changing Buffers
Buffers and
and Read
Read aa File
File Automatically
Automatically
^x-^f
^x-^f
Filename: <---
Filename: <--- type
type existing
existing file
file name
name

Read a File into the Text Buffer

You can read an existing file into the emacs buffer.

• To insert the file at the cursor's position:


^x-^r
Input pathname: <--- type existing file name

Type in the name of an existing file at the prompt.


Give your own name to a buffer by using ^x-b, then read in the file
^x-^r.

Changing Buffers and Read a File Automatically


Within the emacs session, you can create additional buffers and read files into
them with one request.
^x-^f

Emacs Timesaving Techniques Appendix G - 11


VOS Fundamentals 303 Stratus®
Filename: <--- type existing file name

Appendix G - 12 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Accessing Text and Performing

Slide 8-9
Requests
•• Define
Define the
the search
search string
string using ^s or
using ^s or esc-s
esc-s

303 - VOS Fundamentals


–– Move
Move to to any
any buffer
buffer and
and search
search using
using the
the default
default search
search
string.
string. ((^s
^s will
will show
show the
the default
default pattern
pattern in
in the
the prompt)
prompt)

•• You
You can
can retrieve
retrieve text
text copied
copied or
or deleted
deleted to
to the
the kill
kill
ring
ring regardless
regardless of
of which
which buffer
buffer itit came
came from.
from.
–– Move
Move to
to any
any buffer
buffer and
and yank
yank the
the text
text from
from the
the ring.
ring.

Accessing Text and Performing Requests Between Buffers

You can perform any requests in a buffer then change buffers and repeat the
request in the other buffer. For example, search for the same string of characters
throughout different buffers.

Emacs Timesaving Techniques Appendix G - 13


VOS Fundamentals 303 Stratus®

Slide 8-10
Save Contents of Buffers

•• The
The cursor
cursor must
must be be in
in aa buffer
buffer toto save
save its
its contents.
contents.

303 - VOS Fundamentals


•• With
With multiple
multiple buffers,
buffers, youyou must
must move
move into
into each
each
one
one and
and write
write its
its contents
contents to to aa file.
file.
•• Note:The
Note:The system
system does
does not
not say
say which
which buffer
buffer needs
needs
to
to be
be saved.
saved.
•• The
The list_buffer
list_buffer request (^x-^b) displays
request (^x-^b) displays
(modified)
(modified) for
for each
each modified
modified buffer
buffer not
not yet
yet
written
written to
to disk.
disk.

Save Contents of Buffers

The cursor must be in a buffer to save its contents.

With multiple buffers, you must move into each one and write its contents to a file.
If you attempt to exit without saving a modified buffer, then the system prompts
you.
N buffers are modified and not written. Quit anyway?

Note: The system does not say which buffer needs to be saved. and N is the
number of buffers that need to be written.

The list buffer displays (modified) for each modified buffer not yet written to disk.

Appendix G - 14 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-11
Defining Multiple Windows

•• AA default
default window
window is is always
always present,
present, window1.
window1.

303 - VOS Fundamentals


•• You
You can
can divide
divide aa window
window (horizontally)
(horizontally) into
into
smaller
smaller windows.
windows.
•• Define
Define windows
windows to to see
see different
different buffers
buffers atat one
one
time.
time.
•• Define
Define windows
windows to to see
see different
different views
views of
of the
the same
same
buffer.
buffer.
•• Three
Three ways
ways to
to create
create window
window

Defining Multiple Windows

Describing Windows

A window is the display area for the contents of a buffer.

A default window is always present, window1.


You can divide a window (horizontally) into smaller windows.
Define windows to see different buffers at one time.
Define windows to see different views of the same buffer.
Three ways to create window
Dynamically while in emacs.
At the command line when you invoke emacs.
Automatically while in emacs by certain requests.

Emacs Timesaving Techniques Appendix G - 15


VOS Fundamentals 303 Stratus®

Defining Multiple Windows

Slide 8-12
(continued)
•• Create
Create Windows
Windows inside
inside emacs
emacs

303 - VOS Fundamentals


•• Create
Create Windows
Windows When
When Invoking
Invoking emacs
emacs

Create Windows inside emacs

Create the window by using the request add_window ^x-a

• Emacs will determine the size of the window. All windows are created
of equal size. (^x-+ and ^x-- can be used to grow/shrink)
• The cursor is moved to the newly created window.
• The windows are called (window n), n is the window number.
• The windows are unassigned to a buffer. When inside a window issue
the request go_to_buffer, ^x-b, to assign a buffer.

Some requests automatically create a window and load a file into it, e.g.
read_error_file, ^x-^e and find_include_file , ^x-^i

Create Windows When Invoking emacs


At any time, you can use the emacs requests to create more windows.
On the command line, use num_windows and a number.

Appendix G - 16 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Defining Multiple Windows

Slide 8-13
(continued)
•• Using
Using aa Window
Window

303 - VOS Fundamentals


•• Delete
Delete aa Window
Window

Using a Window

To move from window to window:

^x-p prev_window
^x-n next window

As you move from window to window the system area will update to inform you
of the window location.

Delete a Window

To delete a window, position the cursor in the window to be deleted: ^x-d


When a window is deleted, the buffer that was displayed in that window remains
unchanged, but not displayed.
To delete all but one window, position the cursor in the window you WANT and
issue the request: ^x-1

Emacs Timesaving Techniques Appendix G - 17


VOS Fundamentals 303 Stratus®

Slide 8-14
Setting emacs Mode

•• To
To see
see the
the current
current mode
mode setting:
setting: show_modes
show_modes

303 - VOS Fundamentals


•• Set
Set emacs
emacs mode
mode variables
variables with
with the
the command
command
set_mode.. If
set_mode If omitted,
omitted, emacs
emacs will
will prompt
prompt you
you for
for
the
the mode
mode variable
variable and
and setting.
setting.

Setting Emacs modes

There are several modes that can be set in emacs to select different emacs
interfaces. For example, you can select overlay instead of insert mode.

• To see the current mode setting: show_modes

cr_insert: off
go_to_line_ask: off
overwrite_ask: off
Current EMACS buffer modes for 'buffer list'
overlay: off
uppercase: off
tab_size: 5

• Set emacs mode variables with the command set_mode. If omitted, emacs
will prompt you for the mode variable and setting.
esc-r
Request: set_mode overwrite_ask on
New setting: on

Appendix G - 18 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303
Emacs start_up files

Emacs allows you to tailor its environment allowing you to redefine key sequences
or create function keys that execute macro scripts. However when you leave
emacs you lose that tailored environment. This is where start_up files can be
helpful.

• The default file for emacs is called start_up.emacs in your home


directory.

• To use another start_up file issue the argument


-start_up_path
emacs letter -start_up_path start_up_memo.emacs

• A start_up file has a few specific commands and formats

Documentation lines are noted by /*

Any emacs commands is allowed in a start_up file. These are some


typical ones:
execute_request
set_key
set_mode

Below is an example of a start_up.emacs file


/* start_up for emacs
/* global emacs variable settings
set_mode overwrite_ask on
set_mode go_to_line_ask on
/* set emacs request to function keys
/* shift F8
set_key ^A-h help
/* set macro to keys
set_key ^X-`q write_quit_buffers

Emacs Timesaving Techniques Appendix G - 19


VOS Fundamentals 303 Stratus®

Slide 8-15
Programmers Tools

•• read_error_file
read_error_file ^x-^e
^x-^e

303 - VOS Fundamentals


•• find_include_file
find_include_file ^x-^i or
^x-^i or ^x-tab
^x-tab

Programmers Tools

read_error_file ^x-^e
Attempts to find a file with the same entry name as the current window and a
suffix of .error.
Splits and loads the .error file in the bottom window.
This can also be done from the command line by using:
emacs prog1.c prog1.error -num_windows 2

find_include_file ^x-^i or ^x-TAB


Prompts you to enter the name of the include file to find.
If the cursor is on a source line with an include enter cr.
You only need to specify the root of the name.
Include library paths provide the directories to be searched.
Splits and loads the include file in the bottom window.

Appendix G - 20 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303
Programmers Tools (continued)

Using Macros to Find Compiler Errors

Using macros to create a keystroke sequence to locate the line numbers where
programming errors have occurred and then position your cursor in the source code
at the beginning of those lines is easy when you have an error window. Below are
the key sequence steps. The assumption is you have 2 windows. The source code
is in the top window, and errors are in the bottom window.

1. Start recording the macro, ESC-(


2. Change to the bottom window, ^x-n
3. Search for the word LINE, ESC-s LINE [CR]
4. Forward a character, ^f
5. Set a mark, ^@
6. Move forward a word, ESC-f
7. Copy the region marked capturing the line number, ESC-w
8. Move back to the previous window, ^x-p
9. Set the ask mode on, ESC-r set_mode go_to_line_ask on [CR]
10. Goto line request, ^g
11. Yank the line number back, ^y [CR]
12. Set the ask mode off for the next time,
ESC-r set_mode go_to_line_ask off [CR]
13. Stop recording the macro, ESC-)
14. Issue the request execute sequence, ESC-r
15. Issue the command to save the macro, save_macro
16. When prompted name the macro, find_error [CR]

Note: The statements that use set_mode may not be needed if you use set_mode
go_to_line_ask on in your start_up file.

Emacs Timesaving Techniques Appendix G - 21


VOS Fundamentals 303 Stratus®

Slide 8-16
Programmers Tools (continued)

•• Finding
Finding Declarations
Declarations

303 - VOS Fundamentals


•• Finding
Finding PL/I
PL/I Declarations
Declarations

Finding Declarations

If you are a PL/I, C or Pascal programmer using VOS s$ subroutines here is a way
to declare your routines:
Type in your routine name in and then issue the request declare_subroutine, ^z-d,
which will do the following:
• Reads the name of the routine near the cursor
• Searches in the Lang declaration buffer for the declaration
• Copies the found declaration into the current buffer.

Finding PL/I Declarations

declare s$attach_port <-- Type in ^z-d after the routine


The result:
declare s$attach_port entry(char(32) var, char(256) var,bin (15),
bin(15), (bin(15));

Appendix G - 22 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-17
Programmers Tools (continued)

•• Using
Using the
the request,
request, match_parens, ^x-^m or
match_parens, ^x-^m ^x-cr will
or ^x-cr will

303 - VOS Fundamentals


attempt
attempt to
to move
move your
your cursor
cursor to
to the
the next
next
corresponding
corresponding character.
character.

•• For
For quotation
quotation marks
marks ('(' and
and ")
") only
only matches
matches in
in aa
forward
forward direction.
direction.

Assistance in Matching Parentheses

Nothing is more frustrating than having an unbalanced parentheses or brace in your


program and not being able to find it.

Using the request match_parens, ^x-^m or ^x-cr, will attempt to move your
cursor to the next corresponding character.

• If no matching character is found then the error


No matching character found is displayed
• Symbols that will be balance matched:
(, ), <, >, [, ], {, }, ' or "
• Nesting is accounted for; therefore the matched character is always at the
same nesting level as the initial character.

For quotation marks (' and ") only matches in a forward direction.

Emacs Timesaving Techniques Appendix G - 23


VOS Fundamentals 303 Stratus®
Rebuilding an emacs Session

Someday you will be faced with losing your emacs session. This may be do to
user error, system failure, communication failure, or whatever. You'll need to
know how to playback your emacs keystroke file.

Your keystroke file is called _emacs.terminal_name

Emacs doesn't build a file without -keystroke.

The following steps will show you how to playback keystroke file:

1. Find your emacs file , list _emacs.(terminal_name)


2. Rename the file, rename _emacs.(terminal_name) playback
3. Invoke emacs, emacs filename <-- if originally used
4. Issue the request apply_keystroke, ^z-a
5. When prompted give the renamed file, playback

Before step 3 you may need to edit the keystroke file if the user had entered the
quit request and that is the reason for recovery.

- Use toggle_ctl_char_mode to see the key sequences be modified.


- Use insert_literal to insert a key sequence

Appendix G - 24 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Slide 8-18
VOS Tools

•• Clearing
Clearing messages
messages while
while in
in emacs
emacs

303 - VOS Fundamentals


–– The
The status
status line
line can
can be
be cleared
cleared by
by the
the request
request
clear_status_line,
clear_status_line, ^x-s
^x-s

–– The
The terminal
terminal can
can bebe cleared
cleared of
of messages
messages (AKA
(AKA
redisplayed)
redisplayed) by
by the
the request
request redisplay,
redisplay, ^v
^v

VOS Tools

Clearing messages while in emacs

Emacs Timesaving Techniques Appendix G - 25


VOS Fundamentals 303 Stratus®

Slide 8-19
Executing Commands

•• To
To execute
execute aa command,
command, give
give the
the request, ^x-c..
request, ^x-c

303 - VOS Fundamentals


•• The ^x-c request
The ^x-c request and
and wait
wait for
for output,
output, has
has 44
arguments
arguments

Executing Commands

To execute a command, give the request, ^x-c.


Emacs will wait for command to finish executing.
Output results are displayed and user is in default_output

The ^x-c request and wait for output, has 4 arguments:


If you specify NO argument emacs will invoke a process to execute the
command.
If you specify 1 as an argument emacs will invoke a privileged process to
execute the command.
If you specify 2 as an argument emacs will invoke a non-privileged process,
and prompt for command and module
If you specify 3 as an argument emacs will invoke a privileged process, and
prompt for command and module

Appendix G - 26 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303

Executing Commands

Slide 8-20
(continued)
•• The
The execute_command
execute_command request
request and
and don't
don't wait
wait for
for

303 - VOS Fundamentals


output
output
•• The
The request
request ^x-c,
^x-c, has
has 22 ways
ways to
to pass
pass arguments
arguments toto
the
the request
request

Executing Commands (continued)

The execute_command request and don't wait for output has 4 arguments:
If you specify 4 emacs will not wait for the command to finish, but return back
to the buffer so you can continue editing.
If you specify 5 as an argument emacs will invoke a privileged process to
execute the command.
If you specify 6 as an argument emacs will invoke a non-privileged process,
and prompt for command and module name*
If you specify 7 as an argument emacs will invoke a privileged process, and
prompt for command and module name.
All results goto a buffer default_output.n , where n is the buffer number.
The request ^x-c, has 2 ways to pass arguments to the request
Using the execute_request command, esc-r
Request: execute_command 2
Using the argument parameter key esc-number
esc-2
^x-c

Emacs Timesaving Techniques Appendix G - 27


VOS Fundamentals 303 Stratus®

Slide 8-21
VOS Tools

•• Creating
Creating aa sub_process
sub_process

303 - VOS Fundamentals


•• Changing
Changing your
your current
current location
location

Creating a sub_process
You can create a sub_process by the request login_process, ^x-l, this is useful
when you need to invoke other Stratus utilities and don't want to leave emacs.

Emacs is suspend until logout is issued. This will return you back to the emacs
session.

Changing your current location


You may need to read in several files and they may not be in your current location,
You can issue the command change_current_dir using esc-r
The command will prompt for location
Default location is home directory
All pathnames assigned to the emacs buffers stay the same

Appendix G - 28 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303
Summary of Emacs Timesaving Techniques

EMACS REQUESTS
ACTIVITY REQUESTS
List all buffers ^x-^b
Create/switch buffers ^x-b
Read file into a buffer ^x-^r
Read a file into a new buffer ^x-^f

Create a new window ^x-a


Move to a window ^x-p
^x-n
Delete a window ^x-d
^x-1

Show current modes esc-r show_modes


Change a mode esc-r set_mode mode [on | off | toggle]

Start creating a macro esc-(


Stop creating a macro esc-)
Execute macros esc-m
Save a macro esc-r save_macro macro_name
Execute a named macro esc-r macro_name
List macro names esc-r list_macros
Display macro steps esc-r show_macro macro_name
Delete a macro esc-r delete_macro macro_name
Explain a keystroke esc-?
Set command/macro to a key esc-r set_key name key_sequence
Insert a literal esc-`

Find/read error file ^x-^e


Find/read include file ^x-^i

Expand a routine declaration ^z-d


Match paired characters ^x-CR or ^x-^m

Emacs Timesaving Techniques Appendix G - 29


VOS Fundamentals 303 Stratus®
Summary of Emacs Timesaving Techniques (continued)

EMACS REQUESTS
ACTIVITY REQUESTS
Apply a keystroke file ^z-a

Clear status line ^x-s


Redisplay the screen ^v

Execute system commands ^x-c


esc-r execute_command type
Create a sub-process ^x-L

Change your current dir esc-r change_current_dir pathname

Appendix G - 30 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303
Lab: Emacs Timesaving Techniques

1. First, list the files in your directory to see if you have a file named
emacs_keystroke_macros Is it there?____________________

2. Begin an emacs session. Create a shorthand which contains the following


moduleheader

Company Proprietary Software


Created by your name\ ❐ <-- cursor should be here

From:

Name this macro memo.

3. Change to a new buffer called demo and issue the macro memo.
Two ways this macro could be issued:

Also write the file to a file called module_demo.

4. Create a start_up.emacs file and place the request that will execute the macro
memo when you bring up emacs.

5. Change your start_up.emacs file so the key ^x-m will do a save_file and quit
out of emacs. Also remove the last entry from step 4

6. There are four sample files in your directory named: trout_almondine, rice,
asparagus, and tarts. Use the read_file request to combine them all into a new
file called dinner.

Emacs Timesaving Techniques Appendix G - 31


VOS Fundamentals 303 Stratus®
Lab: Timesaving Techniques (continued)

7. Invoke emacs with the file dinner. Append this buffer to the file memo_demo.
Change buffers and read the file memo_demo in to see what the file looks like.

8. Use the -num_windows option on the emacs command to load copies of the
files, addresses and names, into separate windows on your screen.

a. Use the kill and the yank requests to copy the respective addresses from
the address window into their proper location in the names window.

b. Once you are finished, save the modified buffer under the title of
addresses_names.

c. Quit the emacs session and print out a copy of the file, addresses_names,
to be sure you performed the steps correctly.

9. Create a macro that will go to the bottom window which will have the line
numbers of errors to the above window (which has a program).

Use the -num_windows argument of the emacs command to load the files,
bad.cobol and bad.error, into two separate windows on the screen. (Be sure
that bad.cobol is in the default buffer before you continue with the following
tasks.)

After the macro has been created quit out of emacs and test your macro from
scratch.

Appendix G - 32 Emacs Timesaving Techniques


Stratus® VOS Fundamentals 303
Lab: Timesaving Techniques (continued)

10. Invoke emacs with the name of a non-existing file called new.

a. Type in the following statement: Now that I am almost finished with


the Emacs course, I would like a list of the files in my directory.

b. Using the request to issue a command, issue the command list. The
request should wait for the output of the executing system command.

c. Copy the list of files into your previous buffer, to make step a true.

d. Once you have done this, position the cursor at the end of the buffer
(new) and type in the following statement: These are abbreviations
that I can use on the command line.

e. Using the request to issue a command, issue the command display


abbreviations. The request should not wait for the output to finish but
return you to your current buffer.

f. When you are ready, go to the buffer that contains the abbreviations.
Copy the abbreviations into your previous buffer, to make step f true.

g. Save the file and quit the emacs session.

11. Invoke emacs with keystrokes. Make some changes to the buffer (window1 if
your using the default) but quit without saving the changes. Replay your
keystrokes to make the changes and save the buffer to a file.

Emacs Timesaving Techniques Appendix G - 33

You might also like