As a developer using Host Access Transformation Services (HATS), you can add macros into your HATS application. It is good to use macros in application to boost them and make applications user friendly.
A macro is an XML script that defines a set of screens. Each screen includes a description of the screen, the actions to perform for that screen, and the screen or screens that can be presented after the actions are performed. Or in general, Macros are tiny programs that you can record to do repetitive tasks faster and more efficiently.
HATS supports macro-based customization to speed up and customize the host application process. Macros can be used for the following functions:
Types of Macros
Prompt macros contain steps to request input from users during the host session. They can also set prompts from a user list. For example, you can use a prompt macro to ask a user for a user ID and password before logging into a host application.
Prompt macros can also be used by developers to provide constant values or values obtained from global variables.
Extract macros contain events to extract host screen information as a string, as a list of strings, or as a table. For example, you can use an extract macro to connect to a directory-type host application and extract the results of doing a search in the directory. Macros recorded or imported in HATS Toolkit are saved in a HATS macro (.hma) file. You can see the macros defined in your project by expanding the Macros node in the HATS Projects view of the HATS Toolkit.
Naming Convention for Macros
One thing that often confuses users that are just starting to use macros is what to name the macro. It’s a good idea to name the macro something descriptive, but you do have to follow few rules.
That’s it! You can’t name a macro something like 654578@&, but you can name it Macro_Zone.
HATS provides three different editors you can use to view and modify HATS macros, the Macro Editor, the Advanced Macro Editor, and the Visual Macro Editor. The Visual Macro Editor is the default editor for HATS macros. When you double-click on the name of a macro, the Visual Macro Editor is opened.
To open the Macro Editor, right-click on the name of the macro and select Open With > Macro Editor.
Using The Macro Editor you can create or work with your macro using the host terminal. Once the terminal opens, you can use any of the icons on the toolbar to record and create your macro.
The Advanced Macro Editor (AME) gives you the ability to set macro and screen-level attributes, edit screen descriptions; and add actions, links (next screen connections), and variables.
The basic Macro Editor can be opened by right-clicking on the macro and selecting Open With -> Macro Editor. The Advanced Macro Editor can then be opened from the Macro Editor Overview page. Prompts and Extracts can also still be edited from the Macro Editor.
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.
The Visual Macro Editor (VME) gives you the ability to visually develop HATS macros. The VME combines many of the features of the HATS host terminal, basic Macro Editor, and Advanced Macro Editor, and allows for offline development of macros. It also allows flows to be copied between macros and provides drag-and-drop support for adding new screens. The VME is the default editor for HATS macros. When you double-click on a macro object (.hma file), the VME opens.
The VME is composed of the four parts:
Creating a Macro
You can edit the macro further using any of the HATS macro editors.
Click File > Save (or press Ctrl + S) to save the macro script.
Importing a macro
You can also import macros recorded with other programs, such as the IBM® WebSphere® Host Publisher or IBM Host On-Demand. To import these macros, select File > Import > HATS > HATS Macro and click Next to display the Import a HATS Macro dialog. Click Add and navigate to the location of the macro on the file system.
You can export HATS macros as well as IBM WebSphere Host Publisher or IBM Host On-Demand macros or HATS macro. To export these macros, select File > Export > HATS > HATS Macro or File > Export > HATS > Host Publisher/HOD Macro and click Next. Host Publisher macros are typically in a directory path \hostpub\Studio\IntegrationObjects. These macros are exported as .macro files. This file extension works for both Host Publisher and Host On-Demand, but Host On-Demand uses as a default looks for .mac files.
Select the Macro files to export along with the destination. You can select to overwrite the existing resources by selecting the Overwrite existing resources with warning check box.
Click Finish when done.
Running a macro is one of the actions that you can specify to be performed when a host screen matches a screen customization’s recognition criteria. When you record a macro, be sure that the final screen is not the screen that is recognized by the screen customization that has the macro defined as the action. If the recognized screen is the final screen of the macro, a loop will be created.