editor.r Command/Editor, system.security.article Article/Article, programming.using.up Article/Article, up Introductory/Update Processor, vi Definition/Unix, editor.^ Command/Editor

editor.r

Command editor.r Command/Editor
Applicable release versions: AP, R83
Category Editor (43)
Description replaces the current line, or replaces a string of characters within the current line, or replaces a string of characters within a specific range of lines.

Only the first occurrence of the string referenced in "old.string" is replaced with the string referenced in "new.string". The "ru" form replaces all occurrences.

If the "#lines" parameter is specified, the line pointer is incremented accordingly.

An "r" command, followed by a <return>, allows the replacement of an entire line. Entering a <return> at the first position of the line returns control to the editor command prompt and the line remains unchanged.

The "start.col" and "end.col" parameters respectively indicate the beginning and ending column ranges in which strings are eligible for replacement. See the "c" command for determining column ranges.

If the "old.string" parameter is null, the "new.string" parameter is inserted at the beginning of the line. If the "new.string" parameter is null and the "old.string" parameter is found, the "old.string" parameter is deleted from the line.

Multiple replacements may be performed on a line without "flipping" the buffers with the "f" command.

Wild cards:

The "up-arrow" (^) character is used as a "wildcard" search character within the string parameter, for replacing known and sometimes unknown strings within strings. It matches any character. Note that the up-arrow character is a normal character, not a control character. See the example: .r/^^^//<return>. See also the "^" command.

Using attribute marks in a replace:

The <ctrl>+{shift}^ represents an attribute mark in the editor. Used with the replace command, it has the effect of terminating the line. See the example: .r/abc/^<return> below.
Syntax r
r{#lines}/old.string/new.string{/}{start.col{-end.col}}
ru{#lines}/old.string/new.string{/}{start.col{-end.col}}
Options
Example
.r<return> 
nnn _

Positions cursor at the beginning of line "nnn" for replacement of 
the entire line. A subsequent <return> leaves the line intact. 

.r10<return> 

Positions cursor at the beginning of each of the next ten lines for entire line 
replacement. 

.r/^^^//<return> 

Replaces the first 3 characters (wildcards, or "regular" up-arrows) 
of the current line with null. (i.e. Deletes first three characters). 

.r/abc/^<return> 

Replaces the first occurrence of the string, "abc", with an attribute 
mark (<ctrl> or <ctrl>+<shift>^), terminating the line prior 
to the string, abc. 

.r10//abc<return> 

Places the string, "abc" at the beginning of the next ten lines.

.r10/abc/xyz<return> 

Replaces the first occurrence of the string, "abc", with the string 
"xyz" in the current and the next nine lines. 

.ru10/abc/xyz<return> 

Replaces all occurrences of the string, "abc", with the string, 
"xyz", in the current and next nine lines.

.r10/abc/xyz/5-9<return> 

Replaces the first occurrence of the string, "abc", with the string 
"xyz", in the current and next nine lines, when the string is found 
in column positions 5 through 9. 

.ru/^//<return> 

Replaces all characters on the current attribute with "null", leaving 
the current attribute intact, but empty.

.ru999/  / /<return>

Replaces every occurence of two spaces with one space, from the current line 
through the end of the item.
Purpose
Related editor.errors
editor.ru
editor.introduction
editor.wildcards
editor.^
editor.c

system.security.article

Command system.security.article Article/Article
Applicable release versions: AP
Category Article (24)
Description discusses system security.

Contributed by Chris Alvarez. Original Article ran in PickWorld Magazine.

This article assumes a working knowledge of the system file structure and design.

One common misconception about the Pick System is that system security does not exist. While the security features available in Pick are not as extensive as those available in most Unix releases, it is possible for a System Administrator to configure a security system that is effective for most installations. Unlike R83, Advanced Pick employs the concept of a USERS file. This file contains a description for each user permitted to logon to the system and enables the System Administrator to control the system at both the user and account levels. A separate user item should be added to the USERS file for each authorized user of the machine. For assistance in creating entries into the user file, please reference page 313 of the Advanced Pick Reference Manual or consult Technical Bulletin #T28. The file contains several attributes of interest to this discussion including the KEYS, PASSWORD, OPTIONS and PRIVILEGE attributes.

The password for the user is probably the most important part of the security system because most of the security measures available are based upon the information found in the USERS file. Each user should be issued a password and those passwords should be changed on a regular basis. Care should always be taken to ensure that a user's password is not shared with other users. It is possible to multi-value the password attribute to facilitate multiple passwords for one user. While this is not recommended for the user, it is useful when used on the account to allow a master password for the System Administrator. Make sure each user in the USERS file is assigned a password, including those received with the original release. For exam ple, the user '?' was shipped on some earlier releases of Advanced Pick as a way of entering new users but provided a 'backdoor' into any secured system.

Each account found on the system should also be assigned a password, including the system accounts shipped with the original product. This list should include any entries in the "mds" file that are q-pointers to other accounts. Multiple passwords may be assigned to any account to facilitate the ability to create several password layers.

This is accomplished by multi-valuing the password attribute in the account item found in the "mds" file.

The next step in securing the system is to limit what areas the user is allowed to access. This is done in three ways. First, the administrator can limit the system resources available to the user through the use of system privileges secondly, the administrator can limit access to TCL and thirdly, the administrator can limit which files the user is able to use through the use of update and retrieval locks.

System privileges can be set to one of three levels ranging from SYS0 to SYS2, with SYS2 as the highest level. In most installations it is a common practice to set the privilege level for each user to the highest setting because of a lack of understanding of the feature. Only those users that help in the administration of a system should be assigned SYS2 privileges, while most users should be assigned SYS1 privileges. Unfortunately, the exact list of features available to each system privilege level is not available. (ed. note: see "system privileges" for a complete list.) What is known is that SYS0 privileges exclude usage of all peripheral devices and system functions. This includes the use of the TCL verbs CLEAR-FILE, DELETE-FILE and CREATE-FILE. Users with SYS1 privileges will be able to access peripheral devices and some system functions. The biggest reason for setting the majority of users to either SYS0 or SYS1 privilege level is that neither has full access to the system debugger.

A user can easily be denied from using TCL by placing the character 'r' in the options attribute, which is attribute 9, of their item in the users file. In this manner, the administrator can limit the number of users with access to TCL commands. When a user with this restriction tries to get to TCL either through level pushing or the use of the break key, the user will be returned to the original logon program for the current account.

The file-defining item (d-pointer) of a file contains two fields for lock codes to limit a user's access to a file unless the user item contains matching codes. Although these facilitates exist in R83, they have been enhanced in Advanced Pick to include multi-value codes.

There are two types of locks, update and retrieval. When an update lock is placed on a file, only those users with matching lock codes in their user item will be allowed to make updates to the file, but any user will be able to view the items in the file. Conversely, the retrieval lock limits the viewing of items in the file. The lock codes can be any character string, but it is suggested to limit them to something simple, such as the name of the file.

For example, if the System Administrator wanted to limit the access to the customer file, the word 'customer' could be placed as the update lock on the file-defining item for the customer file. Only those users with the word 'customer' found in the list of keys on their user item would be allowed to update the file. Using this system, the administrator would place the name of the file on the file-defining item for each file needing protection. The KEYS attribute of each user item in the user file should be multi-valued with each file name the user is allowed to access.

One last step can be taken to track the updates of a sensitive file. It is possible to call a FlashBASIC or Pick/BASIC program anytime something is changed in a file, regardless of the process used to make the change. This includes updates from tape, FlashBASIC or Pick/BASIC and any editor. Place a CALLX on attribute 8 of the file-defining item for the data section of the file using the following syntax:

CALLX PROGRAM

Where PROGRAM is any cataloged FlashBASIC or Pick/BASIC subroutine with one argument passed to the subroutine. The following subroutine is an example of an audit program to keep track of which user changes a file.

A caution about using this or any auditing program: Pick Systems receives numerous calls each week from customer's complaining their machine has ground to a standstill over the past months. The support department usually discovers that the customer's application contains a program that writes auditing or history information to a history file. When the application was installed, the file is usually sized at well below the needed level and becomes incredibly fragmented over time. The fragmentation will slow the system down and can only be remedied by using a file resizing program against the data base, followed by a full system restore. The subroutine below will create a data level file called AUDIT with a default modulo of 3. If the file being audited receives numerous transactions, please change the modulo as necessary.

audit
001 subroutine audit(new.item)
002 * Subroutine to create an audit trail for any file.
003 * 16 October 1991 CJA
004 *
005 * To use:
006 *
007 * This program can be used to keep a complete audit trail of
008 * changes made to any data or dictionary section of any file.
009 * On any file d-pointer, a CALLX calls this program at file
010 * time using the following syntax as the correlative:
011 *
012 * CALLX AUDIT
013 *
014 * To audit the dictionary section of a file, place the
015 * CALLX on the d-pointer for the file found in the master
016 * dictionary. For the data section, place the CALLX syntax
017 * on the d-pointer for the data section in the dictionary
018 * of the file.
019 *
020 * When an item is filed into the file, an audit record will be
021 * written to a data file called AUDIT. If this file does not
022 * exist, the program creates the file. The audit record will
023 * include only lines which have been changed and are stored
024 * in the following format:
025 *
026 * 001 OLD.DATA]NEW.DATA
027 * 002 OLD.DATA]NEW.DATA
028 * .
029 * .
030 * .
031 * NNN OLD.DATA]NEW.DATA
032 *
033 * The item-id includes the original item's item-id
034 * concatenated with the user id and the timedate the item was
035 * changed and looks as follows:
036 *
037 * item-id*user*timedate
038 *
039 * The audit file is created with a default modulo
040 * of 3. Depending on activity in the file, this audit
041 * file could become badly sized and cause speed degradation.
042 *
043 equate am to char(254)
044 equate vm to char(253)
045 *
046 * Open file and retrieve old.item for comparison to new.item.
047 *
048 file.name = access(11)
049 item.name = access(10)
050 open file.name to f.file
051 read old.item from f.file,item.name else old.item = ''
052 *
053 * Verify existence of audit data level file by creating file
054 *
055 execute 'create-file data ':file.name:',audit 3' capturing trash
056 *
057 * Find the differences between the old.item and the new.item and build
058 * audit record. If no differences exist then do not build audit record.
059 *
060 audit.record = ''
061 no.lines = dcount(old.item,am)
062 for line = 1 to no.lines
063 if old.item<line> # new.item<line> then
064 audit.record<-1> = line:vm:old.item<line>:vm:new.item<line>
065 end
066 next line
067 *
068 * Write audit record if item has changed.
069 *
070 if audit.record # '' then
071 user = field(oconv('','u50bb'),' ',2)
072 item.id = item.name:'*':user:'*':time():date()
073 open file.name:',audit' to f.audit
074 write audit.record on f.audit,item.id
075 end
076 return
Syntax
Options
Example
Purpose
Related

programming.using.up

Command programming.using.up Article/Article
Applicable release versions: AP
Category Article (24)
Description short discussion on using the Update processor for programming in Pick/BASIC.

Contributed by Terri Hale
(Original article was published in PickWorld)

If you have Advanced Pick (AP) and you are a programmer, consider using the Update processor (UP) to build your Pick/BASIC programs. (Note: The verb "ed" does not exist in my vocabulary anymore. Why? Read on.)

UP is a full screen editor, unlike 'ed', which is a line-editor. This means that you have full text editing capabilities within your Pick/BASIC programs.

All of the UP commands for moving the cursor and text are available. Some of the most commonly used commands in writing programs are listed in the following table:

mark beginning of text to cut <ctrl>+cd or <ctrl>+cl
mark end of text to cut <ctrl>+cc
paste cut text <ctrl>+cp
read cut text from specified item <ctrl>+cr
write cut text to specified item <ctrl>+cw
load prestore buffer <ctrl>+zl
read saved prestore command <ctrl>+zr
write prestore command to a file <ctrl>+zw
execute prestore command <ctrl>+p
sentence forward and backward <ctrl>+f, <ctrl>+d
word forward and backward <ctrl>+u, <ctrl>+y
character forward & backward <ctrl>+k, <ctrl>+j
delete character <ctrl>+l
go to top of program <ctrl>+t
delete word <ctrl>+o
delete sentence <ctrl>+e
delete program <ctrl>+xo
redisplay screen <ctrl>+zp
display columnar positions <ctrl>+zc
undo previous delete (aka: oops!) <ctrl>+zz
page forward <ctrl>+zn
page backward <ctrl>+zy
toggle insert / overtype modes <ctrl>+r

UP has two modes, insert and overtype. When UP is initially entered, it is in overtype mode.

There is a prestore processor available with AP which is quite a sophisticated programming language in and of itself. There is no limit to the number of prestore commands available. Prestores can be saved in any file on the system and recalled as needed. (See the article in the March/April 1992 issue of Pickworld titled 'Advanced Pick Prestore Commands' for more information on prestore commands.)

Level pushing, or the ability to suspend your program and go list a dictionary or look at another program, is a handy tool to use in writing programs in AP. Level pushing is available from anywhere in AP, not just in the Update processor.

There are several ways to exit a Pick/BASIC program from UP, as shown i the following table:

exit without filing <ctrl>+xe
exit and file changes <ctrl>+xf
exit, file changes, compile & catalog <ctrl>+xc
exit, file changes, compile & run <ctrl>+xr
exit, rename the item & file <ctrl>+xi
exit and go to a new item (program) <ctrl>+xn
exit out of a list back to TCL <ctrl>+xk
exit and return to previous item <ctrl>+xb

Unlike R83, you do not have to file, compile, catalog and run your program with separate editor and TCL commands. In UP, you can do it all with two keystrokes from within the program itself. This is a great time-saver.

Subroutines can be called from within a Pick/BASIC program either at the time the program is filed or anytime during the update session. A subroutine can be called by putting "call subroutine.name" in the file-defining item of the Pick/BASIC program file on the correlative field (file time processing) or on any of the hotkey fields (for in-line program calls). To call a Pick/BASIC subroutine from within a program use <ctrl>+x0-9. A handy use for a subroutine call from a Pick/BASIC program file is to record the time, date and user who updated the program.

Programs can be entered in either upper or lower or mixed case. You never have to hit the caps lock or shift key.

In AP, the TCL verbs "compile" and "basic" behave differently. When you exit a Pick/BASIC program using either <ctrl>+r or <ctrl>+c, the compile form is used.

The "compile" verb is case-insensitive. This means that the variable names, TOTAL, total, and Total will all evaluate to the same symbol. So beware, if you are using the compile verb on programs written in R83 Pick with variable names in both upper and lower case which have different meanings.

On the other hand, "basic" compiles the source code with case sensitivity in effect. This means that the variable names, TOTAL, total, and Total will evaluate to three different symbols.

There are many features available in the Update processor which make writing, compiling and executing Pick/BASIC programs easier, faster and a lot more fun.
Syntax
Options
Example
Purpose
Related

up

Command up Introductory/Update Processor
Applicable release versions:
Category Update Processor (113)
Description UP is a dictionary-driven, full-screen editor and data processor. Used with the Output processor (OP), it operates as a document processor.
UP can be used to view, create, and manipulate file items. UP facilitates editing of text, dictionaries and programs, as well as data files (remember, everything in Pick is an item in a file). When used as a data processor, attribute-defining items in the file’s dictionary are employed to verify and translate data as it is entered and retrieved.
Pick/BASIC subroutines can be called from dictionaries allowing absolute control of all data entry using the Update processor and dictionaries. Without any attribute-defining items specified, UP functions as a full-screen editor.
When invoked, UP copies the specified item to a workspace and displays as much of the item on the screen as it can. UP places the cursor at the upper left corner of the item (top) on the first character of the first value of the first attribute and waits for your input.
Once the item has been loaded, any character you type will overwrite whatever is on the screen. Control keys are used to perform editing functions, but as long as the control key is not down, all characters are entered as typed. An automatic word-wrap feature moves whole words to the next line as they are typed when you overrun the end of the current line. An optional spelling checker beeps and rejects your input when you type a character that does not lead to a legal word.
Text is normally entered in the insert mode (<Ctrl>+r is used to toggle between the insert and overtype mode). While in the input mode, the return/enter key (<Ctrl>+m) creates a new attribute/paragraph. When in the overtype mode, that same key does not create a new attribute but instead goes to the next attribute. The default mode is overtype.
UP commands begin with a control character formed by simultaneously pressing the <Ctrl> key and one of the alpha keys. Some UP commands require more command characters, while others require text input.
Until the item is saved, changes made using UP have no effect on the actual item in the file -- only UP workspace is changed. The item can be exited at any time without filing, by typing <Ctrl>+xe>, and the item in the file will not change.

Using UP as a Text Editor
In the absence of any attribute list, UP functions as a text editor. An attribute list generates a data entry screen with whatever audits and transformations are defined in the corresponding dictionary. The text edit form is to specify just the file name and item list (no attribute list) and if no macro is present on the file-defining item, the raw item will be presented. Refer to the entries update, up, and u for more niformation about the update commands.
update file.reference {item.list} { (options) }
up
u

Cursor Movement
The cursor is the underline or block which moves around the screen when characters are typed. Cursors can have various forms depending on the terminal: highlighted, blinking, reverse video, etc. In all cases, the cursor indicates where the next character typed is displayed on the screen.
Cursor movement commands are used to position the cursor anywhere in the item without altering the text. The cursor actually moves on the CRT screen. And, since the screen is only a window into the item, the cursor may be moved off the screen forcing a screen redisplay (scrolling).
<Ctrl> +

k Moves the cursor forward (right) one character.
j Moves the cursor back (left) one character.
n Moves the cursor down one line.
b Moves the cursor up one line.
i Moves the cursor forward to the next tab stop in the line.
u Moves the cursor forward (right) one word.
y Moves the cursor back (left) one word.
f Moves the cursor forward to the next sentence.
d Moves the cursor back to the beginning of the sentence.
g Moves the cursor to the end of the current paragraph.
m Moves the cursor to the beginning of the next paragraph(attribute) if in overtype mode. Creates a new attribute if in insert mode.
t Moves the cursor to the top of the current item.
z n Moves the cursor to the top of the next screen.
z y Moves the cursor to the top of the previous screen.
z h Moves the cursor to the first line of the next screen, then moves the display up 12 lines.
z q Moves the cursor to the first line of the next screen, then moves display up one quarter of a screen.
z e Move the cursor to the end of the current item.
z a Redisplay the screen with the current line at the top of the screen.
z b Redisplays the screen with the current line at the bottom of the screen.
z p Redisplays the screen.
z numeric Goes to the specified line number.


Overtype and Insert Modes
When UP is first entered, it is in overtype mode. This means that characters typed overwrite the characters on the screen. Insert mode is used to insert new text just in front of the text beginning at the cursor. When text is entered in the insert mode, the following text is "opened" and shown on the next line until insert mode is exited or a cursor movement command is typed.
The letter "O" is displayed at the top right corner of the screen when in overtype mode; the letter "I" is displayed when in insert mode. As text is entered in either mode, UP word-wraps the text as necessary. That is, if a character string is longer than the remaining space on the current line, the entire string is moved to the next line. This means you can type continuously within a paragraph (attribute) without pressing the <Ctrl>+m.
<Ctrl>+r Toggle between overtype and insert modes.

Paragraphs
To create a new paragraph in the middle of existing text, enter the insert mode and type <Ctrl>+m. This terminates the current paragraph and prompts with the next attribute number. If the cursor is at the end of an item, <Ctrl>+m creates a new paragraph whether or not in input mode. In the absence of a dictionary definition, this is how UP is used as a word processor; each attribute is a paragraph.
<Ctrl>+m Same as <Return>. Always moves the cursor to the beginning of the next attribute. If in insert mode or at the end of an item, <Ctrl>+m creates a new paragraph. If UP is being controlled by a dictionary, <Ctrl>+m does not create a new attribute mark, rather the cursor moves to the next attribute.

Inputting Text Using the Spelling Checker
UP uses a spelling checker to verify text as it is entered. The spelling checker looks at each character to see if those typed so far make a legal word or may become a legal word. The words used by the spelling checker are kept in the words file in the dm account.
In order to activate the spelling checker, a q-pointer must be present on the current account and an index must be generated on attribute 0 of the words file. If an error is detected, the terminal beeps and does not display the last character typed. If an incorrect letter is typed, type the correct one and continue entering data.
To view the words immediately adjacent to the misspelled word in the words file, use <Ctrl>+u to get the next legal word or <Ctrl>+y to get the previous word. Otherwise, press one of the following:
<Ctrl> +
a Override spell checker and accept the characters.
a a Insert the word into the words file and continue.
a a a Turn off spelling checker.
z s Toggle the spelling checker on and off from any point in the item. If the spelling checker is on, <Ctrl>+zs toggles it off; if the spelling checker is off, <Ctrl>+zs toggles it on.


Deleting and Undeleting Text
As text is deleted, the remaining characters in the paragraph are moved to the left. The Cut and Paste commands also delete text.
<Ctrl >+
l Deletes the character under the cursor and moves the text left.
o Deletes characters from the cursor position to the end of the word including the character under the cursor.
e Deletes from the character under the cursor to the end of the sentence.
z o Deletes the characters from the cursor to the end of the paragraph (attribute).
z d Deletes the characters from the cursor to the end of the item.
z z Undo the last delete or data change if the change was made by using one of the control delete keys.


Exiting Items
The <Ctrl>+x commands offer different methods for exiting an item. <Ctrl>+x signals to exit this item and perform one of a series of options. For example, an item can be exited and the information filed (saved), or the item can be exited without the information being filed.
If an item is exited without being filed, the changes made during the editing session are not saved. To save the changes, the item must be filed. Several of the options that exit an item do not file it. If changes have been made to an item during the current editing session and an option is selected that exits the item without filing it, the system double-checks with the user to make sure that the changed information is not to be saved.
All UP exit commands are made up of a minimum of two characters. When the <Ctrl>+x is pressed, the current size of the item, file name, and item-id are displayed on the top line of the CRT. UP waits for an additional command.
<Ctrl>+x+
b Exits the item and goes back to the previous item in the item list. If there is no previous item, the terminal beeps and remains in the current item.
c Files the current item then compiles and catalogs it. This option is used with Pick/BASIC programs.
e Exits the item without filing it.
f Files the item, then exit it.
i {(file.reference}{item.id}
Renames and files the new item. This command prompts for a standard file item specification where the item is copied. After the file item specification is entered, the system asks if the old item from which the new item was created, is to be deleted. Enter <Ctrl>+y to remove the old item; otherwise, the item is unchanged.
k Exits the item and returns to calling process. If editing with a select list, the select list is terminated.
n Exits current item and creates a new null item. If a name is not entered when the new item is filed, it can be named using the <Ctrl>+xi> command. If there is no id processing code, UP uses the current date concatenated with a system-wide sequence number as the item-id.
o Exits and deletes the item.
p Files the item and prints it using the Output processor (OP).
r Files the item, then compiles and runs it if compilation was successful.
s Files (save) the item and remains in UP with the current item.
x Exits the item without filing it.


Searching and Replacing Text
The search commands in UP offer the capability to search for text, search for text and replace the text, and search for text and, once the text is found, determine whether or not to replace it.
<Ctrl >+
a string <Ctrl>+m
Search for the first occurrence of the specified string. If a match is found, the cursor is displayed on the first character of the matched string; otherwise, the cursor remains at the current location. When <Ctrl>+a is pressed, UP prompts for the search string at the top of the screen.
The search string is not case sensitive. To search for letters that are case specific, enclose the string in single- or double-quotation marks. If the string itself contains quotation marks, enclose those quotes in quotes.
a Search again for the string specified by the last search command. If a search string is not specified, the terminal beeps and displays a message.
a string1 <Ctrl>+r string2 <Ctrl>+n
Search for and replace every occurrence of string1 with the string2 from the current cursor position to the end of the item. When <Ctrl>+r is pressed, UP prompts for the replacing string. After entering the new text press <Ctrl>+n to indicate all occurrences.
The text is replaced as entered. If the replacement is at the beginning of a sentence, the initial letter is replaced as an upper-case letter. To specify an exact replacement of upper- and lower-case letters, enclose the text in single or double quotation marks.
a string1 <Ctrl>+r string2 <Ctrl>+m
Search for the first occurrence of string1. If a match is found, the cursor is positioned on the first character of the match and UP waits for one of the following commands:
Ctrl +
a Do not replace string1. Search again for next occurrence.
n Replace string1 with string2. Replace all further matches.
r Replace string1 with string2. Search again for string1.
x Stop search. Return to edit mode.

Cutting and Pasting Text
Cut commands are used to move or copy data from one place in an item to another place in an item. Text can be cut and deleted or cut with the original left in place (copied). After the text is cut, it is placed in the cut buffer replacing the previous contents of the cut buffer. The cut text in the cut buffer can be pasted in the current document or it can be pasted in a specified item in a file. Text can also be pasted from a specified item and file.
<Ctrl >+
c d Mark the beginning location of the text to be cut and deleted.
c l Mark the beginning of text to cut and leave (i.e., does not remove the cut from the current location in the text and makes a copy for the cut buffer).
c c Mark end of text to cut or copy from the beginning cut and puts the text in the cut buffer.
c p Paste contents of cut buffer at current cursor position. Once text has been put in the cut buffer it remains there for the duration of the current update session in the UP workspace.
c r {(file.reference}item.id {n{-m}} <Ctrl>+m
Read contents of specified item and paste at current cursor location. The optional n parameter is an integer that specifies the first attribute to copy; the optional m parameter is an integer that specifies the last attribute to copy. If a range is not specified, all attributes from beginning to the end of the item are copied.
c w {(file.reference }item.id <Ctrl>+m
Write the contents of the current item cut buffer to the item specified by item.id.


Prestore Commands
Prestore commands are used to store and execute a sequence of UP commands. These commands can be used during the current update session or saved as an item in a file and recalled for use in subsequent update sessions. Prestore commands can contain both UP commands and text. To specify a UP command, enter the letter portion of the editing command without pressing the <Ctrl> key. To specify text, enter the text enclosed within single/double quotation marks.
Prestores can be created in the prestore buffer or they can be created as an item in a file. Prestore items can exist in any file and must have a p in the first attribute. The following attribute values will contain prestore commands and text.
<Ctrl > +
p Execute the current command in the prestore buffer. If the prestore buffer is empty, displays the next screen of the item being edited (default).
z l Create or edit a prestore command in the prestore buffer. Most UP commands are available to input and edit the prestore buffer.
z r {(file.reference}item.id <Ctrl>+m
Load specified item into the prestore buffer but do not execute it. The first attribute must be the character p.
z r {(file.reference}item.id <Ctrl>+p
Load the specified item into the prestore buffer and execute it. The first attribute in the item must be a p. The default file is the master dictionary.
z w {(file.reference}item.id <Ctrl>+m
Write the prestore buffer into the specified item. The character p is written as the first attribute of the item. The default file is the master dictionary.


Using UP as a Data Processor
update file.reference item.id attribute.list (options
up
u
When UP is called with an attribute list it functions as a data processor. Each attribute name in the UP statement becomes a data entry location on the screen identified by the named attribute. The attribute names are listed along the left of the screen in half-intensity. Dependent attribute names are displayed horizontally across the screen with the controlling attribute. Each attribute-defining item creates a cell on the screen through which data may be accessed and modified under the control of dictionary processing codes. Since a Pick/BASIC program may be called using a processing code, complete application flexibility is provided.
The cursor can be moved, using the previously defined cursor movement commands, from attribute name to attribute name. (Some of the commands function in a different manner. These are defined below.) Data entered or changed next to an attribute name is filed in that attribute when the edited item is saved.
Stored data is subject to output conversions defined in attribute-defining items in the file dictionary prior to display. Data entered using UP is subject to input conversions defined prior to storage on disk. By invoking a single UP command, an entire data access and update screen can be defined. When that command is saved as a macro, it can be recalled any time for file access.UP can be used to scan data using file indexes. When attributes are indexed using the create-index verb, UP can be used to cruise on the index.
The key to cruising is understanding the Balanced Tree (b-tree) indexing feature of Advanced Pick. A b-tree is a structure used to keep an ordered list, such as names, and provides the ability to search through the list very quickly with a minimal number of disk I/Os. Any attribute in a file can contain an index. Indexes are defined using a-correlatives. Once the b-tree has been defined, the system automatically maintains the index.
b-trees allow access to data in ways not before possible. The new access capabilities are cruising (using the file index), cruising (using the file related index), zooming, and double clutching.
Cruising using the file index (local file) is the ability to move from item to item in the current file. You can move forward (with <Ctrl>+f or backward (with <Ctrl>+d through the items on any indexed attribute.
Cruising using the related file index (remote file) provides the ability to view valid data from another file. For example, a sales order file could have an attribute called name which points to the entity file. From the orders file one could view the valid names in the entity file and select the one desired.
Double-clutching means the combined abilities of searching the remote file for valid values and also searching the local file for specific items. For example, in an order file the name attribute could have an index pointing to the entity file allowing for searching of valid people. A local index on the name attribute would allow for searching for all of the orders already on file for that person.
Zooming refers to moving through a defined door to another file. Once in the other file, the user has the option to cruise from item to item in the new file, return to the original file or zoom through a door into yet another file. <Ctrl>+g is the command to zoom to another file.
When the cursor is positioned in a cell belonging to an indexed attribute, the commands <Ctrl>+d and <Ctrl>+f can be used to display the data associated with the item containing an adjacent value in the indexed attribute. The command <Ctrl>+f causes the data associated with the next value in the index to be displayed. The command <Ctrl>+d causes the data associated with the previous value in the index to be displayed.
For example, if an item containing customer name and order number indexed attributes is being displayed on the screen and the cursor is at the order number prompt, the <Ctrl>+f command will display the data associated with the next order number in the order number index. If the cursor is residing adjacent to customer name, <Ctrl>+f causes the data associated with the next customer name in the index to be displayed and customer name is the key. All of the data in the new item associated with the attribute names displayed on the screen is displayed.
When the input conversion attribute in an attribute-defining item specifies an index pointing to another file, that file can be accessed (zoomed to) by using the <Ctrl>+g command. This command pushes the current process one level and accesses the item-id in the pointed to file that matches the current value in the cell where the cursor resides. Attributes to be displayed with that item-id must be specified in attribute 15 of the original attribute-defining item. Several logical views may be defined as macros in Attribute 15 of the d-pointer.
A FlashBASIC or Pick/BASIC program may be called to specify the actual logical view to use for the current data item. It does this by assigning the logical view number into the pseudo-variable "Access (18)." If no attributes are specified, the entire item is displayed. After viewing the new item the original item can be returned to the screen by a file exit command such as <Ctrl>+xe>.
When the input conversion attribute in an attribute-defining item specifies a second index as well as one pointing to another file, the commands <Ctrl>+u and <Ctrl>+y allow the user to cruise on indexes in the pointed to file. The attribute pointed to in the second file must have been previously indexed by the create-index verb. <Ctrl>+u shows the next attribute value in the pointed to file. Only this value is updated and it is shown in the cell where the cursor is residing. What is displayed is subject to the conversions specified in the dictionary of the first file. The command <Ctrl>+y shows the preceding item-id in the pointed to file. In order for UP to function in this manner, the attribute-defining items must contain the proper index processing codes. The input conversion attribute (att 14) of the attribute-defining item in the file dictionary is where they are specified.

Overloaded UP Commands for Data Files
Most UP commands work the same whether or not dictionary attributes are in control. Certain commands function differently when certain conditions are met. These commands provide the functionality for browsing on indexes. The cruising commands can be used in a double-clutching fashion by specifying the index for the current file and a second index for another file. <Ctrl>+u and <Ctrl>+y cruise on legal instances in the pointed to file staying in the same item. <Ctrl>+f and <Ctrl>+d cruise on other items in the same file using the index for the attribute as a guide.
<Ctrl> +
g When in an attribute which indexes to another file or has a translate code in the input processing code, this command pushes the current process one level and calls UP again with the item pointed to in the new file as the argument. If the macro attribute (attribute 15) in the primary file attribute definition item is used, this list is appended to the update statement. This is known as "zooming".
f On an indexed attribute, the sentence forward command goes to the next sequential index and gets the corresponding item into the UP workspace.
d On an attribute with an index, the sentence backward command goes to the previous sequential index and gets the corresponding item into the UP workspace.
u If the attribute indexes to another file, the word forward command gets the next sequential item from the pointed to file as the value for this attribute.
y If the attribute indexes to another file, the word backward command gets the previous sequential item from the pointed to file as the value for this attribute.
Syntax
Options
Example
Purpose
Related up.a
up.sc.a
up.sc.aa
up.sc.aaa
up.arm
up.arn
up.b
up.c
up.options.c
up.cc
up.cd
up.cl
tcl.compile-run
up.correlative
up.correlative.adi
up.cp
up.cr
cruising
up.cut.paste
up.cw
up.d
up.data-entry
up.delete.text
double.clutching
up.e
up.exit.item
up.f
up.g
up.h
hotkeys
up.i
up.options.i
access.id-prompt
up.input-conversion.adi
up.input-conversion.fdi
up.insert.mode
up.j
up.k
up.l
up.options.l
up.m
up.n
up.o
up.only
up.options
up.output-conversion.adi
up.overtype.mode
up.p
up.prestore
processing.codes
up.r
up.options.s
up.search.replace
tcl.spelling.checker
up.t
up.u
up.commands
update.processor
up.v
up.w
up.x
up.x0
up.x1
up.x2
up.x3
up.x4
up.x5
up.x6
up.x7
up.x8
up.x9
up.xb
up.xc
up.xe
up.xf
up.xi
up.xk
up.xl
up.xn
up.xo
up.xp
up.xr
up.xs
up.xx
up.y
up.z
up.znumber
up.za
up.zb
up.zc
up.zd
up.ze
up.zg
up.zh
up.zl
up.zn
up.zo
zooming
up.zp
up.zq
up.zr
up.zs
up.zt
up.zw
up.zy
up.zz
up.zx
up.macro
updte.processor

vi

Command vi Definition/Unix
Applicable release versions: AP/Unix
Category Unix (24)
Description lists the most commonly used vi commands.

Please note: vi is a case sensitive editor. The command "A" is different from the command "a".

Invoking vi:

vi filename

Insert Mode

In insert mode, the keyboard behaves like a typewriter. Keystrokes appear as screen text after typing any of the following commands.

i Insert text at the cursor
A Append text at the end of the line
a Append text after the cursor
O Open a new line of text above the cursor
o Open a new line of text below the cursor
<ESC> Exit insert mode & invoke command mode)

Command Mode

In command mode, keystrokes perform functions such as moving the cursor, searching for patterns, or quitting from the document. All commands are referenced from the current cursor position.

Cursor Movement

Arrow Keys Move one space in any direction
G Go to the last line in the file
nG Go to line "n"
w Move forward to the next word
b Move backwards to the previous word
$ Move to the end of the line
0 Move to the beginning of the line
<ctrl>+d Scroll down 1/2 screen
<ctrl>+u Scroll up 1/2 screen
<ctrl>+b Scroll up Full
<ctrl>+f Scroll down Full

Searching

/string Search for a "string" (pattern) of characters
n Search for the next occurrence of the "string"
:%s/str1/str2/g Replace all occurrances of str1 with str2

Deleting Text

x Delete a single character
dw Delete a word
dd Delete an entire line
ndd Delete an "n" number of lines
d$ or
D Delete from the cursor to the end of the line

Copying Text
yy Copy (yank) a line to the buffer
nyy Copy (yank) an "n" number of lines to the buffer
P Paste text from the buffer

Changing Text
r Mark a single character for replacement
cw Mark a word for changing
cc Mark a line for changing

Miscellaneous Commands
j Join a line with the one below it
!cmd Execute a Unix command
:r file Read a file into vi
. Repeat the last command
u Undo the last command

Saving and Exiting
u Write (save) the file
:q! Quit the file without saving changes
ZZ Write (save) the file and quit vi
Syntax
Options
Example
Purpose
Related tcl.vi

editor.^

Command editor.^ Command/Editor
Applicable release versions: AP, R83
Category Editor (43)
Description toggles the function of the "wildcard" search character used in (l)ocate and (r)eplace commands.

Initially, this function is "on". When toggled "off", the "^" is treated as any other character. This allows the "r" command to look for a literal "^", rather than treating "^" as a wildcard.
Syntax
Options
Example
Purpose
Related editor.r
editor.l.locate
editor.introduction