| Bookmark Name | Actions |
|---|
jBASE Editor
The jBASE Editor (jED) editor is a full screen, context sensitive, screen editor designed specifically for ease of use and learning. It is the preferred editing tool for the jBASE operating environment and the jBASE BASIC programs.
jED features incorporates many powerful facilities for manipulating text and data. It gives full screen access to jBASE file records and UNIX files (a feature not provided by other editors). The Command keystrokes are fully configurable by each user, as is the keyboard. Therefore, jED is customizable to mimic many of the 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.
Below is the jED command syntax:
jED Filename Item (Options jED Item)
Editor Screen
A typical jED editor session is shown below.
*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
- The command line
- The data editing area, which fills the rest of the screen
This section shows the execution commands you can use in jED.
| Command | Description |
|---|---|
|
HOME/Ctrl A |
Move to start of current line |
|
END/Ctrl E |
Move to end of current line |
|
Ctrl W |
Delete word |
|
Ctrl K |
Clear to end of line or join. |
|
Ctrl D |
Delete current line |
|
Ctrl G |
Mark block. 1st Start Blk, 2nd End Blk, 3rd Remove Mark |
|
Ctrl L |
Insert line below current line |
|
Ctrl N |
Locate next occurrence |
|
Ctrl O |
Toggle overwrites and insert. By default, insert. |
|
Ctrl R |
Redisplay screen |
|
Ctrl T |
Copy the character from the corresponding cursor position on the line above |
|
Ctrl V |
Indent for BASIC |
|
Ctrl ] |
Insert ] |
|
Ctrl \ |
Insert \ |
From edit mode, you need to press Esc to invoke the command line.
| Command | Description |
|---|---|
|
CBn |
Copy Marked block before current line, n times |
|
Can |
Copy Marked block after current line. n times |
|
/string |
Locate the next occurrence of string |
|
MB |
Move Marked block before current line |
|
MA |
Move Marked block after current line |
|
BI |
Format BASIC code |
|
BION |
Turn on Format indentation |
|
! Cmd |
Execute Command |
|
!! |
Re-execute last ! Cmd |
|
HX or HEX |
Toggle the display of the record in Hexadecimal |
Invoking jED
You can invoke jED by calling the jED editor from the UNIX or Windows Command line.
The command syntax is:
jed Filename Item (Options JED Item )
or
jed pathname {pathname..}
or
jed {DICT} filename{,filesection} {record-list} {(options)}}
If you simply issue jED as a command, then the editor will open at the last file in use. The cursor will be positioned wherever it was when the last edit session was closed. In other words, you can continue from where you last left off. If the file referenced by pathname does not exist the Command, jed pathname, will either open an existing file or create a new one. The contents of the file will be displayed in the edit window. If list files are specified, then the editor will present the next file successively at the end of an edit session of 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, then the jED editor will prompt for a list. Otherwise, the list of record keys will be edited one after the other.
- 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.
The following table shows the available options when executing the jed Command:
| Option | Explanation |
|---|---|
|
Bnn{,mm} |
Performs automatic indentation on the record to be edited. This can be used when creating jBASE BASIC programs. |
|
nn |
Specifies the number of spaces to indent by for each indentation level (default is 4 spaces). |
|
mm |
Specifies 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 |
|
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, then it is created and the text New Record is shown at the top of the screen. |
|
jed test.b (B5,2) |
The jBASE BASIC 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 five spaces. |
|
jed invoices.b subs.c |
The jBASE BASIC 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 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 jED
jED has two different modes:
- Command mode for entering editor Commands, and
- Edit mode for entering or modifying data
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.
You can use edit mode when entering or modifying 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.
The jED editor allows a considerable number of functions and Commands to be performed during the 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 set up by modifying the UNIX terminfo file parameters. The default editor Commands can also be overriden by configuring the .jedrc file.
The default keystroke sequences available from jED are shown below. If the system administrator has reconfigured these for a particular port, they can be reassigned 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, 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 an earlier located string |
|
<Ctrl O>/<Insert> |
Toggles between the Overwrite and Insert data entry modes |
|
<Ctrl P> |
Locates the previous occurrence of an 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 jBASE BASIC 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 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 |
You can enter the Command line from the jED edit mode by using the Esc key, or the option that has been reconfigured to perform the same action.
There are several options available to exit a file or a current editing session. 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.
The E Command abandons the current edit (you will be asked to verify leaving a changed record) and allows you to edit the specified record(s).
The command syntax is:
E unixfile
or
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.
The Command Syntax is:
FD {options}
Where, 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 the deletion, you will be prompted for confirmation. The edit session then terminates, or continues with the next record if this choice is in effect.
The Command Syntax is:
FI {options} {unixCommand}
Where,
- Options are B, K, R and T. See the command options for details.
- unixCommand specifies a UNIX Command to be executed on exiting the editor.
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.
The command syntax is:
EX {options}
Where, options are K, T and O. See the command options for details.
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, then 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.
The command syntax is:
FS {options} {unixCommand}
Where,
- Options are B and R. See the command options for details.
- unixCommand specifies a UNIX Command to be executed on exiting the editor.
This Command writes the updated file or record to disk and returns to the editing session at the point where it left off.
The Command Syntax is as follows:
HX
or
HEX
This Command acts as a toggle such that each iteration of the Command turns the hexadecimal display on or off depending upon its previous state. The HX (or HEX) Command is only used for display; the record is not stored as it appears in hexadecimal.
- R – Specifies that, after the file is written to disk, it should be executed. You can add additional parameters to this option and pass it to the program. The editor issues the Command filename {parameters} to execute the program. Note that the .b suffix is removed. This option is particularly useful for jBASE BASIC programmers.
- K or T – Specifies that if the editor was working from a list of records, then 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.
FIK
Exits the record and writes it to disk. If in the middle of editing a list of records, it abandons the list and terminates the editing session.
FDO
Delete the current record being edited. The normal confirmation of this action is not given.
The editor allows you 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>) that allows you to find the next occurrence of the string used in the previous locate Command.
The locate Command Syntax is:
L{nnn}dstring{doption}
Where,
- nnn – 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 you specify this optional parameter, 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 – The delimiter used to enclose the string to be located, which can be any character that does not form part of the string.
- string – The string to locate.
- Option can be one or more of the following:
- F – Specifies that the search begins at the start of the file or record.
- C – Performs a case insensitive search, else the search defaults to match the cases as provided in the string.
Below are the examples for locating string:
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 nine 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.
The editor allows you to replace any occurrence of a string on any line with another from the Command line. This feature is an addition to the overwrite mode.
The Command Syntax is:
R{U}{nnn}dstring1dstring2{doption}
Where,
- U – Replaces all occurrences of string1 with string2 on the current line.
- nnn – A numeric value for the number of lines, starting from the current line, 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 – A delimiter character used to separate the string values. It can be any character not in either of the strings.
- string1 – The string that is to be replaced.
- string2 – The replacement string, which can be shorter or longer than the original.
- Options 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.
Below are the examples for replacing string:
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 nine lines (the current line and the next 8).
R999//*/F
Starting at the first line place a * character on every line; all modified lines 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 nine lines.
R/x//10
Removes the first 10 x characters on the current line.
The editor allows you 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. You must mark or highlight a block before moving or copying it. Marked lines have their line numbers replaced by the characters ++++.
Text can be marked during the 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 and press <Ctrl G> (or the reassigned ones).
- Move the cursor to the last line to 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>, which will remove the markers.
Once the text is marked, position the cursor on the line to which the text is to be copied or moved before invoking the Command line or key sequence required.
Once marked, text can be copied by moving the cursor to the target line, entering Command mode, then using the copy Commands provided. Use the CB Command to copy text to the line before the current line. To copy to the line following the current line, use the CA Command.
The syntax for both Commands is same:
CB{nn}
or
CA{nn}
Where, 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.
You can use the commands MB and MA to move highlighted text to the line before the current one, and to the line following the current one, respectively.
The syntax for both Commands is same:
MB
or
MA
The text is deleted from the original position. It is not valid to move text within the highlighted block.
It is possible to merge current data using jED from any file or record by using the Command:
MERGE
Use 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. For example, !jed record, or any other valid jed syntax. This executes another editing session, placing the current session into the background.
- Mark the block of text you wish to merge, and then from the command line, issue the MERGE command. The newly spawned editing session exits and control passes back to the original edit session. The merged text is copied into the record before the current line.
The DB command deletes the marked text. The position of the cursor or portion of the record being displayed has no effect on the action.
The jED editor has the capability of formatting lines of jBASE BASIC program code with appropriate indentation and therefore enhances the readability of the program code. This section shows the available command with their syntax.
| Command | Description |
|---|---|
BI{nn}
|
Formats the entire record as jBASE BASIC code by adding indentations in appropriate places. The nn value gives the number of space characters per indentation (maximum 20), and defaults to three if omitted. |
BION{nn}
|
Turns on the automatic indentation for jBASE BASIC source code. Equivalent to using the B option with the jed command. The nn value 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 jBASE BASIC source code. It is equivalent to not using an indent option when opening an editing session. |
| Command | Description |
|---|---|
|
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 in bytes the size of the record being edited. 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. |
|
IN |
Equivalent to the <F10> key. |
|
IP |
Equivalent to the <F9> key. |
|
? |
Displays the main help screen menu. |
The keystrokes used for jED editor commands are configured using the UNIX terminfo terminal characteristic database.
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. This 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. For example, while 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 – Indicate what features of the terminfo system the particular terminal supports such as: margin, color, erase, tabs.
- Numerics – Indicate magnitudes such as numbers of columns per line, numbers of lines in the display.
- Strings – For example: cursor, italics, carriage return, and keyboard definitions
The jED editor is affected mainly by the definitions of keystrokes 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.), then you may customise the definition as:
# TERM=myterm ; export TERM # infocmp >termdef.myterm # vi termdef.myterm ........add the new keystrokes and write back the new record # tic termdef.myterm
Add Bookmark
save your best linksView Bookmarks
Visit your best linksIn this topic
Are you sure you want to log-off?