TXT and KOMPOZ - Nakazoto/CenturionComputer GitHub Wiki

TEXT and KOMPOZ

TEXT and KOMPOZ are the two text editors included in the Centurion utilities library (folder) S.. Each editor consists of the executables themselves and JCL scripts to run them. Both editors operate very similar to each other.

TEXT is the simpler of the two and seems to have mostly been used for writing software, it is invoked from compile scripts when errors are encountered.

KOMPOZ was mostly used for documentation, and includes more word processing functionality like indents, tabs, margins, styles and output formatting.

Neither of the programs are WYSIWYG and require a good mental image of the document in order to keep track of line pointer position and overall composition. In this way, they are more similar to a program like ED with a command structure vaguely like VI.

KOMPOZ

The KOMPOZ editor is started by running it's JCL script:

S.KOMPOZ

Which will ask about the file, set things up and start the editor. The S.KOMPOZ script is slightly more verbose and user friendly than the scripts for TEXT, in that it will prompt for all information about the file, such as it's name, library (folder), and disk#, it does not require the file being worked on to exist before hand, the script can create the file itself. The script also allows specifying files for "Joins" and "Inserts" which are used for more advanced editing and composition.

Opening KOMPOZ, creating a new file, and getting into the editor looks like this (screenshots taken using Meisaka's brilliant emulator):

Once at the KOMPOZ main prompt, all actions are enacted through shortcut keys, see the Editing section below for details.

TXT aka TEXT

TEXT is the precursor editor to KOMPOZ, it's about half the size, and being older, lacks the output formatting features. Unlike KOMPOZ, the scripts to start the TEXT editor aren't called "TEXT", they are:

S.TXT filename disk#

which starts the editor normally

S.TXTZ sourcename disk#

which is like S.TXT but prepends the letter Z to the file name, this is a Centurion convention for source code text files.

The file and disk number must be specified as arguments, they will however, prompt for a library (folder.) The scripts expect the file to exist, so for new files you must create them yourself before running the program. This can be done using the JCL command .NEW. Here is an example for creating a file called USAGI in the folder called O on the fixed platter disk #1 with the file type of ASCII and (I believe) a size of 1 track:

.NEW O.USAGI ON 1 'A' 1T

This editor assumes the scratch file for the current partition number (@scr#i on #s) exists, this will usually exist, but if not it will error out and you will have to create the scratch file as well, it's also an ASCII type file. After the new file has been created, S.TXT can be started. Note how the file and disk number that the file is stored on must be specified.

S.TXT USAGI 1

After S.TXT has started, it will ask for the current folder where the file is stored, at this prompt type we will type O as that is where our file is stored. This will get us to main prompt of TEXT, ready to edit the file (screenshots taken using Meisaka's brilliant emulator).

Editing with TEXT and KOMPOZ

In both editors, the "main" prompt is a - which means it is in "command mode", commands are single letter keys, after pressing the letter, it will either immediately perform an action or show one or more / prompts for lines of input. At any time, pressing LINE FEED (or down arrow), will return to command mode.

Command quick reference

For more detail see below.

Key Action Notes
C Copy lines asks for stop text, copies in to out until stop text is found, displays only stop line.
D Delete/Replace in line asks for optional search text (else whole line), and it's replacement
E End of Out Rewinds output tape, discarding changes to it
F Find input Y/N prompt, Y asks for text to find from input tape. skips input until found. (does not output)
H HTab kompose (TEXT Only) asks for: optional stop text, indent size, key to trigger indent. Switches to edit mode.
I Insert in line asks for optional before_text (else append), and insert text
J Join section asks for bound SYS#, then join label, appends specified section to the output tape
K Kompose lines optional stop text. Appends new lines to output tape.
N Next line output current line, get and show next input line
O Output (KOMPOZ Only) Prompts for formatting and display options, then formats input file
P copy and Preview lines Param: stop, displays and copies in to out until stop text is found.
Q Quit KOMPOZ or TEXT Does what it says on the tin
R Return line Writes current line and clears line buffer.
S Substitute multi lines asks for: replacement, find, stop, wait. Multiline find/replace: copies in to out while also trying substitutions.
T Top of input Rewind the input "tape"
U Show units Displays the file numbers: i.e. IN=SYS000, OUT=SYS001
W Write line Copies current line to the output
X Save/eXchange Copies remaining input to output, rewinds, then swaps the "tapes"
Z Zero line Delete current line

The keys A B G L M V Y are unused, they display ILLEGAL PARAMETER if pressed, but otherwise have no effect.

Composing and saving

If starting with a blank file, at the - prompt: simply press K, showing K/, then NEWLINE (emulator: enter/return) to get into insert / line edit mode, and start typing. Backspace can be used to delete mistakes on lines as they being entered, NEWLINE will write the current line to the output and start a new one. When you are done komposing text, press LINE FEED (emulator: down arrow or Ctrl+J) to return to command mode (the - prompt.) Pressing LINE FEED (or down arrow) works at every editor prompt and will always interrupt the current command and return to the - prompt, this can be used if you pick the wrong command or completely mess up a line. When in edit modes and you press LINE FEED with a partial line of text entered, you will go back to command mode, but the text will be still be present in the buffer, use Z to discard the line. When you are done with your file, press X to commit any pending changes, then press Q to exit. If your code has been typed in, but there is an error or an edit needs to be made to a line, the process is a bit more involved.

Moving around

If you are midway through a file and notice an error earlier within the file:

  1. Press X to save what you have so far and rewind the files.
    • This effectively copies the remainder of the "In" Tape over to "Out" Tape, rewinds both, then switches them.
  2. Press C and then type in some text from either the offending line, or a line before it.
    • You can use P instead if you want to display all lines.
  3. If you landed before the line, Press N until the line you want is displayed.
  4. Make any edits to the line
  5. Continue forward with C, N or P

Common edits

These are done at the main - prompt, usually after you locate a line to start editing at.
After any of these, you can either make more edits throughout the file, or
Press X to write, rewind, and "save", followed by Q to quit.

Append to a line:
  1. Press I then NEWLINE (enter)
  2. Type the text to append followed by a NEWLINE (enter)
Insert at the start of a line:
  1. Press I type the first character of the line, followed by NEWLINE (enter)
  2. Type the text to insert followed by a NEWLINE (enter)
Delete or Replace some text on the current line
  1. Press D then enter a unique snippet of the text you want to remove, followed by NEWLINE (enter)
    • it will remove the first thing looking from left to right
  2. Press NEWLINE (enter) to delete the entire fragment
    • The resulting line is not displayed, so make sure you have an idea of what it will delete.
Rewrite a single line:
  1. Press D then NEWLINE (enter)
  2. Type the replacement line followed by a NEWLINE (enter)
Delete a few lines
  1. Press Z to delete current line
  2. Press N to get next line, once it displays a line you want, you are done, otherwise repeat.
Replace a few lines
  1. Press Z to delete current line
  2. Press N to get next line, repeat 1 and 2 until once it displays the last line you wish to delete.
  3. Press Z to delete last line
  4. Press K and NEWLINE (enter) to start composing the replacement lines
  5. Press LINE FEED (or down arrow) once you finish the last replacement line.
Delete a lot of lines
  1. Press Z to delete the first line
  2. Press F to start a find
  3. Enter some text from the first line you want keep, followed by a NEWLINE (enter)
Find/Replace
  1. make sure you are before everything you want to replace.
  2. Press S
  3. Enter your desired replacement text followed by a NEWLINE (enter)
  4. Enter the text you want to find followed by a NEWLINE (enter)
  5. If you want to cover the whole file, press NEWLINE (enter)
    • If you want to only replace within part of the file, enter some unique text after the last replacement to stop at.
  6. The Wait? prompt is basically asking if you want to be picky or not.

Editing Model

In order to effectively edit a file, it's important to understand how the editor interacts with the file. The editor always maintains 3 elements: the input tape, the current line buffer, and the output tape. Although the input and output may be files on a disk, they are only accessed in sequence from start to finish, the only way to back up is to rewind all the way to the beginning, and then skip forward line by line, so it's a bit more effective to think of them as tapes.

Early model Centurion systems actually used digital streamer tapes to store files, so it's very possible that this editing paradigm originated from those early systems.

  Input                                                      Output
 +---------+                  Current line                  +---------+
 | =====   | Input record     +-----------+   Output record | =====   |
 | ====    | >--------------> | ======    | ------------->  | ====    |
 | ======  |                  +-----------+                 | ======  |
 +---------+                                                +---------+

The input and output tapes can be rewound independently. Rewinding the output tape effectively discards anything that was written to it, this can be used to truncate or delete large portions of the file, or input and output can both be rewound at the same to retry a failed edit. Rewinding the input tape allows duplicating or moving multiple lines, by replaying lines from earlier into the output file. Many shortcut commands exist to read line(s) from the input, possibly change them, and then write them to the output, until EOF or some text is found.

The current line buffer holds whichever line was displayed last while reading the input tape, or "komposing" text. The current line buffer is typically written to the output before being reused, unless explicitly stated otherwise. The current line can be empty, if the current line is empty, nothing is written since empty lines can not appear in files.

The safest, and probably easiest way to edit incrementally, is to have input and output typically remain in sync with one another, making changes to input lines as you come across them, most commands follow this pattern, this usually consists of search, line edits, then swap and rewind (X) when you hit the end of the input.

Command Details

C - Copy lines

  • prompts for a stop text

This copies lines from the input tape to the output tape.
If stop text appears in a line, the line is retained and displayed, and the command ends.
If EOF is encountered, the current line buffer will be empty.

D - Delete and replace in current line

  • optional parameter: search text
  • parameter: replacement

When search word is left empty, this will delete and replace the entire line.
Otherwise it will search the current line for search word, it displays: equality not found, if the line doesn't match.
The first matching search text is deleted and replaced with replacement.

E - End Output

Write the EOF marker to the output tape and then rewind it.

This can be used to retry failed edits, discard changes, or insert lines at the beginning of the file after the fact.

F - Find from input

  • Find? (Y or N) with a - prompt, Y prompts for it's parameter: find text
    This only affects the input tape and current line buffer.
    It will read from the input tape until find text appears in the line, this line is retained in the line buffer.

This command does not write any output, use with care.

This can be used to skip/delete a large number lines, if you only need to skip/delete a few lines, try Z and N.
Also useful for moving large numbers of lines "backwards" in a file, when combined with T and C.

H - Horizontal-Tabbed Compose (TEXT Only, invalid in KOMPOZ)

  • Optional parameter: stop text
  • TAB=/ number parameter (>= 0): amount of indent.
  • TAB CHARACTER=/ optional key character to trigger the tab action (newline to use default: >).

Switches to a line input mode, appending new lines to the output tape.
If stop text was specified and typed in, then return to command mode with the current line retained.
If TAB CHARACTER is pressed while in edit mode, then spaces will be used to fill the line up to the TAB column.
If the line is already longer than the TAB column, then the TAB CHARACTER will have no effect on the line.

Use LINE FEED or the stop text to exit line edit mode and return to command mode.

I - Insert Text

  • optional parameter: search text
  • parameter: insert text When search word is empty, it will append insert text to the current line.
    If search text is specified, it must appear in the current line or equality not found will be displayed.
    The insert text is inserted before the first occurrence of search text.

J - insert a Joins file section

  • parameter: "SYS number", number must be > 1 and must be a valid SYS# to use as the Joins file.

If a valid joins file was specified, it prompts for a section label, if the section is found in the joins file, it will be appended to the output tape.

The Joins file is typically bound with a .USE from JCL before the run, the S.KOMPOZ script automates this for you, S.TXT does not.

K - Kompose text

  • optional parameter: stop text

Switches to line input mode: any current line is written to output, new lines are appended to output in a loop.
If stop word was specified and typed in edit mode, the current line is retained, and the editor switches back to command mode.
Use LINE FEED (down arrow) or the stop text to exit edit mode and return to command mode.

N - Next Line

Writes current line to the output tape then reads the next line from the input tape to into the current line buffer, the newly read line is displayed.

O Formatted Output (KOMPOZ Only, invalid command in TEXT), this command uses the Output Device bound to SYS4

Asks the following:

  • "Continuous forms?" (Answer Y or N)
  • "Inserts?" (Answer Y or N)
  • "Enter copies" (Answer with a number)
  • "Enter starting page" (Answer with a number)
  • "Console display?" (Answer Y or N)
  • "Wait?" (Answer Y or N)
  • "Align forms, type CR" (Answer Y or N).

This reads all lines from the current "input tape" and interprets any formatting flags present, and sends output to the output device. The output device can be a printer, a @LST# file, or anything else that supports output.

P - Preview and Copy lines

  • parameter: stop text

Continuously copies lines from the input tape to the output tape, using the line buffer.
Each line is displayed as it is read in. If the stop word is found in the current line, the current line is retained and the command ends.
This is similar to the C copy command, but with the added display of lines. Useful for getting context or viewing the file.

Q - Quit KOMPOZ or TEXT

The editor scripts ensure that the contents of the "input tape" are written back into the named file that was being edited.
You don't have to keep track of file numbers, you just have to make sure the input has your desired edits in it (by using X).

R - Retained write

Writes the current line buffer to the output. The current line buffer is empty after this action.

S - Substitute multiple lines

  • prompts / for replacement (can be empty)
  • prompts / for search text
  • then it prompts / for stop text (optional)
  • asks "Wait?" (Answer Y or N).

This command is similar to C, in that it copies lines from the input tape to the output tape, but as it goes along, it checks each line:

  • if it finds stop text in the current line or reaches EOF, then the command ends.
  • otherwise it will replace all instances of search text with replacement on the current line, and continue.
  • if you answered Y to the "wait" prompt, then it will display matching lines and prompt (Y/N) for each instance of search text it comes across, allowing you to selectively substitute text.

When the command ends it shows the total number of substitutions made.

T - Top of input

Rewind the input tape. This can make it difficult to navigate, so it has a confirmation prompt.

This can be used to copy multiple lines from earlier in a file to a later point in a file, without having to retype them.
It's easy to mess this up, which could result in many extra lines.

U - Show units

Displays the currently active file unit numbers: i.e. IN=SYS000, OUT=SYS001 In case you get lost... or curious ;)

W - Write current line

Writes the current line to the output tape, the current line buffer is NOT cleared.
This can be used to duplicate single lines, or with other edit commands, write a series of very similar lines.

X - eXchange in/out

This is effectively "save".
It copies all remaining lines from input tape to output tape and then rewinds both tapes. After this operation the roles of the input and output tapes are swapped. Both editors assume the contents of the "input" tape are the canonical contents of the file, this command is the only way to apply changes to the "input" tape.

Z - "Zero" the current line

Clears the current line buffer without writing it, effectively deleting the current line.

KOMPOZ Formatting flags

When these are encountered in a document during formatted output, they affect the style, formatting, and display of text and pages. Some flags require a parameter. There is currently not much information about how these work.

Flag Remarks
.SEC section?
.FLA pfx flag: use pfx instead the of '.' to denote flags
.IND num tabbing related
.TAB num tabbing related
.PAR paragraph
.MAR margin
.DAS ?
.SKI skip ?
.SUB does something with margins
.ESB does something with margins
.NEW new line/page?
.SPA span?
.PAG something with new pages
.LIN num line something
.BOT num bottom spacing?
.TOP num top spacing?
.NUM num set line number?
.CEN center
.HEA heading?
.DOU paragraph related
.SIN paragraph related
.USA no effect
.USW related to .UND
.EUS no effect
.JUS justified
.NOJ not justified
.EOF ends document
.FIL no effect
.INS display from inserts file
.UND ?, underline?
.EUN related to .UND