The PROCESS macro command allows the
macro to control when line commands or data changes typed at the keyboard
are processed.
Syntax
Macro command syntax
>>-ISREDIT--PROCESS--+------+--+-----------------------+-------><
'-DEST-' '-RANGE--cmd1--+------+-'
'-cmd2-'
- DEST
- Specifies that the macro can capture an A (after) or a B (before)
line command that you enter. The .ZDEST label is set to the line preceding
the insertion point. If A or B is not entered, .ZDEST points to the
last line in the data.
Note: If the PROCESS macro command is issued within a line macro,
see separate note.
- RANGE
- Must be followed by the names of one or two line commands, either
of which you can enter. Use the RANGE_CMD assignment statement to
return the value of the line command entered. This allows the macro
to define and then capture a line command that you enter. It can also
modify its processing based on which of the two commands was entered.
Note: If the PROCESS macro command is issued within a line macro,
see separate note.
- cmd1 and cmd2
- Specifies one or two line command names, which can be 1 to 6 characters;
however, if the name is 6 characters long it cannot be used as a block
format command (to specify multiple lines) by doubling the last character.
The name can contain any alphabetic or special character except blank,
hyphen (-), or apostrophe ('). It cannot contain
any numeric characters.
The .ZFRANGE label is set to the first
line identified by the line command that you have entered, and .ZLRANGE
is set to the last line. They can refer to the same line. If the expected
RANGE line command was not entered, .ZFRANGE points to the first line
in the data and .ZLRANGE points to the last line in the data.
- Note:
- Sequence of processing when PROCESS command issued within a
line macro
If the PROCESS command is issued within a line
macro, it sets the DEST and RANGE labels, but does not influence the
normal processing order of line commands. Line commands that appear
before the user line command will have already been executed, and
line commands that occur after the user line command are not executed
until the user line command macro has completed.
For more
information, see Working with an edit line command table.
Description
If
a line is retrieved before the PROCESS macro command is called, changes
made to this line will not be seen. The DEST and RANGE operands allow
the macro to identify the line commands that you can enter as additional
input to the macro.
This command cannot be specified without
first coding the MACRO command with a NOPROCESS operand.
For
more information about using the PROCESS command, see Using the PROCESS command and operand.
Return codes
- 0
- Normal completion.
- 4
- A RANGE was expected by the macro, but one was not specified;
default values set.
- 8
- A DEST (destination) was expected by the macro, but one was not
specified; default values set.
- 12
- Both a RANGE and a DEST (destination) were expected by the macro,
but were not specified; default values set.
- 16
- You entered incomplete or conflicting line commands.
- 20
- Severe error
Note: ISPF does not consider
a return code of 12 from the PROCESS edit macro command an error and
does not terminate a macro that receives a return code of 12 from
the PROCESS edit macro.
Examples
To set up the macro to process
the line commands * and # (defined by the macro writer):
ISREDIT MACRO NOPROCESS
ISPEXEC CONTROL ERRORS RETURN
ISREDIT PROCESS RANGE * #
IF &LASTCC >= 16 THEN EXIT CODE(&LASTCC)
ISREDIT (CMD) = RANGE_CMD
ISREDIT (FIRST) = LINENUM .ZFRANGE
ISREDIT (LAST) = LINENUM .ZLRANGE
IF &STR(&CMD) = &STR(*) THEN -
...
To place data depending on the location
of the A (after) or B (before) line command:
ISREDIT MACRO NOPROCESS
ISREDIT PROCESS DEST
ISREDIT LINE_AFTER .ZDEST = "&DATA"
To allow
processing of the A and B destination line commands and the specification
of a range by using the * line command (defined by the macro writer):
ISREDIT MACRO NOPROCESS
ISREDIT PROCESS DEST RANGE *
See Using the PROCESS command and operand.