Execute ISPF Edit Macro

A tool of type Execute ISPF Edit Macro should be defined in an action which itself is defined as a global action with an ISA_Editor_Action relation so that it is added to the editor’s context menu. In the ISA_Editor_action relation, you can define the file suffixes for which the editor action should apply.

A tool of type Execute ISPF Edit Macro copies the current content from the active editor to a temporary data set on the remote system and then applies a user defined ISPF edit macro to this remote data set. Afterwards the potentially-changed content of the remote file is transferred back to the client and replaces the current content of the editor from where the content was originally taken.

The current cursor position is exchanged between the client and the remote system. That means that the current cursor position in the active editor is read at the beginning of the tool and sent to the remote system. On the remote system the cursor will then be placed in that position in the temporary data set right before the execution of the ISPF edit macro starts. After the ISPF edit macro has finished, the cursor position is read out of the remote editor and pushed back to the client machine, which then puts the cursor in that same position in the client editor after its content is replaced.

Tool Attributes:

Attribute Type Description
Edit Scenario [M] Selection Specifies in which scenario the edit macro tool is executed. This can be either in a local or remote edit scenario.

A remote edit scenario means that the content of the editor is directly retrieved from an MVS resource. The temporary resource is created in the remote edit scenario as follows. The temporary data set has the same data set attributes as the original file but is allocated with less space. If the editor contains a member of a partitioned data set, the temporary file is a partitioned data set with a member that has the same name as the member that is being edited. The name of the remote temporary data set is derived from the name of the parameter file data set. See Master configuration syntax section in the Local Master Configuration topic for more information.

A local edit scenario means that the content of the editor is retrieved from a local file. See the attribute Target File Type for more information

Valid values:

  • Remote Edit (Default)
  • Local Edit
Target File Type [O] Selection This attribute is only required if the tool is executed in a local edit scenario.

This attributes defines how the required temporary MVS resource is created.

If the Target File Type is set to Temporary Resource, either a SEQ-dataset or a partitioned data set member will be created at the defined location, with the physical name defined in the file descriptor and static attribute values. If the target already exists the content of the resource is overridden.

If the Target File Type is set to Template Resource, the data set attribute values of the template resource are used to create the new temporary resource. If the template resource is a SEQ-dataset, the same data set attributes are used as the original file, but the data set is allocated with less space. If the template is a member of a partitioned data set, the temporary file is a partitioned data set with a member that has the same name as the template member. The name of the remote temporary data set is derived from the name of the parameter file data set. See Master Configuration for more information.

Valid values:

  • Temporary Resource (Default)
  • Template Resource
Input Parameter Separator String The delimiter to be used for separating edit macro parameters. This is only relevant if two or more macro parameters are specified.

For better visual identification, double-quote characters can be used before and after the delimiter. The quotes are removed at run time. It is also possible to specify multi-character delimiters.

The default value is " " (blank)

Output Parameter Separator String The delimiter which is used by the edit macro to separate output parameters when more than one output parameter is returned.

The default value is " " (blank)

Parameters:

Parameter Name I/O Type Description
Macro Name [M] I String Name of the ISPF Edit Macro. Maximum length 8 characters.
Target Resource [O] I File The Target MVS resource. This input parameter is only required in case of a local edit scenario. The edit macro runs against a temporary MVS resource which is created based on this input parameter. See the attribute Target File Type for more information.
Macro Parameter [O] I String Every parameter following the macro name is interpreted as a parameter for the ISPF macro and all parameters are concatenated in the same sequence as they appear in the model with the Input Parameter Separator between them. That parameter list is then passed to the ISPF edit macro.
Output Parameter [O] O String Output parameter which is returned by the edit macro. Several output parameters are expected to be separated by the Output Parameter Seperator defined as attribute of the Execute ISPF Edit Macro tool.

An edit macro can pass its output parameters via the Shared Pool variable TAUMACOP to the AWM ISPF edit macro tool interface.

Example:

The EXEC library of the MFA server installation contains the edit macro sample EDPJCL which parses a JCL PO member and checks if the data sets referenced by DSN= or DSNAME= exist on the MVS system.

The sample shows how to pass and return parameters to and from an edit macro.

The tool must be modelled as follows:


Modelled tool

The edit macro generates an error feedback file and returns its name as an output parameter. This name can be used to specify an MVS sequential file descriptor:


Error Feedback File

This error feedback file can be used as a file input parameter of a subsequent tool of type Process Error Feedback from the AWM function package. The complete error feedback action will look like this:


Error Feedback Action

The action has to be referenced by a global editor action like this:


Editor Action

This example shows how an edit macro can be combined with the error feedback tool in order to show messages dependent on the editor content.

This solution could typically be used as a work around for the restriction that INFOLINEs, NOTELINEs, and MSGLINEs generated by the called edit macro are not displayed in the Eclipse editor.