The ISRMASK macro (Figure 1) allows data
in the mask line to overlay lines. It can be used to place a comment
area over existing lines in a member.
Before starting this macro, you must specify two things: a mask
line and the range of lines it overlays. See MASKLINE—Set or Query the Mask Line for information on creating mask
lines.
Specify the range of lines by using either an OO or $$ line command.
You can use O, OO, On, or $, $$, $n,
where n is the number of lines.
An O line command specifies that mask line data overlays only blanks
in the line data. A $ line command specifies that nonblank mask line
data overlays the line data. Once the mask line and range of lines
have been specified, type ISRMASK on the command
line and press Enter.
Figure 1. ISRMASK macro/*********************************************************************/
/* */
/* 5647-A01 (C) COPYRIGHT IBM CORP 1995, 2003 */
/* */
/* ISRMASK - Overlay a line with data from the mask line. */
/* Use either line command 0 or $ to indicate */
/* which line to overlay. 0 causes nondestructive */
/* overlay, and $ causes a destructive overlay. */
/* */
/*********************************************************************/
ISREDIT MACRO NOPROCESS /* Wait to process */
ISREDIT PROCESS RANGE O $ /* "O" and "$" reserved */
IF &LASTCC = 0 THEN /* for macro */ +
DO /* If specified, get */
ISREDIT (CMD) = RANGE_CMD /* command entered and */
ISREDIT (FIRST) = LINENUM .ZFRANGE /* line number range */
ISREDIT (LAST) = LINENUM .ZLRANGE
DO WHILE &FIRST LE &LAST /* Loop to merge data */
/* based on which line */
/* command was entered.*/
IF &CMD = $ THEN /* If $ overlay data */ +
ISREDIT LINE &FIRST = (LINE) + MASKLINE
ELSE /* - else */ +
ISREDIT LINE &FIRST = MASKLINE + (LINE)
/* do not overlay */
SET FIRST = &FIRST + 1 /* Increment line num */
END
SET RC = 0
END
ELSE /* Set prompt messages */ +
DO
SET ZEDSMSG = &STR(ENTER "O"/"$" LINE CMD)
SET ZEDLMSG = &STR("ISRMASK" REQUIRES AN "O" OR +
"$" CMD TO INDICATE LINE(S) MERGED WITH MASKLINE)
ISPEXEC SETMSG MSG(ISRZ001)
SET RC = 12 /* Set return code to 12 */
END /* to keep command in */
EXIT CODE(&RC) /* command area */
This list explains the logical sections of the ISRMASK macro:
- The NOPROCESS keyword on the MACRO command allows the macro to
control when user input (changes to data and line commands) is processed.
ISREDIT MACRO NOPROCESS
- Now process user input and check if certain line commands are
entered. The O and $ following the RANGE keyword specify the line
commands to be processed by this macro.
ISREDIT PROCESS RANGE O $
- A zero return code shows that you entered an O or $ in any of
its valid forms: OO-OO, On,
and so forth.
IF &LASTCC = 0 THEN
- &CMD is set to O or $, whichever command was entered.
ISREDIT (CMD) = RANGE_CMD
- &LINE1 and &LINE2 contain the first and last line numbers
of the lines specified by the user line commands.
ISREDIT (FIRST) = LINENUM .ZFRANGE
ISREDIT (LAST) = LINENUM .ZLRANGE
DO WHILE &FIRST LE &LAST
- Each line that you specify is merged with data from the mask line.
Note the use of the LINE keyphrase on both sides of the assignment.
The line command entered controls how the data is merged. An O specifies
that the mask line data only overlays where the line contains blanks.
A $ specifies that nonblank mask line data overlays line data.
IF &CMD = $ THEN
ISREDIT LINE &FIRST = (LINE) + MASKLINE
ELSE
ISREDIT LINE &FIRST = MASKLINE + (LINE)
- When no line command is entered, issue a prompt message. Set a
return code of 12 to keep ISRMASK displayed on the command line.
SET ZEDSMSG = &STR(ENTER "O"/"$" LINE CMD)
SET ZEDLMSG = &STR("ISRMASK" REQUIRES AN "O" OR +
"$" CMD TO INDICATE LINE(S) MERGED WITH MASKLINE)
ISPEXEC SETMSG MSG(ISRZ001)
SET RC = 12
In the example shown in Figure 2, the
mask line is specified and the range of lines is set with the destructive
$$ line command.
Figure 2. ISRMASK macro - before running
When you press Enter, the macro overlays the mask line onto the
specified range of lines, as shown in Figure 3.
Figure 3. ISRMASK macro - after running