Macro is a program written in REXX on TSO/ISPF that is in your REXX library. The library is allocated to the DDNAME SYSPROC or SYSEXEC.
A macro mainly gives commands to the TSO/ISPF Editor. It can give commands to TSO and ISPF as well, but we are mostly interested in talking to the Editor.
Macros saves time, keystrokes and also Used to perform often repeated tasks.
The very first statement after the initial comment must be a command that tells the editor that this is a Macro.
/*REXX*/ ADDRESS ISREDIT "MACRO" |
A parameter or argument is passed to the macro just as arguments are passed to a regular REXX exec.
The following steps will set up a standard REXX library, so that REXX execs can be invoked from the TSO/E command line by member name only:
/***********************************REXX*******************************/ /* Allocate User REXX Library to SYSEXEC */ /***********************************REXX*******************************/ "ALLOC FI(SYSEXEC) DA(REXX.EXX,'',"'LIB1','LIB2','LIB3') SHR REUSE" IF RC = 0 THEN ZEDSMSG = 'SYSEXEC allocated' ELSE ZEDSMSG = 'SYSEXEC allocation failed' "ISPEXEC SETMSG MSG(ISRZ000)" RETURN |
Identify any existing libraries allocated to SYSEXEC:
TSO ISRDDN |
Allocate a Fixed Block, 80-byte PDS called: userid.REXX.EXEC
Allocate the user REXX library to SYSEXEC:
TSO EX REXX.EXEC(SETUP) EX |
Parameters can be passed to the EDIT macro using the statement 'ISREDIT MACRO(parm)' Suppose the macro name copymem and If it is invoked as Command ====> COPYMEM MYFIRST then MYFIRST is assigned to the variable 'parm'.we can pass more than one variable at a time.
If there are more variable names than parameters, the unused variables are set to nulls. The macro statement should be the first executable statement in a macro.
A Label is an alphabetic string character used to name lines and must begin with a period (.) and be followed by no more than 8 alphabetic characters, the first of which cannot be Z. No special characters or numeric characters are allowed.
The editor-assigned labels are as denoted in the table.
Editor Assigned Labels | |
---|---|
.ZCSR | The data line on which the cursor is currently positioned |
.ZFIRST | The first data line, can be abbreviated to .ZF |
.ZLAST | The last data line, can be abbreviated to .ZL |
.ZFRANGE | The first line in the range specified by the user |
.ZLRANGE | The last line in the range specified by the user |
If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!