jED

Man Page Index


The jED editor is a full screen, context sensitive, screen editor. It has been specifically designed so that users will find it easy to learn and use and is the preferred editing tool for the jBASE operating environment.

The features provided in jED will be familiar to users of many other editors. It incorporates many powerful facilities for manipulating text and data, and contains all the features that programmers have come to expect of a good editor.

jED has full screen access to jBASE file records and UNIX files - a feature which is not provided by other editors.

The command keystrokes are fully configurable by each user, as is the keyboard. jED can therefore be customized to mimic many operations of other editors and provide a familiar environment for new users. Keyboard and command independence make jED the most versatile and powerful editing tool available for all jBASE editing requirements


CONTENTS

Editor Screen
Invoking jED
Command Elements for Database Resident Files
Command Line Options
Command Mode
Edit Mode
Keyboard Personalization
jED Default Key Commands
Command Line Operations
     Leaving the Editor
     Abandon Edit and Start New Session
     Delete File or Record
     Exit and Update
     Exit and Discard
     Update Without Exit
     Display Record in Hexadecimal
     Command Options
Locating Strings
Replacing Strings
Copying, Pasting and Cutting Blocks of Text
     Marking Text
     Copying Marked Text
     Moving Highlighted Text
     Merging Text From Another Record
     Deleting Marked Text
jBC Line Indentation
Miscellaneous Commands
Changing jED Command Keys
Terminfo for Altering jED Keystrokes


EDITOR SCREEN

A typical jED editor session might look like this:

*File PROGS, Record cust_rep.b Insert 10:45:17
Command->
001
002
003
-------------------------------- End Of Record --------------------------------
 
The screen is divided into three sections; the editor status line at the top, followed by the command line and then the data editing area which fills the rest of the screen.
 
 

INVOKING jED

Call the jED editor from the UNIX or Windows command line.

 

 

SYNTAX

jed pathname {pathname..}
jed {DICT} filename{,filesection} {record-list} {(options)}}

If you simply issue the command jed, the editor will open the last file that was used, and the cursor will be positioned wherever it was when the last edit session was closed. In other words, you can carry on from exactly where you left off. The command, jed pathname, will either open an existing file or create a new one if the file referenced by pathname does not exist. The will contents of the file will be displayed in the edit window. If you specify a list files, the editor will present the next file as you finish with each one.

When the editor is supplied with the name of a file resident in a database (such as a j-file), it scans the rest of the command line looking for a list of records keys. If no record keys were specified, the jED editor will prompt for a list. Otherwise the list of record keys will be edited one after the other.

Note that because the editor uses the jEDI interface to access the records, it can be used to edit records in any file system that jEDI recognizes.

 

 

COMMAND ELEMENTS FOR DATABASE RESIDENT FILES

DICT This modifier is only required if you wish to edit records in the DICTionary of a j-file.

filename This is the name of the "file" containing the records.

filesection This is the file section name, as used in a j-file.

record-list It is possible to furnish a list of records to be successively edited. This can be a list of records separated by a space, or "\*" to indicate all records in the file. Note that the \ is the shell escape character to stop the * being treated as a wild card that would otherwise be expanded. Additionally, the record-list can be fed to this command by preceding the jed command with a jBASE list generating command such as SELECT or SSELECT. In this case, the record-list is ignored.

 

 

COMMAND LINE OPTIONS

Options available when executing the jed command are as follows:

Option Explanation
Bnn{,mm} performs automatic indentation on the record to be edited. This will be of use when creating jBC programs.
nn parameter specifies the number of spaces to indent by for each indentation level (default is 4 spaces).
mm this optional parameter is the number of times the nn indent value should be applied at the start of each line. If mm is 2 and nn is 3, each line will be indented initially by 6 spaces and each subsequent indent level will be 3 further spaces.
E uses the default keyboard command set-up at installation, rather than that which may have been set up exclusively for the port.
L does not lock the file or record being edited. This allows simultaneous edit access from elsewhere.
R allows READ ONLY access to the record or file.
S space characters not trimmed from end of line
Tnn sets tab stops every nn spaces for use within the editor.

 

EXAMPLES

jed test.b
Opens the test.b file for editing, initially in insert mode with automatic indentation turned on. If the file does not exist, it is created and the text New Record is shown at the top of the screen.

jed test.b (B5,2
The jBC program test.b is edited with automatic indentation set. The initial indent is set at 10 spaces for all lines, and each additional indentation level is set at 5 spaces.

jed invoices.b subs.c
The jBC program invoices.b will be edited, followed by the "C" program subs.c.

jed BP menu1.b menu1.1.b
The jBASE file records menu1.b and menu1.1.b are successively edited. Record locks are taken on the records as they are edited to prevent multiple edits on the same record.

JED ORDERS 0012753 0032779 (R
The records 0012753 and 0032779 from the file ORDERS will be successively edited in read-only mode.

:SSELECT ORDERS WITH CUST.NAME = "UPA"
>JED ORDERS

The orders of the customer UPA will be successively edited in sorted order. Record locks will be automatically set during the editing period to prevent simultaneous updates by other users.

jed -F BP \*
All the records in the jBASE file BP are set up to be edited one after the other. Note the use of the shell escape character (\) before the *.

jed -F BP STXFER.b \(T10
The record STXFER.b in file BP is opened for editing. A tab stop is set at column 10 for use in this session.

 

USING THE JED EDITOR

The jED editor is used in two different modes:

Command mode for entering editor commands, and
Edit mode for entering or modifying data.

The current mode is displayed at the top of the screen.

 

COMMAND MODE

When the editor is invoked, the record or text file is displayed, and the user is placed in input mode with the cursor at the input position.

To change to command mode simply press the <Esc> key on the keyboard. The cursor now moves to the top portion of the screen and the editor awaits input of a command. Once a valid command has been executed, control passes back to the Edit mode if appropriate.

 

 

EDIT MODE

Edit mode is used when entering or modify data. This is the default mode for an editor session.

Keyboard control sequences are available to perform a variety of functions such as cursor positioning, scrolling and marking text for a subsequent action.

Some command line operations are also available from keyboard control sequences.

 

 

KEYBOARD PERSONALIZATION

The jED editor allows a considerable number of functions and commands to be performed whilst in edit mode, mostly by combining the <Ctrl>  key and one other key.

Most keys have a default value (which can be reset using the E option when invoking jED). These can be reconfigured for each command. The keystroke sequence can be chosen to suit the keyboard, the installation environment or personal preference.

The keystroke environment is usually be set up by modifying the UNIX terminfo file parameters. The default editor commands can also be overriden by configuring the .jedrc file.

 

 

jED DEFAULT KEY COMMANDS

The default keystroke sequences available from jED are shown below. If the system administrator has reconfigured these for a particular port, they can be re-assigned by using the E option when starting a jED session. The execution of a command is relative to the current cursor position.

Key Function
<F1> scrolls the screen up one line.
<F2> scrolls the screen down one line.
<F3> scrolls the screen up half a page.
<F4> scrolls the screen down half a page.
<F5> scrolls the screen up one page.
<F6> scrolls the screen down one page.
<F7> displays the first page of the record or file.
<F8> displays the last page of the record or file.
<F9> pressing <F9> when the cursor is positioned on a line of source code that begins a structured statement (IF, BEGIN CASE etc.), will cause the editor to locate the closing statement for the structure. If the cursor line is an IF statement then the editor will attempt to find the END statement that closes this structure. If there is no matching END statement then the editor will display a message to this effect.
<F10> the <F10> key is complement of the <F9> key. Therefore if the cursor is positioned on an END statement, then the editor will attempt to find the start of the structure that it is currently terminating. If the END has been orphaned (it matches no structure), then the editor will display a message to this effect.
<Ctrl A>/<Home> moves cursor to start of the current line.
<Ctrl E>/<End> moves the cursor to the end of the current line.
Left Arrow moves the cursor one character position to the left.
Right arrow moves the cursor one character position to the right.
Up arrow moves the cursor to the previous line.
Down arrow moves the cursor to the following line.
<Tab> moves the cursor to the start of the next tab position on the line.
<Shift Tab> moves the cursor to the previous tab position on the line.
<Esc> moves the cursor to the COMMAND LINE.
<Ctrl W> deletes from the cursor to the end of the word, including the following whitespace characters.
<Ctrl K> clears text to the end of the line. If the cursor is situated at the end of the text line, then this command will join the following line with the current line.
<Back Space> performs a destructive backspace.
<Delete> deletes the character under the current cursor position.
<Ctrl D> deletes the current line. By default, this key must be pressed twice to delete the line. This is to avoid accidental deletion by users familiar with vi. To override, place "set delete-line = ^D" in the .jedrc file.
<Ctrl G> sets the start or end position for marking a block of text. The first <Ctrl G> will mark the start of a block or mark a single line. The second <Ctrl G> with the cursor on a different line will mark a complete block. The block can be unmarked by pressing <Ctrl G> a third time.
<Ctrl L> inserts a blank line below the current line and positions the cursor on it.
<Ctrl N> locates the next occurrence of a earlier located string.
<Ctrl O>/<Insert> toggles between the Overwrite and Insert data entry modes.
<Ctrl P> locates the previous occurrence of a earlier located string.
<Ctrl R> redisplays the screen and discards the most recent updates (since the last carriage return).
<Ctrl T> copies the character at the corresponding cursor position on the line above the current line.
<Ctrl V> performs jBC program indentations on the current screen window.
<Ctrl X> exits the current record without writing away any updates. If the record has been changed within the current editing session then the editor will ask for confirmation to exit the modified record.
<Ctrl ]> inserts the field value delimiter character.
<Ctrl \> inserts the field sub-value delimiter character.
<Enter> opens a new line. Any characters on the current line after the current cursor position are moved to the start of the new line.

 

 

COMMAND LINE OPERATIONS

To enter the command line from the jED edit mode, press the <Esc> key, or one that has been reconfigured to perform the same action.

 

LEAVING THE EDITOR

There are several options available for exiting a file or record being edited. It can be deleted, stored in its latest form, keeping all the changes made in the current editing session, or it can be stored as it existed before the edit session began.

 

ABANDON EDIT AND START NEW SESSION

The E command will abandon the current edit (you will be asked to verify leaving a changed record) and edit the specified record(s).

The command syntax is as follows:

E unixfile
E filename record

If the form filename record is used, then the filename should be the name of a jBASE file. You can also specify the pathname of a standard UNIX file with the unixfile form. Note that wildcard characters such as asterisk (*) are not expanded by the E command, and that you must the jBASE file name again, even if you are currently editing a record from within that file.

 

 

DELETE FILE OR RECORD

The command syntax is as follows:

FD {options}

options can be K, T and/or O. See the Command Options topic for details.

This command deletes the file or record and releases any lock set. Before it does so, the user is prompted for confirmation. The edit session then terminates, or continues with the next record if this choice is in effect.

 

EXIT AND UPDATE

The command syntax is as follows:

FI {options} {unixcommand}

FI writes the updated version of the file or record back to disk and releases any lock set. The edit session then terminates, or continues with the next record, if this choice is in effect.

options are B, K, R and T. See Command Options for details.

unixcommand specifies a UNIX command to ,be executed on exiting the editor.

 

EXIT AND DISCARD

The command syntax is as follows:

EX {options}

EX leaves the file or record as it was at the start of the session, and releases any lock set. If updates have been made you will be prompted for confirmation before the updates are discarded. The edit session then terminates, or continues with the next record, if this choice is in effect.

options are K, T and O. See Command Options for details.

 

 

UPDATE WITHOUT EXIT

The command syntax is as follows:

FS {options} {unixcommand}

This command writes the updated file or record to disk, then returns to the editing session at the point where it left off.

options are B and R. See Command Options for details.

unixcommand specifies a UNIX command to be executed on exiting the editor.

 

DISPLAY RECORD IN HEXADECIMAL

The command syntax is as follows:

HX
HEX

This command acts as a toggle such that each iteration of the command turns the hexadecimal display on or off depending on its previous state. The HX (or HEX) command is only used for display, the record is not stored as it appears in hexadecimal.

 

COMMAND OPTIONS

R specifies that, after the file has been written to disk, it should be executed. Additional parameters can be added to this option and passed to the program. The editor issues the command filename {parameters} to execute the program. Note that the .b suffix is removed.

K or T option specifies that if the editor was working from a list of records, the list should be discarded and that the editor should exit directly to the shell (or to the calling process).

O specifies that the confirmation request normally issued with the FD and EX commands should be suppressed.

The R option is particularly useful to jBC programmers.

 

 

EXAMPLES

FIK
Exits the record and writes it to disk. If in the middle of a list of records being edited, the list is abandoned and the editing session is terminated.

FDO
Delete the current record being edited. The normal confirmation of this action is not given.

 

 

LOCATING STRINGS

The editor allows the user to search and locate any string held in the body of the text being edited.

There is also a keystroke command sequence (default <Ctrl N>) to allow the user to find the next occurrence of the string used in the previous locate command.

The locate command syntax is as follows:
L{nnn}dstring{doption}

nnn is the numeric value of the number of lines to search from the cursor position. If omitted, the search continues to the end of the file or record. If this optional parameter has been specified then all occurrences of the string will be located over the specified number of lines. If only a single occurrence is found then the cursor is placed at this point in the file. If multiple occurrences of the string are found then each one is listed below the editing screen.

d is the delimiter used to enclose the string to be located. It can be any character that does not form part of the string.

string is the string to locate.

option can be one or more of the following:
F specifies that the search is to begin at the start of the file or record.
C performs a case insensitive search. Otherwise the search defaults to match the cases as provided in the string.

 

 

EXAMPLES

L/report
Searches the record from the current position for the string "report" and halts at the first occurrence found, with the cursor at the start.

L9 FORM
Search the next 9 lines and locate all occurrences of the string "FORM".

L/STARS/F
Searches from the first line of the file to find the first occurrence of the string "STARS". This line is placed at the top of the screen.

L/acropolis/C
Locates the first occurrence of the string "acropolis" with the letters in upper or lower case.

 

 

REPLACING STRINGS

The editor allows the user to replace any occurrence of a string on any line with another from the command line. This is in addition to the overwrite mode.

The command syntax is as follows:
R{U}{nnn}dstring1dstring2{doption}

U replaces ALL occurrences of string1 with string2 on the current line only.

nnn is a numeric value for the number of lines, starting from the current one, over which to perform the replace operation. If this optional parameter is specified and more than a single occurrence of string1 is found then all replacements are listed beneath the current editing screen. d is the delimiter character used to separate the string values. It can be any character not in either of the strings.

string1 is the string that is to be replaced.

string2 is the replacement string. This can be shorter or longer than the original.

option can be one or more of the following:
F executes the replace command from the first line of the file or record.
* replaces ALL occurrences of string1 with string2 on the current line.
nnnnumeric value for the number of times to repeat the replace operation on the current line.

 

 

EXAMPLES

R/ABC/DEF
Replaces the first occurrence (reading from the left) of ABC in the current line with DEF.

R9/*/!
Replace on the next 9 lines, the first occurrence on the line of "*" with a "!". The changed lines are displayed before moving on.

RU9/*/!
Replace any occurrence of "*" with "!" over 9 lines (the current line and the next 8).

R999//*/F
Place a "*" character at the start of every line starting from the first. All lines changed are shown before returning to the original line.

R/^/AM/*
All occurrences of the "^" character on the line are replaced with "AM".

R9/*//
Removes (replaces with null) the first occurrence of "*" on the next 9 lines.

R/x//10
Removes the first 10 "x" characters on the current line.

 

 

COPYING, PASTING AND CUTTING BLOCKS OF TEXT

The editor allows the user to copy or move blocks of text from one location to another within the current record being edited. It is also possible to copy from another UNIX file or jBASE record. Before a block can be moved or copied, it has to be marked or highlighted. Marked lines have their line numbers replaced by the characters ++++.

 

 

MARKING TEXT

Text can be marked whilst in edit mode by using the appropriate keystroke command (default <Ctrl G>) to mark the start and end of the block.

To highlight a block, move the cursor to the first line to be highlighted and press <Ctrl G>  (or the reassigned ones). Then move the cursor to the last line to be highlighted and again press the <Ctrl G> The start and end lines can be marked in any order.

To cancel the marked text, simply press <Ctrl G> again, which will remove the markers.

Once the text is marked the cursor should be positioned on the line to which the text is to be copied or moved before invoking the command line or key sequence required.

 

 

COPYING MARKED TEXT

Once marked, text can be copied by moving the cursor to the target line, entering command mode, then using the copy commands provided. To copy text to the line before the current one, use the CB command. To copy to the line following the current one, use the CA command.

The syntax for both commands is the same:
CB{nn}
CA{nn}

The optional nn parameter is a numeric value that gives the number of copies of the marked text to transfer. This is particularly useful for the creation of a large quantity of repetitive text.

 

 

MOVING HIGHLIGHTED TEXT

Commands used to move highlighted text are MB to move to the line before the current one, and MA to move to the line following the current one.

The syntax for both commands is the same:

MB
MA

The text will be physically deleted from the original position. It is not valid to move text within the highlighted block.

 

 

MERGING TEXT FROM ANOTHER RECORD

Using the jED editor it is possible to merge data from any file or record into the current one.

The command to achieve this is:
MERGE

This is achieved by the following command sequence:
Position the cursor one line above the desired position of the merged text.
Spawn a new editor session using the ! command (detailed later). For example, "!jed record", or any other valid jed syntax. This will execute another editing session, placing the current one in the background.

Mark the block of text you wish to merge, then from the command line, issue the MERGE command.

The newly spawned editing session will be exited and control will be passed back to the original edit session. The merged text will then be copied into the record before the current line.

 

 

DELETING MARKED TEXT

The command DB deletes the marked text. The position of the cursor or portion of the record being displayed has no effect on the action.

 

 

jBC LINE INDENTATION

The jED editor has the capability of formatting lines of jBC program code with appropriate indentation and so make it more readable. The commands available and their syntax are described below.

BI{nn}
Formats the entire record as jBC code by adding indentations in appropriate places. The value nn gives the number of space characters per indentation (maximum 20), and defaults to 3 if omitted.

BION{nn}
Turns on the automatic indentation for jBC source code. Equivalent to using the B option with the jed command. The value nn gives the number of space characters per indentation, and defaults to the value used with the B option, or the value used in the last BI command.

BIONA{nn}
This command is the same as the BION command, except that an alternative form of indentation is used for the CASE statement. It is equivalent to using the A option with the jed command when opening an editing session.

BIOF{F}
Turns off the automatic indentation for jBC source code. It is equivalent to not using an indent option when opening an editing session.

 

 

MISCELLANEOUS COMMANDS

DE{nnn}
Deletes the number of lines specified by nnn, starting from the current cursor position. If nnn is omitted it defaults to a value of one line.

S?
Displays the size of the record being edited in bytes. It includes field delimiter marks in the body of the record.

!{command}
Executes command. Can be any valid UNIX or jBASE command.

!!
Re-executes the command specified in the most recent ! command executed.

U{nn}
Scrolls the screen up by nn lines. If omitted, nn defaults to one line.

D{nn}
Scrolls the screen down by nn lines. If omitted, nn defaults to one line.

I{nn}
Inserts nn blank lines after the line holding the cursor. If omitted, nn defaults to one line.

nn
Positions the cursor on line nn, which is positioned at the top of the screen if the number of remaining lines still allows a screen"s worth of data to be displayed.

IN
Equivalent to the <F10> key.

IP
Equivalent to the <F9> key.

?
Displays the main help screen menu.

 

 

CHANGING jED COMMAND KEYS

The keystrokes used for jED editor commands are configured using the UNIX terminfo terminal characteristic database.

 

 

TERMINFO FOR ALTERING JED KEYSTROKES

Terminfo is a UNIX database that describes the capabilities of terminals and their keyboards. Terminal capabilities are defined for how operations are performed, any padding requirements, and the initialization sequences required for each function. The terminfo system is comprehensively documented within the standard UNIX documentation.

The terminfo data is used by utilities such as vi and jED to allow them to work on entirely different terminals without needing to set up or change parameters for each one.

The terminfo data can usually be found in the /usr/lib/terminfo directory.

Terminfo entries consist of a number of fields delimited by a comma.

Embedded whitespace characters are ignored.

The first line of each description gives one or more names (separated by a | character) by which the terminal is known. Names should not contain space characters and at least the first 14 characters should be unique. The first name in the list is normally the shortest and is used when defining the terminal to UNIX, e.g. in setting the TERM environment variable.

The terminal name is followed by a list of capabilities that describe the functionality available with it.

There are three types of terminfo definitions:

Booleans to indicate what features of the terminfo system the particular terminal supports such as: margin; color; erase; tabs.
Numerics to indicate magnitudes such as numbers of columns per line,numbers of lines in the display.
Strings For example, cursor, italics, carriage return, keyboard definitions.

The jED editor is affected mainly by the definitions of key strokes in the strings section. If the terminfo definition for your terminal does not define the keyboard sequences for the jED editor (F1 - F10 keys, Cursor keys, etc.), you may change the definition yourself like this:

# TERM=myterm ; export TERM

# infocmp >termdef.myterm

# vi termdef.myterm
........add the new keystrokes and write back the new record

# tic termdef.myterm

Note that on many systems you will need to have super user permissions to execute the tic command.

Although terminfo is documented extensively it can become quite complex. jBASE Software would be pleased to help you to define terminfo entries for terminals. However, in most circumstances, the jkeys program will provide all functionality required.


ED