TSO-ISPF JCL COBOL VSAM DB2 CICS Tools Articles Job Portal Forum Quiz Interview Q&A

ISREDIT Macro In Rexx


ISREDIT MACROS:

You can use edit macros, which look like ordinary editor commands, to extend and customize the editor. You create an edit macro by placing a series of commands into a data set or member of a partitioned data set. Then you can run those commands as a single macro by typing the defined name in the command line.

EDIT MACROS:

  • Edit macros are used to extend and customize the editor.

  • You create an edit macro by placing a series of commands into a data set or member of a partitioned data set.

  • Edit macros can contain edit assignment statements that communicate between a macro and the editor.

  • Edit macros can be either REXX EXECs , or program macros written in a programming language (such as FORTRAN, PL/I, or COBOL).

  • Edit macros have access to the dialog manager and system services.

  • All edit macros must have an ISREDIT MACRO statement as the first edit command.

You can use edit macros to:

  • Perform repeated tasks

  • Simplify complex tasks

  • Pass parameters

  • Retrieve and return information


Assignment Statements:

The Assignment statements Consists of two parts, values and key-phrases, which are separated by an equal sign. The Value segment is the data in the macro and key-phrase segment represents the data in the editor.

These are used to pass data from the edit macro to the editor or to transfer data from the editor to the edit macro and the data is always transferred from the right hand side of the equal sign in an assignment statement to the left hand side.

Example:

"ISREDIT (data) = LINE .ZCSR"

The data in the current line is stored in the variable data. So the value segment is data, Key- phrase segment is LINE and hence the transfer of data is from the editor to the edit macro.


Example: ISREDIT Macro In Rexx

/*****************************REXX********************************/
/* This macro is used to save a member of a PDS when in view mode*/
/*****************************************************************/
'isredit macro'	                /* No arguments	                 */
address isredit                 /* Changing the host environment */
"(mem) = MEMBER"                /* storing member name in mem    */
"(dsn) = DATASET"               /* storing dsname is dsn         */
If mem = '' then do             /* if mem is spaces,its PS       */
      say 'designed for PDS member'
      exit                      /* exit from program             */
end

"isredit save"                  /* trying to save the source     */
if rc = 0 then do               /* Not in view mode              */
      say 'Not in view mode.use SAVE'
      exit                      /* Exit from the program         */
end

"isredit repl .zf .zl " mem     /* Issuing replace command       */
if rc = 0 then                  /* check for success             */
      say 'member saved.Exit from view mode'
else
      say 'member not saved.Return code ' RC
exit

The macro can be used to save a member of a PDS, when it is opened in view mode and checks whether the dataset being edited is a PDS. It also checks whether the EDIT is in VIEW mode by trying to save the dataset. After these checks, the REPL command is issued.


Create and Execute a Macro:

The creation of sample macro program see in the below.

/*REXX*/
"ISREDIT MACRO (STRING)"         /* STRING IS THE PARAMETER */
"ISREDIT X ALL"                  /* EXCLUDE ALL LINES */
"ISREDIT F ALL " STRING          /* FIND ONLY PARM PASSED */
EXIT

This macro is very simple one and uses EXCLUDE and FIND macro commands. It displays only the lines with the string passed to the macro.

To execute a Macro ensure that the library where the Macro is created is concatenated with the SYSEXEC or SYSPROC library and the Macro can be executed by typing the name on the command line. The macro can also be invoked from a REXX program. By using macros option, the dataset can be opened in view or edit mode.


If you have any doubts or queries related to this chapter, get them clarified from our Mainframe experts on ibmmainframer Community!

Are you looking for Job Change? Job Portal