Introduction

As a developer using Host Access Transformation Services (HATS) Studio, you can incorporate macros into your HATS application. HATS User's and Administrator's Guide introduces the use of macros in HATS and describes how to create and modify basic macros. This guide describes advanced macro editing functions that you can perform using the advanced macro editor. This tool provides a graphical user interface with which you can modify or add features to each screen interaction with the host application. This guide is extracted from Host On-Demand Macro Programming Guide, from IBM WebSphere Host On-Demand Version 9, with sections modified to match the implementation of the advanced macro editor within HATS Studio.

You might want to use the advanced macro editor to make any of these changes to your HATS macros:

Working with macros in HATS

You can work with macros in several different ways within HATS Studio:

Note:
The advanced macro editor is not synchronized with the HATS macro editor. This means that when you make a change in the advanced macro editor, it will not be reflected immediately in, for example, the source view. When you save and exit one editor, the changes will be reflected in the other.

The advanced macro editor is a graphical user interface (with buttons, input fields, list boxes, and so on) for editing the parts of a macro. Figure 1 shows the advanced macro editor.

Figure 1. Macro Editor

The macro editor

Definitions of terms

Here are the definitions of a few terms that you will encounter in this book.

Table 1. Definitions of terms
action An action is an instruction that specifies some activity that the macro runtime is to perform when it plays back the macro (such as sending a sequence of keys to the host, displaying a prompt in a popup window, capturing a block of text from the screen, and other actions). You can edit or create actions in the advanced macro editor. You can view and modify individual action elements in the source view. See Macro actions.
Note:
An action within a macro is not the same thing as an action triggered by a HATS event.
application screen An application screen is a meaningful arrangement of characters displayed on the host terminal by a host application. See Application screen.
descriptor A descriptor is an instruction that describes one characteristic of an application screen. Descriptors are also called screen recognition criteria. You can edit or create descriptors in the Macro Editor. See Introduction to the Description tab.
host terminal A connection in HATS Studio to the host application where you record and run macros.
macro runtime The macro runtime is the program module that plays back a macro when the macro is started. Specifically, the macro runtime reads the contents of the current macro script and generates the macro playback.
macro screen A macro screen is a set of instructions that tells the macro runtime how to manage a particular visit to a particular application screen. See Macro screen.
macro script A macro script is an XML script in which a macro is stored. You can edit a macro script directly using the source view or indirectly using the advanced macro editor. When you play a macro, the macro runtime executes the instructions in the script. See Macro script.
source view The source view shows the XML source of a macro. To use it, open the HATS macro editor (not the advanced macro editor described in this book) by double-clicking the name of a macro in the HATS Project View. Click the Source tab to open the source view and work with the XML source of the macro.
valid next screen A valid next screen is a macro screen that, during macro playback, is a valid candidate to be the next macro screen to be processed. See Closer look at stage 1.

Samples

This book contains macro code samples throughout.

You can create a new macro by copying a macro script from this document. This section assumes that you are copying an entire macro script, beginning with <HAScript> and ending with </HAScript>. Follow these steps.

  1. In HATS Studio, select your HATS project and open the host terminal.

  2. Record a simple macro to use as a holder for the script:

    1. Click Record Macro.

    2. The status line on the host terminal window should say, "Recording macro".

    3. Click Stop Macro.

    4. Click Save Macro.

  3. Edit the macro that you just recorded.

    1. Double-click the name of the macro that you just recorded in the Macros folder in the HATS Project View.

    2. Click the Source tab at the bottom of the editor to open the source view.

    3. In the source view, delete the lines beginning with <HAScript> and ending with </HAScript>.

    4. Copy the entire text of a macro script from this document to the system clipboard, using whichever method you are accustomed to.

    5. Paste the macro script into the source view.

    6. Click File > Save (or use Ctrl-S) to save the macro script.

You can edit the macro further using the source view, the host terminal, or the advanced macro editor.

This book focuses on 3270 applications

Although macros can be used with 3270 Display sessions, with 5250 Display sessions, and with VT Display sessions, this book focuses almost entirely on 3270 Display sessions and 3270 host applications.