A Host On-Demand Macro (HOD) is an XML script that allows a Host On-Demand client to interact automatically with a host application running on a terminal emulator session. For example: 3270 Display session, 5250 Display session, VT Display session or CICS Gateway session, and so on.
a) Advantages of using Macro HOD Macro is faster than manual task and with a smaller risk of error
ii. HOD Macro can run unattended
iii. It can be copied and distributed to multiple users
b) Major Components in a HOD Macro i. Macro Manager
ii. Macro Editor
iii. Macro Object
Macro ManagerThere are three editors for coding HOD macro and they are constituted under Macro Manager toolbar.
To see this toolbar in a HOD client, start the client first and then initiate a terminal emulator session (3270 Display session, 5250 Display session, VT session, or CICS Gateway session). Click
View tab and then click
Macro Manager. Macro manager has three important components –
i. Macro Toolbar
ii. Macro Editor
iii. Code Editor
Figure 1: Basic Buttons in the Macro Manager Toolbar
Macro Editor
The Macro Editor is a graphical user interface for editing the parts of a macro. It has four major functional tabs.
i. Macro ii. Screens iii. Links iv. Variables
Figure 2: Macro Editor
Code Editor
The Code Editor provides a text editor interface that allows you to directly edit the XML elements of which a macro is made.
![](https://dw1.s81c.com/IMWUC/MessageImages/fe00ccf7f3d047edb59a58027099bd36.png)
Macro Runtime
The macro runtime is the program module that plays back a macro when a user clicks the Play Macro icon. The Macro Runtime reads the contents of the current macro program and automates the macro playback.
Macro Object
The Macro object is essentially a Java object instance that provides the functionalities to Macro Manager Toolbar, Macro Editor, Code Editor, and the Macro Runtime.
Recording a HOD Macro
Following are the steps to record a HOD Macro using Macro Toolbar:
Step -1: Click the Record macro icon to start recording. The Record Macro window is displayed.
![](https://dw1.s81c.com/IMWUC/MessageImages/739af4593f7d4c519222fb47f9450b1b.png)
Figure 4: Record Macro Icon
Step-2: Select a macro location, such as Personal Library.
Step-3: Select New.
Step-4: Type a name in the Name field, such as “MyMacro.mac”(macro names are case-sensitive).
Step-5: Type a description in the Description field.
Figure 5: Record Macro - Select Macro Location and Macro Name
Step-6: Click OK.
Step-7: In the status line, at the bottom of the session panel, the message “Recording macro” is displayed as shown.
![](https://dw1.s81c.com/IMWUC/MessageImages/30389f9fd5f9478680ea822d5cb9f379.png)
Figure 6: Status Line Message
Step-8: Click the Stop playing or recording macro icon to stop recording.
NOTE: This icon is displayed as a black square with the image of a cassette below it.
Macro recording has been completed.
Playing the recorded HOD Macro
Following are the steps to play back the recorded macro:
Step-1: Verify that the application screen is the Login Page in iSeries where you started recording the macro and the cursor is in the same position.
Step-2: Click Select the macro to run from the drop-down list on the Macro Manager toolbar.
NOTE: This icon is the large downward-pointing arrowhead as shown below:
Figure 7: The Available Macros window is displayed.
Step-3: Under Macro Location, click the location of the macro, such as Personal Library.
![](https://dw1.s81c.com/IMWUC/MessageImages/f134110a9c4d4a739de1d7958be6ded9.png)
Figure 8: Play Macro - Select Macro Location and Macro Name
Step-4: Under Macro List, select the name of the macro, such as “MyMacro.mac”, that you assigned to the macro recorded earlier.
Step-6: Click OK.
Step-7: Verify that the name of the macro that you want to run is displayed as the currently selected macro.
Step-8: Click Play macro icon to play the selected macro.
Step-9: You should see the application screen change quickly to the DB2 for i5/OS Query manager screen
Anikjit MitraTechnical Lead – HACP & HATS