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
i. 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
There 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
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
The Code Editor provides a text editor interface that allows you to directly edit the XML elements of which a macro is made.
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.
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.
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.
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.
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:
The Available Macros window is displayed.
Step-3: Under Macro Location, click the location of the macro, such as Personal Library.
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
Technical Lead – HACP & HATS