Creating an XEDIT Macro
You can write execs to be used with XEDIT. These execs are known as XEDIT macros. You use them when you use the editor to create or edit a file. These execs have a file type of XEDIT rather than EXEC. You must use the REXX language or the EXEC 2 language when you write XEDIT macros. Otherwise, they are like ordinary execs.
For example, the following macro places continuation characters
on specified lines in the correct column of COBOL or FORTRAN files.
(For clarity, XEDIT commands are in upper case.)
/* CONTCHAR XEDIT */ Mainpart:
'SET MSGMODE OFF'
'PRESERVE'
numlines = 1
if arg() > 0 then numlines = arg(1)
'EXTRACT/FTYPE/'
col = 72
if ftype.1 = 'COBOL' then col = 7
if ftype.1 = 'FORTRAN' then col = 6
'SET TRUNC' col
'SET ZONE' col col
'CHANGE/ /*/' numlines
'RESTORE'
'SET MSGMODE ON'
exit
This is what the macro does:
- The message display option (SET MSGMODE) of the Editor is set off when you use the macro. Thus, its execution appears like a regular XEDIT subcommand.
- The
PRESERVEcommand ensures that the settings of the various XEDIT variables, such as line length, are retained until theRESTOREcommand is executed. - If an argument is supplied, the variable
numlinesis set to its value. Otherwise, it remains equal to 1. - The XEDIT subcommand
EXTRACTmakes the file type of the file being edited available in the variableftype.1. - The variable
colis set to6,7, or72. This value defines the truncation column and then to set the zone. - The
CHANGEsubcommand causes continuation characters to be included. The macro ends by resetting the environment to its original state.