When this edit macro is executed, the subcommands are placed in the
console stack in front of any existing lines. For example, if this macro
were invoked:
$forllat#input
the subcommands would execute in the following order: PRESERVE, TRUNC, TABSET, INPUT. If the subcommands were stacked FIFO (first-in
first-out), the default, the INPUT subcommand would ne the first to
execute (since it is the first command in the stack) and the remaining
subcommands would be read into the file as input lines.
If an EXEC processing error occurs during the execution of an edit
macro, the editor clears the console stack and issues the "STACKED LINES CLEARED" message. An EXEC processing error is one that causes the error
message ERROR IN EXEC FILE filename, LINE nnnn -description
These errors cause the EXEC interpreter to terminate processing. Any
stacked subcommands are cleared before the editor regains control, so
that none of the subcommands are executed, and the file remains
unchanged. You should also ensure that any error handling routines in your edit
macros clear the stack if an error occurs. Otherwise, the editor may begin reading invalid data lines from the stack and attempt to execute
them as EDIT subcom.ands. You should not interrupt the execution of an edit macro by using the
Attention or Enter key, and then entering a command or data line.
Results are unpredictable, and you may inadvertently place unwanted
lines in the stack.
If your edit macro contains a eMS command that is invalid in the CftS subset environment, you receive a return code of -2.
The maxillum number of lines that
varies according to the amount of free
at the time of the stacking request. editor terminates abnormally. you can stack in an edit macro
storage that is available to CMS If you stack too many lines, the
Notes on Using EDIT Subcommands You can use any EDIT subcommand in a macro file, and there is one
special subcommand whose use only has meaning in a macro: the STACK subcommand. For the most part, there is not any difference between
executing an EDIT subcommand from the edit environment, or from an EXEC edit macro. You do have to remember, however, that if you want a
variable symbol on a subcommand line, you must stack that subcommand
using the &STACK control statement rather than following an &BEGSTACK control statement.
Listed below are some notes on using various EDIT subcommands in your
macro files. You may find these notes useful when you design your own
macros.
314 VM/370 CMS User's Guide
!]il!!, Often, you may want to create an edit
macro that alters the characteristics of a file (format, tab settings,
and so on). To ensure that the original characteristics are retained
when the macro has finished executing, you can stack the PRESERVE subcommand as the first subcommand in the stack, and the RESTORE subcommand as the last subcommand in the stack: SBEGSTACK PRESERVE CASE M I A lowercase line RESTORE SEND The PRESERVE and RESTORE subcommands save and reinitialize the settings
for the CASE, FMODE, FNAME, IMAGE, LINEMODE, LONG, RECFM, SERIAL, SHORT, TABSET, TRUNC, VERIFY, and ZONE subcommands.
In an edit macro that issues many subcommands that display lines in
response to CHANGE or LOCATE subcommands, you may want to turn the
verification setting to OFF to suppress displays during the execution of
the edit macro: SBEGSTACK PRESERVE VERIFY OFF RESTORE SEND You would particularly want to turn verification off for a macro that executes in a loop or that issues a global requestQ If you want a line
or series of lines displayed, you can use the TYPE subcommand.
If you have verification set off in an edit macro, then when you
execute it you may not receive any indication that the edit macro
completed execution. The keyboard unlocks to accept your next EDIT
subcommand from the terminal. To indicate that the macro is finished,
you can stack, as the last subcommand in the procedure, a TYPE subcommand, to display the current line. or, if you write an edit macro
that terminates when an end-of-file condition occurs the EOF: message
issued by the editor may indicate the completion of the macro. lIPU!, To change from edit mode to input mode in an edit macro,
you can use the INPUT and REPLACE subcommands. In a fixed-length EXEC file, you must stack these subcommands using the SSTACK control
statement: SSTACK INPUT -- or -- SSTACK REPLACE
If you use either of these subcommands following an 8BEGSTACK control
statement, the subcommand line is padded with blanks to the line length
and the result is a line of blanks inserted into the file.
In a variable-length EXEC file, lines are not padded with blanks, so
the INPUT and REPLACE subcommands with no data line execute the same
following an SBEGSTACK control statement as they do when stacked with
the SSTACK control statement. Section 17. Writing Edit Macros 315
Previous Page Next Page