<comment>(edited 14-Jun)
<chapter>(Using Journal Files to Protect Work Sessions\anticipate_chap)
<p>
<x>(Using<xs>journal files)
<x>(Work session<xs>protecting)
<x>(Protecting work session)
<x>(Malfunction<xs>anticipating system)
<x>(System crash<xs>anticipating)
<x>(Crash, system<xs>anticipating)
If you begin your work session as described in Sections 
<reference>(CREATE_SEC\value), <reference>(edit_sec\value), or 
<reference>(editsize_sec\value) and your work session ends abnormally
due to a power failure, user error, or system malfunction, 
you will lose all the work you performed. 
But, if you begin your work session as described below, you can recover all 
or most of the work you performed and then continue with your work session.

<head1>(Beginning Your Work Session\beginjournal_sec)
<p>
<x>(Beginning work session)
<x>(Work session<xs>beginning)
A command line for beginning your work session with journal file
protection has the general format:
<x>(/JOURNAL command option)
<x>(Command options<xs>/JOURNAL)
<syntax>
     EDIT/JOURNAL filespec[/option]
<endsyntax>
<table>
<table_setup>(2\9)
<table_row>(/JOURNAL\can be abbreviated to /JOUR.)
<table_row>(filespec\is an output file specification if you 
want to create a new file or an input file specification if you want to edit 
an existing file.)
<table_row>(/option\can be any option you would
normally include in beginning the work session, except /INSPECT.)
<endtable>
<p>
That format produces a journal file, which will contain all or most of your 
work (the text you type and the changes you make). The journal file will have 
the file name you specify for <code_example>(filespec), but its file type will 
be JOU.
<p>
For example:
<interactive>
<S>(.)<u>(EDIT/JOURNAL WEEK.TXT/CREATE <box>(RET))
<endinteractive>
<p>
KED creates journal file WEEK.JOU, which will contain all or most of your 
work.
<p>
In some cases, you may want to use a different file specification for the 
journal file. A command line to do that has the general format:
<x>(/JOURNAL:filespec command option)
<x>(Command options<xs>/JOURNAL:filespec)
<syntax>
     EDIT/JOURNAL:jou-filespec filespec[/option]
<endsyntax>
<table>
<table_setup>(2\10)
<table_row>(jou-filespec\is the different file specification 
you want to use for the journal file. You can type the file name, or you can 
type the file name and file type. If you type just the file name, the file 
type will be JOU.)
<endtable>
<p>
For example, the following command line creates journal file
RETAIN.JOU:
<interactive>
<S>(.)<u>(EDIT/JOURNAL:RETAIN WEEK.TXT <box>(RET))
<endinteractive>
<p>
Once you create a journal file, if your work session is terminated by an 
error or malfunction, you can use the 
/RECOVER option, as described in <reference>(recoverjournal_sec), to recover 
all or most of the work you performed.

<head1>(Recovering the Work You Performed\recoverjournal_sec)
<p>
<x>(Recovering work performed)
<x>(Work session<xs>recovering work performed)
<x>(Recovering from system crash)
<x>(System crash<xs>recovering from)
<x>(Crash, system<xs>recovering from)
A command line for beginning another work session and recovering all or most 
of the work you performed has the general format:
<x>(/RECOVER command option)
<x>(Command options<xs>/RECOVER)
<syntax>
     EDIT/RECOVER filespec[/option]
<endsyntax>
<p>
If you used a different file specification for the journal file, the general 
format is:
<x>(/RECOVER:filespec command option)
<x>(Command options<xs>/RECOVER:filespec)
<syntax>
     EDIT/RECOVER:jou-filespec filespec[/option]
<endsyntax>
<table>
<table_setup>(2\10)
<table_row>(/RECOVER\can be abbreviated to /REC.)
<table_row>(filespec\is an output file specification if you 
created a new file or an input file specification if you edited an existing 
file.)
<table_row>(jou-filespec\is the file specification you 
used for a different journal file.)
<endtable>
<p>
Either format uses the journal file to produce an output file that will 
contain all or most of the work you performed. The recovery operation starts 
at the beginning of a work session, before KED can execute an initialization 
file and before you can perform any additional work.
<p>
For example, type:
<interactive>
<S>(.)<u>(EDIT/RECOVER WEEK.TXT <box>(RET))
<endinteractive>
<p>
or
<interactive>
<S>(.)<u>(EDIT/RECOVER:RETAIN WEEK.TXT <box>(RET))
<endinteractive>
<p>
KED begins another work session and uses the journal file (WEEK.JOU or 
RETAIN.JOU) to recover all or most of the work you performed. You can then 
continue the work session or end it with an EXIT command.
<p>
A recovery operation does not automatically stop on an error, so you should 
watch your screen and check for any missing changes as the operation is being 
performed.
The recovery operation reperforms the editing session and displays the
session as it progresses. You can press <key>(HOLD SCREEN) or <key>(CTRL/S)
to interrupt the recovery operation if you want to examine some part
of the recovery more closely. Pressing again <key>(HOLD SCREEN) or
pressing <key>(CTRL/Q) resumes the recovery operation.
<p>
You can terminate the recovery operation, if necessary, by twice
pressing <key>(CTRL/C). Terminating recovery leaves you in the editor
at that point in the file, so you can begin editing. If you terminated
recovery because you noticed some correctable error in the work
session you are recovering, you can issue the QUIT command, edit the
journal file to correct the error, and restart the recovery operation.
<p>
Also, before you start a recovery operation:
<list>(unnumbered)
<le>Make sure the conditions that existed during your previous work session 
still exist.
<p>
Did the command line that began your previous work session execute an 
initialization file? If so, your command line for beginning the recovery 
operation should execute the same file.
<p>
During your previous work session, did you copy text to any auxiliary files? 
If so, those files should not contain any required text that cannot be 
replaced.
<p>
Did you also insert text or execute macros from any auxiliary files? If so, 
those files must exist in their previous condition.

<le>If the error or malfunction occurred while you were 
creating a new file, an output file was not produced. Therefore, you should 
use the following command line to begin the recovery operation.
<interactive>
<S>(.)<u>(EDIT/CREATE/RECOVER output-filespec <box>(RET))
<endinteractive>
<le>In the rare circumstance that
you were editing an existing file and you think that the error
or malfunction occurred after the input file type was renamed to BAK 
but before the output file could be closed, use the following command line 
to see if the output file was produced.
<interactive>
<S>(.)<u>(DIRECTORY input-filename.* <box>(RET))
<endinteractive>
<p>
Use the EDIT/INSPECT command to look at any files displayed by the
DIRECTORY command. 
<endlist>

<head1>(Recovering the Work You Performed and Journaling Any Additional Work)
<p>
<x>(Recovering work performed<xs>journaling additional work)
<x>(Work session<xs>recovering work performed<xs>journaling additional work)
<x>(Recovering from system crash)
<x>(System crash<xs>recovering from)
<x>(Crash, system<xs>recovering from)
You can recover the work you performed and at the same time produce a new 
journal file that will contain the work you recovered and any additional work 
you might perform. A command line to do that has the general format:
<syntax>
     EDIT/JOURNAL/RECOVER filespec[/option]
<endsyntax>
<p>
or
<syntax>
     EDIT/JOURNAL:jou-filespec/RECOVER:jou-filespec filespec[/option]
<endsyntax>
<p>
If the new journal file and the old journal file (the recovery file) have the 
same file name and file type, KED changes the file type of the old journal 
file to JBK. For example, you can type:
<interactive>
<S>(.)<u>(EDIT/JOURNAL/RECOVER WEEK.TXT <box>(RET))
<endinteractive>
<p>
or
<interactive>
<S>(.)<u>(EDIT/JOURNAL:RETAIN.REC/RECOVER:RETAIN.REC WEEK.TXT  <box>(RET))
<endinteractive>
<p>
In either example, the old journal file will have the JBK file type (WEEK.JBK 
or RETAIN.JBK). In the first example, the new journal file will have the JOU 
file type (WEEK.JOU). In the second example, the new journal file will have 
the REC file type (RETAIN.REC).

<head1>(Changing the Journal Process)
<p>
<x>(Changing<xs>journal process)
<x>(Journal process<xs>changing)
When you begin your work session as described in 
<reference>(beginjournal_sec), KED counts and stores the text you type and 
the changes you make in a journal buffer that can contain a minimum of 512 
characters (some systems allow a larger number). When the count reaches a 
<x>(Modification count)
certain number of modifications (the default is 10) or when the journal buffer 
<x>(Journal file<xs>contents of journal buffer)
<x>(Files<xs>journal<xs>contents of journal buffer)
becomes full, KED moves the contents of that buffer to the journal file. 
Later, when you end your work session with an EXIT or QUIT command, KED 
deletes the journal file.
<p>
The following sections tell you how to:
<list>(unnumbered)
<le>Change the modification count that determines when the contents of the 
journal buffer will be moved to the journal file.
<le>Move the contents of the journal buffer to the journal file without 
waiting for the modification count to be reached.
<le>Save the journal file when you end your work session with an EXIT or QUIT 
command.
<endlist>

<head2>(Changing the Modification Count)
<p>
<x>(Changing<xs>modification count)
<x>(Modification count<xs>changing)
To change the modification count that determines when the contents of the 
journal buffer will be moved to the journal file:
<x>(SET FREQUENCY number command)
<x>(Commands<xs>SET FREQUENCY number)
<list>(numbered)
<le>Press <box>(GOLD) and <box>(COMMAND).
<le>Type:
<interactive>
<u>(SET FREQUENCY number)
<endinteractive>
<p>
<code_example>(number) is the new modification count you want KED to use in 
determining when the contents of the journal buffer will be moved to the 
journal file. The highest number allowed is 511. Low numbers can affect system 
performance, depending on the device you specified for the journal file.
<le>Press <box>(ENTER).
<p>
KED changes the modification count to the number you specified.
<endlist>
<p>
In other words:
<list>(simple)
<le><CODE_EXAMPLE>(<box>(GOLD) <box>(COMMAND) SET FREQUENCY number 
<box>(ENTER))
<endlist>

<head2>(Moving the Contents of the Journal Buffer to the Journal File)
<p>
<x>(Moving contents of journal buffer to journal file)
<x>(Moving<xs>contents of journal buffer to journal file)
<x>(Journal buffer<xs>moving contents to journal file)
<x>(Buffers<xs>journal<xs>moving contents to journal file)
To move the contents of the journal buffer to the journal file without waiting 
for the modification count to be reached:
<x>(WRITE JOURNAL command)
<x>(Commands<xs>WRITE JOURNAL)
<list>(numbered)
<le>Press <box>(GOLD) and <box>(COMMAND).
<le>Type:
<interactive>
<u>(WRITE JOURNAL)
<endinteractive>
<le>Press <box>(ENTER).
<p>
KED moves the contents of the journal buffer to the journal file you 
specified when you began your work session.
<endlist>
<p>
In other words:
<list>(simple)
<le><CODE_EXAMPLE>(<box>(GOLD) <box>(COMMAND) WRITE JOURNAL 
<box>(ENTER))
<endlist>

<head2>(Saving the Journal File\savejournal_sec)
<p>
<x>(Saving<xs>journal file)
<x>(Journal file<xs>saving)
<x>(Files<xs>journal<xs>saving)
If you terminate your work session normally
(if you end your work session with an EXIT or QUIT command), KED 
does not save the journal file.

<subhead1>(To save the journal file when you plan to end your work session 
with an EXIT or QUIT command:)
<x>(SET JOURNAL SAVE command)
<x>(Commands<xs>SET JOURNAL SAVE)
<list>(numbered)
<le>Press <box>(GOLD) and <box>(COMMAND).
<le>Type:
<interactive>
<u>(SET JOURNAL SAVE)
<endinteractive>
<le>Press <box>(ENTER).
<p>
KED will save the journal file you specified when you began your work session, 
after you enter an EXIT or QUIT command.
<endlist>
<p>
In other words:
<list>(simple)
<le><CODE_EXAMPLE>(<box>(GOLD) <box>(COMMAND) SET JOURNAL SAVE 
<box>(ENTER))
<endlist>
<p>
If you do not use the SET JOURNAL SAVE command to save the journal file, you 
can still save it by using one of the following commands to end your work 
session.

<subhead1>(To save the journal file when you decide to end your work session 
with an EXIT command:)
<x>(EXIT SAVE command)
<x>(Commands<xs>EXIT SAVE)
<list>(numbered)
<le>Press <box>(GOLD) and <box>(COMMAND).
<le>Type:
<interactive>
<u>(EXIT SAVE)
<endinteractive>
<le>Press <box>(ENTER).
<p>
KED saves the output file and the journal file you specified when you began 
your work session.
<endlist>
<p>
In other words:
<list>(simple)
<le><CODE_EXAMPLE>(<box>(GOLD) <box>(COMMAND) EXIT SAVE <box>(ENTER))
<endlist>

<subhead1>(To save the journal file when you decide to end your work session 
with a QUIT command:)
<x>(QUIT SAVE command)
<x>(Commands<xs>QUIT SAVE)
<list>(numbered)
<le>Press <box>(GOLD) and <box>(COMMAND).
<le>Type:
<interactive>
<u>(QUIT SAVE)
<endinteractive>
<le>Press <box>(ENTER).
<p>
KED does not save the output file, but it saves the journal file you specified 
when you began your work session.
<endlist>
<p>
In other words:
<list>(simple)
<le><CODE_EXAMPLE>(<box>(GOLD) <box>(COMMAND) QUIT SAVE <box>(ENTER))
<endlist>

<head1>(Restrictions)
<x>(Restrictions, journal process)
<x>(Journal process<xs>restrictions)
<p>
The following operations are invalid.
<list>(unnumbered)
<le>Using the /JOURNAL or /RECOVER command option with the /INSPECT file 
specification option
<le>Using the @ or LOAD command to execute a journal file
<le>Copying a journal file with the COPY/ASCII command
<endlist>
<p>
In addition, any commands that change the journal process must be
placed at the end of an initialization file.
Any such commands cause all
subsequent commands in the file to be skipped unless the file was
executed by an EDIT command with the /JOURNAL option.

<head1>(Example)
<p>
This section summarizes most of the information in this chapter by providing 
an example of the steps necessary for recovering all the work you performed 
before a system crash or similar malfunction.
<p>
Each step has two parts.
<list>(numbered)
<le>An instruction to complete
<le>The keys you must type to complete the instruction
<endlist>
<p>
The keys you must type are presented in a horizontal line, and the strings of 
letters and numbers you must type are not enclosed by boxes.
<list>(numbered)
<le>Begin your work session to edit file WEEK.TXT.
<interactive>
<S>(.)<u>(EDIT/JOURNAL WEEK.TXT <box>(RET))
<endinteractive>
<p>
KED displays:
<interactive>
<s>(<cpos>(M)onday was cold and rainy.
On Tuesday, it snowed.
Wednesday was sunny and hot.
On Thursday, the lilacs bloomed.)
<endinteractive>
<le>You add a line of text at the bottom of the file.
<interactive>
<u>(Friday was just like Monday, cold and rainy. <box>(RET))
<endinteractive>
<le>You decide to decrease the modification count, thereby increasing the 
number of times that KED moves the contents of the journal buffer to the 
journal file.
<code_example>
<box>(GOLD) <box>(COMMAND) SET FREQUENCY 5 <box>(ENTER)
<endcode_example>
<le>You add another line of text at the bottom of the file.
<interactive>
<u>(On Saturday, it snowed again and the wind was very strong. <box>(RET))
<endinteractive>
<le>Anticipating a system malfunction, you decide to move the contents of the 
journal buffer to the journal file without waiting for the new modification 
count to be reached.
<code_example>
<box>(GOLD) <box>(COMMAND) WRITE JOURNAL <box>(ENTER)
<endcode_example>
<le>The malfunction occurs. Simulate it by typing:
<code_example>
<box>(GOLD) <box>(COMMAND) QUIT SAVE <box>(ENTER)
<endcode_example>
<le>After resolving the simulated
problem, you restart your system and then recover all 
the work you performed.
<interactive>
<S>(.)<u>(EDIT/RECOVER WEEK.TXT <box>(RET))
<endinteractive>
<p>
KED displays:
<interactive>
<s>(Monday was cold and rainy.
On Tuesday, it snowed.
Wednesday was sunny and hot.
On Thursday, the lilacs bloomed.
Friday was just like Monday, cold and rainy.
On Saturday, it snowed again and the wind was very strong.<cpos>( ))
<endinteractive>
<le>Finally, you add another line of text at the bottom of the file and then 
end your work session.
<interactive>
<u>(On Sunday, we decided to leave New England. <box>(RET))
<endinteractive>
<code_example>
<box>(GOLD) <box>(COMMAND) EXIT <box>(ENTER)
<endcode_example>
<endlist>
