REDO


REDO

     Allows the user to edit and re-execute any command still
retained in the command line history stack.

SYNTAX


REDO [[CMD=]cmdid][[;EDIT=]editstring]

NOTE

     This command follows the more flexible MPE/iX command line
syntax. Refer to the MPE/iX Commands Reference Manual
(32650-90003) for more information.


PARAMETERS


cmdid Specifies the command to execute. The command may
be specified by its relative or absolute order in
the command line history stack, or by name (as a
string).

Command Directives
----------------------------------------------------
CMDID EXECUTES

(omitted) Previous command (same as Redo -1)

-n The nth command before the most
recent one. N is a number in the
command line stack relative to
the most recent command, which is
-1.

m Command number m in the command
line stack. The number m is
absolute (not relative).

string The most recent command beginning
with string.
---------------------------------------------------

The default is -1, the most recent command.

MPE/iX detects an error if you specify a cmdid that
cannot be found in the history stack.

editstring A string specifying the first (of one or more)
edit(s) to be performed on cmdid before it is
displayed on the standard listing device ($STDLIST).
When the (edited) command line is displayed, you may
edit the line interactively, much as you did in MPE
V/E. Like its MPE V/E counterpart, REDO displays
the command line and accepts further edits
repeatedly, until you signal completion by entering
a [Return] only. When all edits have been performed,
the edited version of the command is re-executed.

If you omit editstring, then you are given the
opportunity to edit the command line interactively,
as you would with the MPE V/E version of REDO,
after which the command is re-executed.

If you specify editstring, it must appear, character
for character, and space for space, exactly as it
would if you were using REDO's interactive mode.
The edit string must be surrounded by quotation
marks (" ") if it contains any scanner/parser
delimiters such as , ; " ' [ ] or = or spaces.

The editing directives used in editstring are
described in the table below.

-----------------------------------------------------------------------
Directive Effect on the current line
-----------------------------------------------------------------------

i<text> INSERT. Inserts <text> at the position to the
left of the i.

r<text> REPLACE. Uses <text> to perform a one-for-one
character replacement beginning at the position
of the r.

c CHANGE. Changes all occurrences of one string to
another when the search string and replace string
are properly delimited with a non-alphabetic
character such as ', ", /, and so on. Specify
c<delim>search-string<delim>replace-string<delim>
to substitute characters. Or, to delete all
occurrences of the search string without
substitution, omit the replace string.

d DELETE. Deletes a character. You may specify
multiple d's to delete a series of characters.
Or, you may type multiple d's, followed by spaces,
then followed by more d's to delete some
characters while skipping others. You may follow
this directive with other edits.

dw DELETE WORD. Deletes a word starting at the
letter d. A word is defined as all characters
except a space, comma, or semicolon. If you
place the d directly beneath a word delimiter,
then the word and the delimiter characters are
deleted. If no word exists on the command line,
no delete occurs. You may follow this directive
with other edits.

d<delim> DELETE TO DELIMITER. Deletes all characters
starting at the position of the d and ending at,
but not including, the specified delimiter. If
<delim> is not found, no delete occurs. You may
follow this directive with other edits.

d> DELETE TO EOL. Deletes to the end of the current
line from the position specified by d. You may
follow this directive with other edits.

^ UPSHIFT. Upshifts the character positioned at
the ^. You may specify multiple ^'s to upshift
a series of characters. Or, you may type multiple
^'s, followed by spaces, then followed by more ^'s
to upshift some characters while skipping others.
You may follow this directive with other edits.

^w UPSHIFT WORD. Upshifts the word starting at the
position specified by ^. A word is defined as
all characters except a space, comma, or semicolon.
If you place the ^ directly beneath a word
delimiter, the delimiter is skipped and only the
word is upshifted. If no word exists on the
command line, no upshift occurs. You may follow
this directive with other edits.

^<delim> UPSHIFT TO DELIMITER. Upshifts all characters
starting at the position specified by the ^ and
ending at, but not including, the specified
delimiter. If <delim> is not found, no upshift
occurs. You may follow this directive with other edits.

^> UPSHIFT TO EOL. Upshifts all characters starting
from the position specified by the ^ to the end of
the current line. You may follow this directive
with other edits.

v DOWNSHIFT. Downshifts the character positioned at
the v. You may specify multiple v's to downshift
a series of characters. Or, you may type multiple
v's, followed by spaces, then followed by more v's
to downshift some characters while skipping others.
You may follow this directive with other edits.

vw DOWNSHIFT WORD. Downshifts the word starting at
the position specified by v. A word is defined as
all characters except a space, comma, or semicolon.
If you place the v directly beneath a word
delimiter, the delimiter is skipped and only the
word is downshifted. If no word exists on the
command line, no downshift occurs. You may follow
this directive with other edits.

v<delim> DOWNSHIFT TO DELIMITER. Downshifts all characters
starting at the position of the v and ending at,
but not including, the specified delimiter. If
<delim> is not found, no downshift occurs. You
may follow this directive with other edits.

v> DOWNSHIFT TO EOL. Downshifts all characters
starting from the position specified by the v to
the end of the current line. You may follow this
directive with other edits.

><text> APPEND TO EOL. Appends the text to the end of
the current line. If > is positioned beyond the
end of the current line, then a replacement is
performed instead.

>d DELETE FROM EOL. Deletes from the end of the
current line, right-to-left. You may specify
multiple d's and follow this directive with other edits.

>dw DELETE WORD FROM EOL. Deletes the last word in
the command line. To find the last word, trailing
word delimiters are skipped. If no word exists in
command line, then none is deleted. If you follow
>dw with additional editing directives, each edit
is performed recursively. That is, the first edit
is performed (updating the current EOL), then the
next edit is performed (again updating the current
EOL), and so on.

>d<delim> DELETE TO <delim> FROM EOL. Starting at the end
of the current line, deletes all characters
right-to-left up to, but not including, <delim>.
If <delim> is not found, no delete occurs. If you
follow >d<delim> with additional editing
directives, each edit is performed recursively.
That is, the first edit is performed (updating
the current EOL), then the next edit is performed
(again updating the current EOL), and so on.

>^ UPSHIFT FROM EOL. Upshifts the character at the
current EOL. You may specify multiple ^'s to
upshift a series of characters (read right-to-left)
from the EOL. Also, you may follow this directive
with other edits.

>^w UPSHIFT WORD FROM EOL. Upshifts the last word in
the command line. You may follow this directive
with other edits.

>^<delim> UPSHIFT TO <delim> FROM EOL. Starting at the end
of the current line, upshifts all characters
right-to-left up to, but not including, <delim>.
If <delim> is not found, no upshift occurs. You
may follow this directive with other edits.

>v DOWNSHIFT FROM EOL. Downshifts the character at
the current EOL. You may specify multiple v's to
downshift a series of characters (read right-to-
left) from the EOL, and you may follow this
directive with other edits.

>vw DOWNSHIFT WORD FROM EOL. Downshifts the last word
in the command line. You may follow this directive
with other edits.

>v<delim> DOWNSHIFT TO <delim> FROM EOL. Starting at the
end of the current line, downshifts all characters
right-to-left up to, but not including, <delim>.
If <delim> is not found, no downshift occurs. You
may follow this directive with other edits.

>r<text> REPLACE AT EOL. At the end of the command line,
this directive replaces the exact number of
characters specified in <text> with <text>.

u UNDO. A single u in column one cancels the most
recent edit of the current line. Using the UNDO
command twice in a row cancels all edits for the
current line and re-establishes the original,
unedited line. If u is placed anywhere other than
column one of the current line, then a simple
replacement is performed. UNDO makes sense only if
you have a line on which you have performed some
editing that can be "undone."

<char> SIMPLE REPLACEMENT. When you enter any other
character that is not used in an editing directive,
(i.e. i, r, d, ^, v, d>, >, >d, c, or u), <char>
simply replaces the existing character at that
position in the command line. In fact, simple
replacement also occurs for the editing characters
i, r, c, or > if they are not followed by text; or
if you type > at or beyond the current end of line.


OPERATION

     Re-executes the command specified by cmdid.  The user may
specify an optional edit string to edit the command before
it is re-executed. This command is a companion to the
enhanced MPE/iX version of DO. Unlike DO, this command
permits interactive editing.

If editstring is specified, the edit will be performed on
cmdid before the command is re-executed. The editstring
must appear exactly as it would if you were using the REDO
command interactively.

In either case, the (edited) line is echoed to $STDLIST
before it is re-executed. At this point, you may edit the
line interactively. The interactive (editing) mode, remains
available to you until you press only [Return].

Both cmdid and editstring must be surrounded by quote marks
(" or ') if they contain any delimiters such as , ; " '
[, ], =, or a space.

This command is available in a session or in BREAK, but not
in a job or from a program. Pressing [Break] aborts the
execution of this command.

EDITING SAMPLES

Practical uses of the editing commands listed above are shown here

Editing Samples for REDO

EDIT ACTION

u First occurrence undoes the previous edits. The u
must be in column one.

u Second occurrence undoes all edits on the current
line. The u must be in column one.

rxyz Replaces the current text with xyz starting at the
position of r.

xyz Replaces the current text with xyz starting at the
position of x.

ixyz Inserts xyz into the current line, starting at the
position immediately before the i.

ddd Deletes three characters, one above each d.

d xyz Deletes a single character above the d, skips one
space, then replaces the current text with xyz
starting at the position of x.

ddixyz Deletes two characters, then inserts xyz in the
current line in the position before the i.

d d Deletes one character above the first d, skips two
spaces and deletes a second character above the
second d. It does not delete a range of characters,
making it unlike the MPE V/E version of REDO.

^wix Upshifts the word above the ^ and inserts an "x"
at the end of the word it just upshifted.

v/abc Starting at the position of V, downshifts all
characters up to, but not including, the "/", then
replaces the "/" and the next two characters with "abc".

d d>xyz Deletes a single character above the first d, skips
two spaces and deletes to the end of the line
beginning at the second d, and then appends xyz to
the end of line.

>xyz Appends xyz to the end of the current line.

>ddxyz Deletes the last two characters from the end of the
current line and then appends xyz to the end of the line.

>rxyz Replaces the last three characters in the current
line with xyz.

>ixyz Appends xyz to the end of the line. In this case,
the i command is superfluous, because > accomplishes
the same result. Using >xyz would be sufficient.

>dwxyz Deletes the last word of the current line and appends "xyz".

c/ab/def Changes all occurrences of ab to def, starting at c.
c"ab" Deletes all occurrences of "ab" starting at c.

cxyz Replace the current text with cxyz, starting at c.
Because delimiters have been specified (as they were
in the previous two examples), this is a simple replacement.

>dw^.dw Deletes the last word in the current line,
recalculates the EOL, then upshifts all characters
up to, but not including, the dot (.), then deletes
the word to the left of the characters that were upshifted.


EXAMPLE(S)

REDO pas            Edits the the most recent command beginning with the
string pas.

REDO 10 Edits command number 10 (absolute) on the command
history stack.

REDO -2 Edits the second-to-last command on the stack (one
command before the most recent).

REDO , "c/$null/$STDLIST" Change all occurrences of $null to $STDLIST
in the most recent command before editing it.

REDO run, ">;debug" Append ;debug to the the most recent RUN command
and then edit it.

ADDITIONAL INFORMATION

Commands:   DO, LISTREDO, HPREDOSIZE variable