User-Written Edit Macros You can create the edit macros shown below, for your own use in CMS. You may want to refer to them as examples when you are learning to write
your own macros. The macros have not been formally tested by IBM; they
are presented for your convenience only. $MACROS The $MACROS edit macro verifies the existence of and describes the usage
of edit macros. If you enter:
$macros
it lists the filenames of all the edit macros on your accessed disks.
If you enter:
$macros name1 name2
it displays, for each valid
usage. (This macro assulles respond to a ? request.)
instruction is:
macro name entered, the macro format and
that all macros have heen designed to
The format of the $MICROS edit macro $MACROS filename
[filename1 (filename2 (filenamen]]]
is the filename(s) of macro files whose usage is to
displayed. If filename is omitted, the filenames of
available macro files are listed.
To create $MACROS, enter:
edit $macros exec
and in input mode, enter the following:
320 IBM VM/370 CMS User's Guide
be
all
$MARK &CONTROL OFF &IF &INDEX EQ 1 &IF &1 EQ ? &GOTO -TELL
&IF &INDEX GT 0 &GOTO -PARTIC
* &BEGTYPE ALL EXEC FILES STARTING WITH A DOLLAR-SIGN ARE AS FOLLOWS. FOR INFORMATION ON ONE OR MORE OF THEM, TYPE: $MACROS FILENAMEl <FILENAME2>
&END LISTF $* EXEC * (NOHEADER FNAME)
&EIIT
*
-PARTIC &TRIP = 0 &INDEll = 0 * &LOOP -ENDLOOP &INDEI &INDEXl = &INDEXl + 1 &SUB = &SUBSTR &&INDEll 1 1
&IF &SUB EQ $ &GOTO -STATIT &TIPE &&INDEI1 IS INVALID &TRIP = 1 &GOTO -EHDLOOP -STATIT STATE &&INDEXl EXEC *
&IF &RETCODE EQ 0 &GOTO -CALLIT &TYPE &&INDEX1 NOT FOUND &TRIP = 1 &GOTO -EHDLOOP -CALLIT EIEC &&INDEX1 ? -ENDLOOP *
&EIIT &TRIP
* -TELL &BEGTYPE '$MACROS' HANDLES THE '$MACROS' REQUEST. TYPE '$MACROS' ALONE FOR MORE INFORMATION. &END
&EIIT
The $MARK edit macro inserts from one to six characters, starting with
the current line and in the column specified, for a specified number of
records. If there is data already in the columns specified, it is
overlayed. If you enter:
$mark
the macro places an asterisk (*) in column 72 of the current line. If
you enter:
$mark 10 30 abc
the macro places the string ABC beginning in column 30 in each of ten
records, beginning with the current record. The format of the edit macro instruction is: r- r- r- ", $MARK I n I col I char I I I 111 III * III L L L .J.J.J Section 17. Writing Edit Macros 321
Previous Page Next Page