WebSphere HATS Developer Guide v4
WebSphere HATS Developer Guide v4
® ®
IBM WebSphere Host Access
Transformation Server
Developer’s Guide
Version 4
SC31-6324-00
® ®
IBM WebSphere Host Access
Transformation Server
Developer’s Guide
Version 4
SC31-6324-00
Note
Before using this information and the product it supports, be sure to read the general information under Appendix D,
“Notices” on page 159.
To view the documentation before you install HATS, insert the HATS CD and
choose View Documentation from the Welcome screen.
Find the most up-to-date versions of this document, frequently asked questions
(FAQs), white papers, and additional information at the product Web site:
[Link]
Using HATS, you can wrap your host application “green screen” with Web-style
borders and add headings, company logos, and links to other Web sites. Global
text replacement on the host screen enables you to give your application a custom
feel. Users can skip unnecessary host screens and be prompted for input. You can
also choose to present any host screen element (such as host application function
keys) in a fully-interactive, Web-style output (such as links) and define where users
will see the output in the application. HATS gives you the control to fully
customize your host application and enhance the ways in which users work with
applications.
The foundation of HATS is the HATS Studio. The HATS Studio provides you with
all of the necessary tools to create, assemble, and transfer host applications to the
production system for deployment. The resulting host application can be accessed
by end users with standard Web browsers.
Note: If a macro uses skip-screen processing, those screens are not subject to
these steps.
You should familiarize yourself with the basic principles of screen customization
before beginning the development process. The core elements of setting screen
recognition criteria are discussed in Chapter 4, “Editing a screen customization” on
page 17.
You can create folders within these high-level folders to help organize your project.
For instance, as you create screen captures for your project, you might want to
create folders under the Screen Captures folder to organize and group the captured
screens. To create a folder, right-click on one of the high-level folders in the tree
and select New HATS > Folder. To move a file into a different folder, right-click
on the file and select move, or you can use the drag-and-drop method. You can
create folders under any of the high-level folders to help organize your files.
HATS projects, created in HATS Studio, are extensions of Web projects in the
WebSphere Studio workbench. For more information about Web projects, open the
Help perspective in the WebSphere Studio workbench and select Application
Developer Documentation. Expand the sections as follows to find information on
Web projects: Concepts > Projects > Web projects.
By default, all HATS applications are stored in one Enterprise Archive file,
[Link]. When you assemble your applications and deploy them on WebSphere
Application Server (WAS), the [Link] file contains a Web Archive (.war) file
with the resources to run each application, as well as one copy of the HATS
run-time executable code. If you prefer, you can organize your applications
differently, either each in its own .ear file, or in some other combination.
Note: If your .ear file contains the .war files for multiple applications, which is the
default setting, your WebSphere Application Server (WAS) administrator
must use WAS administration to configure the server with Module
Visibility set to Application. If the server is not configured this way, your
applications will not run. Your end users will get the following error
message in their browser: HTTP 404 - File not found when trying to run an
application.
Which .ear file your project files go into is determined when you create the project.
On the first panel of the Create a HATS Project wizard, you can keep the Use
Note: Make sure you select the project, and not the .ear file with the same
name.
7. Click OK.
If you want to move a project to another machine with WebSphere Studio installed,
you must export the project as a .zip file before sending the project to another
machine. The following steps explain how to export a project and import it into a
WebSphere Studio installed on another machine.
Consider the effect of the following on your server machine when deciding how to
arrange your projects:
The settings displayed in the project editor are the settings that are used for the
entire project. If you want to modify any of the settings, you can use the tabs of
the project editor to do so. Changes made in the project editor are automatically
recognized when using Run on Server in the HATS Studio by clicking Refresh on
the application keypad or by displaying a new host screen in the browser.
The following sections describe each tab of the project editor, and explain how they
can be used to modify the project settings.
Overview tab
The Overview tab of the project editor summarizes all of the settings you specified
when you created your project. The only item you can modify on this tab is the
description of your project.
Each of the section headings on the Overview tab is a link to the other tabs of the
project editor.
The host name and port number fields are entry fields. You can change the name
of the host to which your project connects or the port number through which your
project connects by typing over the name and number that appear in these fields.
The type of session, code page, and screen size fields have drop-down lists from
which you can select certain values for the fields.
The SSL enabled checkbox allows you to enable or disable SSL by checking or
clearing the checkbox. If SSL is enabled, you can import the required certificate file
using Import. Refer to Chapter 13, “Enabling SSL security” on page 53 for more
information.
Click the Enable print support checkbox if you want print support.
For 3270 hosts, if you check the Enable print support checkbox, you can choose
the paper size, page orientation, and the print font you want to use for printing
jobs from your project from the drop-down lists for each parameter. Refer to
“Defining print support for your project” on page 45 for more information.
For 5250 hosts, if you check the Enable print support checkbox, you must specify
the URL of the iSeries™ for Web Access (IWA) Printer Output window. The default
URL is [Link] where hostname is the name of the
5250 host. The end user of your application can set print options in the IWA
Printer Output window. Refer to “Defining print support for your project” on
page 45 for more information.
You can add, modify, or remove any IBM WebSphere Host On-Demand session
parameters using the buttons to the right of the table of parameters. If you click
Add, you can select a parameter using the drop-down list next to the Name field.
For a list of the valid parameters that you can add and their descriptions, see
“<otherParameters> tag” on page 110.
Template tab
The Template tab displays the template used to surround a transformation when
applying a transformation is the action of a screen customization in your project.
On this tab, you can change which template to use as the default template.
The default template is the template applied to all transformations in the project,
and the template applied with the default transformation as the default action of
the unmatched screen event. For infomation on how to modify the action of the
unmatched screen event, see “Screen customization ordering” on page 23.
Note: Care should be taken when using text replacement. Text replacement with a
disparate number of characters in the strings can cause changes in the
HTML representation of the screen. Depending on the widget used for
presenting a region of a screen, text on a line of the screen could be
contracted, expanded, or forced to a new line.
You can add, modify, or remove any text replacement specifications by using the
buttons to the right of the table of values.
Note: If you select a bi-directional (BIDI) code page, refer to “Additions to HATS
files” on page 86.
If the checkbox next to the name of a screen customization is checked, that screen
customization is enabled for the project. When a screen customization is enabled,
and the screen recognition criteria match the host screen, HATS performs the
actions specified for that screen customization, and no more screen customizations
are checked for matches. When a screen customization is disabled, HATS ignores
the screen customization. If you want to test certain screen customizations, you
might want to disable other screen customizations. If so, clear the checkbox while
you are testing.
HATS applications check each incoming host screen against the list of screen
customizations. If there are multiple screen customizations that match a given
screen, the first screen customization that matches the screen is applied. The higher
priority screen customizations should be near the top of the list. For example, you
might have one screen customization that recognizes a few specific screens, and a
second one that recognizes a more general set of screens. If the second screen
customization is higher in the list than the first, a screen might be recognized by
the more general screen recognition criteria and perform the associated actions,
rather than recognizing the screen by the more specific criteria and performing the
associated actions of the first screen customization.
If you want to change the priority of any of the screen customizations, highlight
the screen customization by clicking it. Then click either Up or Down to move the
screen customization higher or lower in the list.
General tab
The General tab displays the settings for host components, widgets, keypads,
keyboard support, and client locale.
You can customize the default project settings for each of these by clicking on the
node in the customization settings tree. To change settings for individual host
components and widgets, you must expand them in the tree to see the individual
host components and widgets. Some of the host components and widgets do not
You can override the default project settings for host components and widgets
when you insert them into transformations. Those modified settings only apply to
the individual instances of those host component or widget in the transformation.
All the other instances of the host component or widget for any transformation in
the project still use the default project settings, unless you modify them. For
example, you have default settings for the VisualTable component. In a single
transformation, you may have two VisualTable components; one that uses the
default settings from the project settings, and another that uses modified settings.
Application keypad
You can customize the following settings for the application keypad:
Show default application keypad
Click the checkbox if you want a default application keypad defined in
templates or transformations to be displayed in the HTML output when
users interact with your application.
Select keys to display
If the Show default application keypad checkbox is checked, you can click
the checkboxes next to each of the keys that you want to include on the
default application keypad in the HTML output.
Display as
Select the value from the drop-down list to determine whether the selected
keys display as buttons or links.
Host keypad
You can customize the following settings for the host keypad:
Show default host keypad
Click the checkbox if you want a default host keypad defined in templates
or transformations to be displayed in the HTML output when users
interact with your application.
Select keys to display
If the Show default host keypad checkbox is checked, you can click the
checkboxes next to each of the keys that you want to include on the
default host keypad in the HTML output. If you want to include all the
available keys, you can click Select all. You can click Deselect all to clear
all of the boxes that are checked.
Display as
Select the value from the drop-down list to determine whether the selected
keys display as buttons or links.
Keyboard support
You can customize the following settings for keyboard support:
Turn keyboard support on
Click the checkbox if you want your end users to be able to use the
physical keyboard keys to interact with the host. This enables the end user
to click representations of host aid keys, such as the function, SYSREQ, or
ATTN keys. However, if keyboard support is turned on, the end user will
Client locale
You can customize the following settings for the client locale:
Select where to acquire the language to display button captions and messages
Click one of the following radio buttons:
From the browser’s “Accept-Language” header
The language used to display button captions and messages is
determined by the language specified by the end user’s browser.
From the server’s primary locale
The language used to display button captions and messages is
determined by the locale of the machine where the application is
deployed.
Always use the following language
You can select the language to use for button captions and
messages from the drop-down list.
Source tab
The Source tab displays the tags and values in the [Link] file for all the
settings you selected or defaulted to in your project. As you make changes on
other tabs in the project editor, the tags and values displayed in the source file
change to match.
You can also make changes to the tags and values in the source file, and they are
reflected on the appropriate tabs of the project editor. For information about the
tags in the [Link] file, refer to “Application files (.hap)” on page 105.
When you created your project in HATS Studio, you used the Create a HATS
Screen Customization wizard to define screen customizations. The recognition
criteria and the actions you defined for the screen customization were saved in a
screen customization (.evnt) file. You can use the screen customization editor to
view and modify those criteria and actions.
You can see the screen customizations you have created by expanding the Screen
Customizations node of the HATS Project View tab of the HATS Studio. You can
invoke the screen customization editor by double-clicking on the name of the
screen customization.
The following sections describe each tab of the screen customization editor.
Overview tab
The Overview tab of the screen customization editor summarizes all of the
information you specified when you created your project. It contains the name and
description of the screen customization, the name and an image of the screen that
was used to create the screen recognition criteria, a summary of the screen
recognition criteria, and a summary of the actions to be taken when the screen is
recognized. On this tab, you can modify the description of the screen
customization, and you can select a different screen to associate with the screen
customization. The selected screen is the screen that is used whenever you make
changes to the screen customization, such as modifying the screen recognition
criteria, or adding actions.
Each of the section headings on the Overview tab is a link to the other tabs of the
screen customization editor.
Field criteria
You can use the total number of fields on a screen, the total number of input fields
on a screen, or both as screen recognition criteria. These are the first two criteria
shown on the Screen Recognition Criteria tab.
Note: If you are using field criteria to recognize screens that have a certain
number of fields, and another screen does not contain the same number of
fields, that screen is not recognized. For example, one screen might have a
list of 10 files with 10 fields. If the host displays a screen with only eight
files in the list and eight fields, the second screen does not match the
number of fields criterion of the screen customization that matched the first
screen.
For an explanation of the Optional and Invert checkboxes, see “Optional versus
non-optional screen recognition criteria” on page 19 and “Inverted match of screen
recognition criteria” on page 19.
For an explanation of the Optional and Invert checkboxes, see “Optional versus
non-optional screen recognition criteria” on page 19 and “Inverted match of screen
recognition criteria” on page 19.
If you highlight a row of the table and click Edit, or if you click Add, the Screen
Recognition Criterion dialog appears. In the dialog panel, you can either modify
or specify text string information. The panel shows the screen selected on the
Overview tab.
You can select any text on the screen by drawing a rectangle around the text. Place
your cursor at any point on the screen, click and hold the left mouse button, and
move the cursor to another location on the screen to draw the rectangle. The fields
on the right of the dialog show the text you selected and the starting and ending
row and column numbers of the rectangle. You can specify the part of the screen
that should contain the text by clicking one of the radio buttons for Anywhere on
the screen, At a specified position, or Within a rectangular region. If the text you
selected must be case-sensitive to be recognized as matching the screen recognition
criteria, click the Case sensitive checkbox.
For an explanation of the Optional and Invert checkboxes, see “Optional versus
non-optional screen recognition criteria” on page 19 and “Inverted match of screen
recognition criteria” on page 19.
If you have both optional recognition criteria and non-optional recognition criteria,
HATS checks the non-optional criteria first. If all the non-optional criteria match,
the screen matches. If at least one of the non-optional criteria does not match,
HATS checks the optional criteria. For a screen to match the criteria, HATS must
find all non-optional criteria, or at least one optional criterion. Otherwise, the
screen fails to match. The following example explains this concept in greater detail.
Suppose you defined cursor position location and two text strings with the values
shown in the following example:
Cursor position recognition Optional
Row: 1 Column: 1
String 2: Username
Start position: Row 20 Column 10
End position: Row 20 Column 17
In this example, HATS must find both text strings or the cursor position for the
screen to match. Because HATS checks non-optional criteria first, HATS looks for
the text strings first. If HATS cannot find both text strings in the specified regions
of the host screen, then it checks to see if the optional criterion (cursor position)
can be found.
Conversely, if you do not check the Invert checkbox, the recognition criterion must
match the screen for the criterion to be considered true..
How you use the Invert checkbox corresponds to the Host On-Demand screen
descriptor attribute, invertmatch.
Actions tab
During project creation or customization, when you specified screen recognition
criteria that HATS uses to match host screens, you also defined the actions to be
taken when the host screen is recognized. The Actions tab of the screen
customization editor displays the actions that you defined for the screen
You can add, edit, or remove actions on this tab. Choose from the following
actions:
v Apply transformation
v Insert global variable (or a text string onto the host screen)
v Extract global variable
v Set global variable
v Execute business logic
v Show a URL
v Play a macro.
To play a macro, click the checkbox and select the name of the macro to play from
the drop-down list. If you define a macro to be played as an action of this screen
customization, it is the last action applied. You can record macros in the HATS
Studio using the host terminal. You can also import macros created with other
programs, such as the IBM WebSphere Host Publisher Host Access application or
IBM Host On-Demand MacroManager. For more information on importing macros,
see Chapter 8, “Incorporating macros” on page 37.
All other action types and their descriptions are shown in the table on the Actions
tab. If you highlight a row of the table and click Edit, the Edit xxx Action dialog
appears. where xxx is one of the following:
v Apply
v Insert
v Extract
v Set
v Execute
v Show.
If you click Add, the Add Action dialog appears. The dialog panel shows the
screen selected on the Overview tab. In this panel, you can select the action you
want to occur from the drop-down list. Depending on the action you choose, the
rest of the panel displays information that you can specify for that action.
Note: You cannot change the action in the Edit xxx Action dialog. You can only
change the information that applies to the action.
The Template field has “(default template)” selected by default. Unless you select
a different template to be applied with this particular transformation, the template
that surrounds the transformation in the browser window is the template you
specified as the default template for the project. The drop-down list contains all the
templates defined in the project.
If you want host keys pressed by the end user of your project to be sent to the host
immediately instead of waiting until all actions have been performed, click
Note: Inserting information onto a host screen must occur before any
transformation occurs for the global variable to appear in the Web page. See
“Actions tab” on page 19 for information on modifying the order of the
actions.
If the value of the global variable is indexed (contains a list of strings), click
Advanced. You must select one of the radio buttons to specify whether all of the
strings are inserted at the specified position one after the other or if the strings are
inserted as separate lines into a rectangular region of the screen.
For more information about global variables, see Chapter 7, “Interacting with
global variables” on page 35.
To specify how text extracted from multiple rows of the host screen is defined in a
global variable, click Advanced. You must select one of the radio buttons to specify
if the extraction should be treated as one string or as a list of strings (indexed). If
you selected an existing global variable in the Name field before you clicked
Advanced, you must select one of the radio buttons specifying how HATS should
handle the extracted data.
There are four options for handling extracted data for existing variables:
v Overwrite the existing value with this new value
v Overwrite the existing value with this new value, starting at the specified index
v Append this new value to the end of the existing value
v Insert this new value into the existing value, at the specified index.
For either of the options that use a specified index, you must enter the number of
the index in the Index field.
The following example illustrates how the variable value is modified based on the
option you choose. Start with an existing indexed variable named “sample”. The
values of “sample” are “a b c d”. The “a” in the value has an index of 0, so the
value of “sample[0]” is “a”, and the “b” in the value has an index of 1, so the
value of “sample[1]” is “b”, and so on. Assume that you extract a new set of
values “e f g”.
For more information about global variables, see Chapter 7, “Interacting with
global variables” on page 35.
There are four options for setting the value for an existing indexed variable:
v Overwrite the existing value with this new value
v Overwrite the existing value with this new value, starting at the specified index
v Append this new value to the end of the existing value
v Insert this new value into the existing value, at the specified index.
For either of the options that use a specified index, you must enter the number of
the index in the Index field.
For an example of how variable value is set based on the option you choose, see
“Extract global variable action” on page 21.
You can specify whether the global variable is set to a fixed constant or a
calculated value by clicking one of the radio buttons. If you are setting the global
variable to a fixed value, type the value in the entry field.
If you are setting the global variable to a calculated value, you specify the
operands to be used and the operation of the calculation. The operands can be
either fixed values that you enter into the field, or you can use the values of
existing global variables for the calculation. If you use an existing indexed global
value, and you want to specify an index of the variable to use as the operand, click
Advanced. Enter the number of the index in the Index field.
For more information about global variables, see Chapter 7, “Interacting with
global variables” on page 35.
For more information about business logic in your projects, see Chapter 9, “Adding
business logic” on page 41.
Source tab
The Source tab displays the tags and values in the [Link] file for all the
information supplied for the screen customization, where sc-name is the name you
gave to the screen customization when you created it. As you make changes on
other tabs in the screen customization editor, the tags and values displayed in the
source file change to match.
You can also make changes to the tags and values in the source file, and they are
reflected on the appropriate tabs of the screen customization editor. For
information about the tags in the [Link] file, refer to “Screen customization
files (.evnt)” on page 115.
When a HATS application is running and a new host screen is found, the first
enabled screen customization in the event priority list is checked to determine if
the screen recognition criteria match the host screen. If so, no more screen
customizations are checked for matches, and the actions for the first screen
customization are performed. If not, the next screen customization in the list is
checked to determine if the screen recognition criteria match the host screen. This
continues until the last screen customization in the list is checked.
If there are no screen recognition criteria in the screen customizations that match
the current host screen, HATS processes the unmatched screen event. The HATS
unmatched screen event is a special screen customization that occurs only when no
defined screen customizations match the host screen. The default action of this
event is to display the host screen (default transformation) applying the default
template.
You can modify the actions to be taken if a host screen that does not match any of
your screen customizations. For example, you could create a Web page that tells
the end user that the page was not found and gathers information on how the user
reached that screen. You could use the show URL action to present the Web page.
You use the Create a HATS Transformation wizard to define a transformation. The
name, description, and the screen you define for the transformation are saved in a
transformation (.jsp) file. You can use the HTML editor built into WebSphere
Studio to view and modify the information you define for the transformation. See
the WebSphere Studio documentation for more information on using the HTML
editor features.
You can see the transformations you have created by expanding the
Transformations node of the HATS Project View tab of the HATS Studio. To edit a
transformation, you use the HTML editor built into WebSphere Studio. You can
invoke the HTML editor by double-clicking on the name of the transformation.
Design tab
The Design tab displays the current view of the transformation as you make
changes to it. While on this tab, you can insert text, graphics, global variables, host
components, tabbed folders, macro keys, host and application keypads, or
individual keys from the keypads.
Note: HATS automatically inserts the default host keypad into each transformation
you create.
You can select these items using the pull-down menus on the menu bar, or the
Insert HATS Component drop-down menu on the HATS Studio toolbar.
If you want to add images to your project, such as those in the WebSphere Studio
Gallery, it is recommended that you import them into the Common/Images directory
of your project. To import images, select File > Import > File System to open the
Import wizard. Select the location of the image source files you want to import in
the Directory field. Select the project_name/webApplication/common/images
directory as the destination Folder. When your image source files are imported,
right-click the on the Images folder, and select Show thumbnails to see the images
in the folder on the Thumbnail tab in the lower right window. You can use the
drag-and-drop method to copy images into the Design tab view of your
transformation.
When you click the Insert Host Component, Insert Tabbed Folder, Insert Macro
Key, or Insert Global Variable items on the Insert HATS Tags menu, a wizard
appears for you to define those items.
HATS provides host components and widgets. You can choose one of the host
components and widgets provided or you can create your own custom host
components and widgets. For information on creating custom host components
and widgets, see “Creating custom host components and widgets” on page 55.
Click one of the components in the Component List. The Component Preview
window displays the component if it is found in the screen region. You select the
widget to use to render the host component from the widgets in the corresponding
Widget List that are available to render the component. When you select a widget,
the Widget Preview window displays how the widget is displayed in the final Web
page. A larger widget preview is available if you click the Widget preview in large
window (the magnifying glass). You can click Full page preview to show all the
components on the page along with the associated template. This preview shows
the page as it will appear to the end user.
The default project settings for components and widgets are configured using the
General tab of the project editor. Some components and widgets have settings that
you can customize by clicking Component Settings or Widget Settings. You can
also customize the component and widget settings for a particular transformation
using the Insert Host Component wizard, by clicking Component Settings or
Widget Settings. For information on the settings that can be customized with the
Insert Host Component wizard, see “Component and widget settings” on page 89.
The widgets that are available depend on the selected host components. Table 4 on
page 101 lists the existing HATS host components and their corresponding widgets.
If HATS does not find the component in the screen region, the Component Preview
window displays the message “The selected region does not contain the
component_name component”, where component_name is the component selected in
the Component List. If this message is displayed, you might not have selected a
region that contains the complete component, or you might need to modify the
settings of the component to match the way your host application displays the
component. For example, you may have a Command Line component in the
Click Finish when you have made your component and widget selections.
Under the Tab advanced options, if you clear the Use default values checkbox,
you can specify the following:
v The color of the text on the tab when the tab is selected
v The color of the text on the tab when it is not selected
v The color of the tab when you place your cursor over the tab
Under the Folder advanced options, if you clear the Use default values checkbox,
you can specify the following:
v The height of the tab in pixels
v The width of the folder in pixels
v The height of the folder in pixels
v The color of the folder outline
The Preview window shows how the tabbed folder will appear, based on the
selections you make.
Click OK when you have defined all of the tabbed folder options for each tab in
the folder.
You can click Full page preview to show all the components on the page along
with the associated template. This preview shows the page as it will appear to the
end user.
Note: HATS uses the description of the macro as the text inserted into the Web
page for any of the rendering options. You might want to consider this
when providing a description of the macro, and avoid giving macros long
descriptions.
Source tab
The Source tab displays the HTML and JSP tags in the [Link] file
necessary for extracting host components from the host screen, the widgets you
selected to present those host components, and any other items you added to the
transformation. As you make changes on other tabs in the HTML editor, the tags
and attributes displayed in the tags of the source file change to match.
You can also make changes directly to the tags and attributes in the source file, or
you can insert items using the Insert HATS Component drop-down menu on the
HATS Studio toolbar. The items you can insert on the Source tab are the same
items listed on the Design tab. Place your cursor in the source file at the point you
want to insert one of the menu items.
When a host component and its rendering widget have been inserted, you can use
the Edit HATS Component toolbar option to modify the host component and
widget. Before you click Edit HATS Component, make sure your cursor is inside
of the <HATS:Component> tag.
When you make changes to the file displayed on the Source tab, they are reflected
on the appropriate tabs of the HTML editor.
Preview tab
The Preview tab provides a browser preview of the transformation showing the
static HTML content. This is similar to the Design tab, but without the ability to
make changes to it. Items defined with the <HATS:Component> tag are not shown
in the preview. There are other ways to preview your transformation, along with
its associated template.
Another way to preview your transformation is to use captured screens. For every
transformation you create in your project, HATS creates a captured screen (whether
you requested it or not). You can see the captured screens by expanding the Screen
Captures node of the HATS Project View tab of the HATS Studio. Double-clicking
on the name of the screen capture displays a view of the screen capture with two
tabs, Host Screen and Preview. The Host Screen tab displays the captured screen
as it appears on the host. The Preview tab displays how the transformation is
rendered on the Web page, along with the template associated with the
transformation.
The transformation and template used to generate the preview are based on screen
customizations defined in your project. Preview scans the list of enabled screen
customizations. When a screen customization is encountered that matches the
captured screen, the first action that applies a transformation (along with the
associated template) is used to render the preview. If no matching screen
customization is found, the default template and transformation are used for the
preview.
HATS supplies templates that you can use in your projects. You can see the names
of these templates by expanding the Templates node of the HATS Project View
tab of the HATS Studio. The supplied templates contain HTML and JSP code to
include some or all of the following:
v At least one stylesheet (.css) file
v Borders created using the .gif and .jpg files (located in the Common/Images node)
v The HATS default application keypad
v An area for the host screen rendered with a transformation.
When you created your project in HATS Studio, you selected a template to use as
the default template for your project.
You can see all of the templates, those supplied by HATS and any that you have
created, by expanding the Templates node of the HATS Project View tab of the
HATS Studio. To edit a template, you use the HTML editor built into WebSphere
If you want to use your new template as the default template for your project,
make sure you select the name of your template as the default for your project in
the project editor.
Keep in mind that any changes you make to objects in a project only affect that
project. If you want to use the template you create for other projects, you need to
copy that template to any new projects you create.
Design tab
The Design tab displays the current view of the template as you make changes to
it. While on this tab, additional edit options are available from the WebSphere
Studio toolbar. For example, you can use the Insert drop-down menu from the
toolbar to insert things such as images, photographs, text, and text-formatting
controls. You can add music that plays when the template is displayed, create
layout frames, and add HTML tags. You can also insert global variables, macro
keys, host and application keypads, or individual keys from the keypads.
You can select these items using the pull-down menus on the menu bar, or the
Insert HATS Component drop-down menu on the HATS Studio toolbar.
If you want to add images to your project, it is recommended that you import
them into the Common/Images directory of your project. To import images, select
File > Import > File System to open the Import wizard. Select the location of the
image source files you want to import in the Directory field. Select the
project_name/webApplication/common/images directory as the destination Folder.
When your image source files are imported, right-click on the Images folder, and
select Show thumbnails to see the images in the folder on the Thumbnail tab in
the lower right window. You can use the drag-and-drop method to copy images
into the Design tab view of your template.
When you click the Insert Macro Key or Insert Global Variable items on the
Insert HATS Tags menu, a wizard appears for you to define those items, as you
Using stylesheets
You can control elements of output such as font color, size, and background color
in order to maintain the consistency of the area of the screen rendered by HATS
with the style of the template. For example, Cascading Style Sheets (CSS) is a
simple style language that enables attaching style to HTML elements.
HATS provides stylesheets to modify color schemes and font size. At least one of
these stylesheets is applied to the template. While viewing the template on the
Design tab, you can apply these stylesheets to your template. Right-click on the
Stylesheets folder and select Show thumbnails from the pop-up menu. The
stylesheet files are shown in the Thumbnails view below the Design tab. To apply
one of the stylesheets to your template, double-click the stylesheet.
To change the output style of HATS templates, you can edit a stylesheet that was
shipped with HATS. The stylesheets that HATS provides are located in the
Common/Stylesheets node of the HATS Project View tab of the HATS Studio.
Double-click on any stylesheet to edit the file. Read the comments in the file to
determine the functions of the styles included in the stylesheets.
Source tab
The Source tab displays the HTML and JSP tags in the [Link] file for all the
parts of the template. As you make changes on other tabs in the HTML editor, the
tags and attributes displayed in the tags of the source file change to match.
You can also make changes to the tags and attributes in the source file, and they
are reflected on the appropriate tabs of the HTML editor.
Preview tab
The Preview tab provides a browser preview of the transformation showing the
static HTML content. This is similar to the Design tab, but without the ability to
make changes to it. This preview does not include the transformation.
Global variables exist for the time that the HATS application is active. If several
users open host sessions using the same HATS application, the global variables for
each session are used only in that session; they are not shared between different
sessions using the same HATS application. A global variable can contain a numeric
value, a string, or an indexed array of strings. If you use a global variable to
contain an array of strings, you can specify for any action whether you want to use
the entire array, a particular index, or all the values starting at a particular index.
All operations on global variables are case-sensitive. Do not use names beginning
with “HATS” for global variables.
After a global variable has a value, you can use that value in the following ways:
v To calculate the value of another global variable, in a Set global variable action
v To write the value to a host screen, using an Insert global variable action
v To insert the value into a transformation or a template, using the Insert global
variable menu item
v To pass the value to a macro
v To use the value in business logic.
If you insert a global variable into a host screen, you must list this action before
applying a transformation, so that the global variable will appear on the Web page
created from the host screen. See “Actions tab” on page 19 for more information
about specifying actions for screen customizations. For information on inserting
global variables into transformations and templates, refer to “Insert Global Variable
wizard” on page 28.
Global variables can be used with prompt and extract macros to either provide a
value for a prompt or to store a value extracted from the host screen. See
Chapter 8, “Incorporating macros” on page 37 for more information about using
global variables with macros.
To use global variables in business logic, you must check the Get global variable
box in the Create Business Logic wizard. This creates a stub in your business logic
code to give you access to HATS global variables. See Chapter 9, “Adding business
logic” on page 41 for more information about using business logic.
Prompt macros contain events to request input from users during the host session.
For example, you can use a prompt macro to ask a user for their user ID and
password before logging them into a host application.
Extract macros contain events to extract host screen information as a string. 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. For example, you can use an extract
macro to extract the results of a search for ″Smith″ in a phone book application.
You can record macros in HATS Studio using the HATS host terminal. On the
HATS host terminal screen, click Record Macro. The Record a Macro wizard
appears and enables you to name the macro, give it a description, and specify
where the macro is saved. Click Finish when you have specifed these items. You
can then use the HATS host terminal screen to navigate through the host
application to any screen.
If you want the macro to prompt the user for information, click Insert Prompt to
display the Insert Prompt wizard. You can give the prompt a name and a default
value. If the information the end user provides, such as a password, should not be
displayed on the host screen, click the Password protect input checkbox. The Row
and Column fields of the Position section of the wizard define where on the host
screen the prompt information provided by the end user is placed. If you place
your cursor at a location on the host screen, such as the field for a password,
before you begin recording the macro, the Row and Column fields are filled with
those values. The Handle Macro Prompt section of the wizard enables you to
determine how the prompt is processed. You can select one of the following radio
buttons:
Show handler
You can select a .jsp file to prompt the end user for the necessary
information, and include a button for the user to submit the information. A
default macro handler is shipped with HATS, and it is named [Link].
You can find this file by clicking the HATS Project View tab of the HATS
Studio and expanding the project name, and expanding Macros > Macro
Event Handlers. If you want to create your own handler, ensure that you
return control to the HATS runtime.
Set prompt to string
If you know what value should be returned from a prompt, you can enter
that string in the String field.
Set prompt to global variable
If you want the value of the prompt to be provided by a global variable,
If you want the macro to extract information from the host screen, click Insert
Extract to display the Insert Extract wizard. You can specify a name for the extract.
The Start row, Start column, End row, and End column fields of the Position
section of the wizard define from where on the host screen the information is
extracted. If you mark a region of the host screen with a rectangle after you click
Insert Extract, the Position section fields are filled with the values when the Insert
Extract wizard is displayed. The Handle Macro Extract section of the wizard
enables you to determine how the prompt is processed. You can select the
following check boxes:
Show handler
You can select a .jsp file to display the extracted information to the end
user. A default macro handler is shipped with HATS, and it is named
[Link]. You can find this file by clicking the HATS Project View tab of
the HATS Studio and expanding the project name, and expanding Macros >
Macro Event Handlers. If you want to create your own handler, ensure that
you return control to the HATS runtime.
Save as global variable
You can enter a name for the global variable in the Name field or select an
existing variable using the drop-down menu. You must specify the
extraction format by selecting one of the following radio buttons:
v Extract this region as one string
v Extract this region as a list of strings.
If you selected an existing global variable in the Name field, you must
specify how to handle the existing variable by selecting one of the
following radio buttons:
v Overwrite the existing value with this new value
v Append this new value to the end of the existing value.
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 > HOD/Host Publisher Macro and click Next to display the
Import a HOD/Host Publisher Macro dialog. Click Add and navigate to the
location of the macro on the file system. Host Publisher macros are typically in a
directory path \hostpub\Studio\IntegrationObjects.
Note: Host Publisher macros with fixed iteration loops continually recognize the
same screen and perform different actions. In HATS, you cannot create a
screen customization to recognize the same screen a second time and
perform a different action than the first time it was recognized. If you
attempt to use a Host Publisher macro with fixed iteration looping, your
project might go into an infinite loop. Host Publisher macros with fixed
iteration looping can be identified by looking at the source code for the
macro. The macro contains customreco and custom tags with ID attributes of
HPubFixedIterationLoop and HPubIncrementLoop, respectively.
You can also create a button to play the macro using the transformation editor. See
“Insert Macro Key wizard” on page 27 for more information.
Macros recorded or imported in HATS Studio are saved in a HATS macro (.hma)
file. You can use the macro editor to view and modify those macros.
You can see the macros defined in your project by expanding the Macros node of
the HATS Project View tab of the HATS Studio. You can invoke the macro editor
by double-clicking on the name of the macro.
Overview tab
The Overview tab of the macro editor summarizes information about the macro,
such as the name and description. The only item you can modify on this tab is the
description of the macro.
You can click Editor to launch the Host On-Demand macro editor, and modify
settings for the macro. A separate window opens for the macro editor. Refer to
Host On-Demand help documentation for more information on the Host
On-Demand macro editor.
Source tab
The Source tab displays the tags in the [Link] file for all the attributes
and values for the macro, where macro-name is the name you gave to the macro
when you created it or imported it. As you make changes on other tabs in the
project editor, the tags and attributes displayed in the tags of the source file change
to match.
You can also make changes to the tags and attributes in the source file, and they
are reflected on the appropriate tabs of the macro editor. For more information
about the tags in the [Link] file, refer to “Macro files (.hma)” on page 120
and Appendix C, “Macro script syntax” on page 123.
You can add business logic to your project using the Create Business Logic wizard.
To invoke this wizard, right-click in the HATS Project View tab of the HATS
Studio, and select New HATS > Business Logic. You can also right-click in the
Navigator tab of the HATS Studio, and select New > Other > Host Access
Transformation Server > HATS Business Logic, and then click Next.
In the Create Business Logic wizard, specify the project to which you want to add
the business logic and supply the fully-qualified Java class name. Optionally, you
can supply a package name, or select an existing Java package by clicking Browse.
If you want your business logic to have access to the project global variables, check
the Get global variable checkbox. Click Finish when you have provided the
required information.
You can see the business logic files in the project by expanding the Source folder
on the HATS Project View tab of the HATS Studio. Each package name or class
name appears in the Source folder. Expand the package name folder to see the Java
class name. Double-click on the class name to edit the class.
If you use the Create Business Logic wizard to create business logic, the method is
named “execute” by default. If you write your own class, the method must meet
specific requirements:
v Marked public and static
v Have a return type of void
v Take a [Link] object as the only parameter
The method must follow the form:
public static void myMethod (BusinessLogicInfo businesslogic)
The BusinessLogicInfo object passed to your custom Java code enables you to
access and use or modify various objects and settings of your HATS project. These
include:
v The [Link] class
v The [Link] class
v The connection hashtable, which contains the settings for the connection
information you provided for the application
v Class properties, which provide default settings for objects such as components
and widgets
v The [Link] objects in the application
v The [Link] object, which contains “greenscreen”
information
v The [Link] class of the client
v The [Link] values and settings
If you want to incorporate the source code (.java files) from your existing business
logic so you can modify the code, you can import the .java files into the Source
folder in your existing project. Select File > Import > File System to open the
Import wizard. In the Import wizard, select the location of your source files in the
Directory field. Select the Source folder of your project in the destination Folder
entry field. When your source .java files are imported, they are automatically
compiled and packaged into your HATS project. You can also edit, set breakpoints,
and debug your source files in the WebSphere Studio workbench.
You can also incorporate a Java archive (.jar) file with compiled Java business logic.
This method imports the Java archive file into the .ear project. There will only be a
single copy of the Java file in the .ear file, but it is available to all of the HATS
projects contained in that .ear project. There are three steps to this method.
1. Import the .jar file into the HATS .ear project. Select File > Import > File
System to open the Import wizard. Select the Java archive (.jar) you want to
import in the Directory field. Select your HATS .ear project as the destination
Folder. When your .jar file is imported, click the Navigator tab of the HATS
Studio and expand your HATS ear project. You will see the imported java
archive file.
2. In the Navigator tab of the HATS Studio, select the project in which you want
to invoke your business logic. Right-click on the high level HATS project and
select Properties. In the Properties dialog, select Java Build Path in the left
table and select the Libraries tab on the right. Click Add JARs to display the
JAR Selection dialog. Expand the HATS .ear project, and select the newly
import Java archive file. Click OK in the JAR Selection dialog, and click OK in
the Properties dialog. Repeat this process for all HATS projects for which you
want to use the business logic.
3. In the Navigator tab of the HATS Studio, select the project in which you want
to invoke your business logic. Expand the project, the webApplication folder,
and the META-INF folder. Double-click on the [Link] file. Type in the
name of your newly imported jar at the end of the Class-Path: line.
There are other ways to import Java archives into the HATS project. HATS projects
are extensions of Web projects in the WebSphere Studio workbench. For more
information about importing Web projects, open the Help perspective in the
WebSphere Studio workbench and select Application Developer Documentation.
Expand the sections as follows to find information on Web projects: Concepts >
Projects > Web projects.
To invoke Host Publisher Remote Integration Objects into your HATS project, you
must first import the Remote Integration Objects into your HATS project. Refer to
the section titled “Remote Integration Object Files” in the IBM WebSphere Host
Publisher Programmer’s Guide and Reference for information on importing Host
Publisher Remote Integration Objects into WebSphere Studio workbench. After the
Host Publisher Remote Integration Objects are imported into HATS, you can call
the Remote Integration Objects from your HATS business logic or from HATS
templates or transformations, by using in-line Java code enclosed in <%...%>. See
the section titled “Programming with Remote Integration Objects” in the IBM
WebSphere Host Publisher Programmer’s Guide and Reference for more information.
To invoke a Host Publisher Remote Integration Object from HATS business logic,
right-click in the HATS Project View tab of the HATS Studio and select New
HATS > Business Logic. Enter a Java class name and package name and click
Finish. A skeleton HATS business logic template is displayed. For a sample of the
template updated to execute a Host Publisher Remote Integration Object, see the
product Web site ([Link]
Invoking Host Publisher EJB Access Beans and Web Services from
HATS
You can invoke Host Publisher EJB Access Beans and Host Publisher Web Services
from HATS. Although Host Publisher Server must be installed somewhere in your
network to invoke EJB Access Beans, it does not need to be installed on the same
WebSphere Application Server as HATS.
To invoke Host Publisher EJB Access Beans into your HATS project, you must first
import the EJB Access Beans into your HATS project. Refer to the section titled
“Using EJB Access Beans with Java Application Clients” in the IBM WebSphere Host
Publisher Programmer’s Guide and Reference for information on importing EJB Access
Beans into WebSphere Studio workbench. After the EJB Access Beans are imported
into HATS, you can call EJB Access Beans from your HATS business logic or from
HATS templates or transformations. See the section titled “Programming with Web
When interacting directly with a host application, an end user activates a physical
printer to print data from the application. When interacting with a HATS
application, the end user does not activate a physical printer. Rather, he or she
generates an Adobe Portable Document Format (PDF) file, which can be displayed
in a Web browser. The PDF file can also be printed.
Note: If a PDF viewer (Adobe Acrobat Reader) is not installed, the user will be
prompted to save the file to disk.
This chapter describes the process for enabling print support in your HATS project
and for using print support as you develop the project in HATS Studio and as the
application is used by an end user.
Refer to the documentation for your 3270 host software for details on how to
perform these steps.
When an end user of the HATS application issues a command to print files, the
HATS application sends a print job to the printer LU and the HATS runtime
converts the print job to PDF format. Once the PDF is formatted, the end user can
click View Print Jobs on the application keypad to see a list of queued print jobs.
You do not need to perform any additional configuration. When an end user of the
HATS application issues a command to print files, IWA converts the host print jobs
into PDF format and facilates the download to the end user. The end user can click
View Print Jobs on the application keypad to display the IWA Printer Output
window. In this window, the end user can select the following print options:
1. PDF device type
2. Paper size
3. Destination
Refer to your IWA documentation for more information on these print options.
Note: You might consider adding a link to your application to where the end
user can download a free copy of the Acrobat Reader.
v When the HATS application completes, the printer output window closes
automatically.
v Any application-specific information you choose to include.
To use HATS print support, an end user should follow these steps:
1. Start the HATS application.
2. Print the files.
Note: While the print jobs are spooling, the user might see the file names for
the print jobs in the printer output window, but View and Delete are
disabled until the conversion to PDF format is complete.
Note: The text of the button seen by the end user depends on the
state of the keyboard. The button will read “Keyboard on”
when keys are being sent to the browser, and “Keyboard off”
when keys are being sent to the host.
Refer to “General tab” on page 13 for more information about the settings for
keyboard support and keypads.
This chapter explains how to define keyboard support in your HATS project and
contains tips for documenting keyboard support for your end users.
To use keyboard support in HATS projects, the end user’s Web browser must be
either Internet Explorer version 5.0 or higher or Netscape version 6.0 or higher.
Javascript must be enabled in the Web browser.
To change style of a keypad for a specific HATS project, change the cascading style
sheet that corresponds to the keypad. In the WebSphere Studio workbench, go to
the HATS Project View tab of the HATS Studio and expand the project name.
Expand Common > Stylesheets. The default keypad stylesheet is [Link].
To modify the keypad, double-click on the [Link] stylesheet open the editor.
HATS Studio uses Host On-Demand to provide connection support from HATS
applications to 3270 and 5250 applications using Telnet protocols. HATS uses the
SSL support provided by Host On-Demand for securing these connections. Using a
secure connection over SSL encrypts data flowing over the connection and thus
protects it against observation by a third party.
For a connection to be secured, both the HATS application and the Telnet server it
is connected to must support SSL. To secure the connection, the Telnet server must
provide a certificate, which is used to encrypt the data. This certificate uniquely
identifies a machine on one end of the connection.
The following sections describe how to create custom host components and
widgets.
Note: If you are using a bi-directional (BIDI) code page, please refer to
“Bi-directional APIs” on page 87.
The following JSP code example shows the format of the HATS:Component tag.
<HATS:Component type=’<HostComponentType>’
widget=’<WidgetStyle>’
row=’1’ col=’1’ erow=’24’ ecol=’80’
label=’<Data on the screen in region (1,1) to (24,80)>’
componentSettings=’’ widgetSettings=’’ />
The attribute data of the HATS:Component tag determine what host component
and widget classes to call and how to present the widget in HTML output. Refer to
“HATS:Component tag type and widget attributes” on page 102 for the values of
the type and widget attributes. The rest of the attributes are described in the list
that follows:
Attribute Description
row The starting row position for host component definition.
col The starting column position for host component definition.
erow The ending row position for host component definition.
ecol The ending column position for host component definition.
label The string to be rendered as HTML text coupled with this host
component.
componentSettings
This is a set of key and value pairs that are sent to the component
class. When you specify componentSettings values, specify them in
the form key:value. If you specify more than one key:value pair,
separate them with an “or bar” ( | ). For example, <..
componentSettings="key1:value1|key2:value2" ... >.
When HATS runs a project, it instantiates the custom host component based on the
setting of the type attribute of the HATS:Component tag.
The host component class inherits the following methods from the parent class
without implementation:
public ComponentElementPool recognize(HostScreen hostScreen, int startRow,
int startCol, int endRow, int endCol, String label, Properties settings)
The recognize() method initializes many of the data members that are
needed by this class to perform pattern recognition and gathers host screen
data from the HostScreen object. This method has a different
implementation in each host component class. You should overwrite this
method to implement your own pattern recognition logic.
In addition to initializing variables, this method also instantiates an object
named hostComponentData (data type
[Link]) used to store the host screen
data gathered. ComponentElementPool is a container class carrying a vector
of ComponentElement objects and other needed host screen information
(such as cursor position). ComponentElement describes the general
information of host components that widget classes can use to render in
HTML.
When HATS runs a project, it instantiates the custom widget based on the setting
of the widget attribute of the HATS:Component tag.
The widget class inherits the following methods from the parent class without
implementation:
public void draw([Link] out, Object o, Properties widgetSettings)
The draw() method first initializes data members that will be needed to
write the HTML code out. Each widget class has its own implementation
of the draw() method. You should overwrite this method to create a
custom widget.
For a description of the arguments of this method, see the Java
documentation for the draw() method of the Widget class at the product
Web site ([Link]
To edit the [Link] file, click the Navigator tab of the HATS Studio.
The [Link] file is shown at the bottom of the Navigator view of
your project. The following is a sample of the [Link] file that shows
the HATS-supplied visual table component and one of the associated widgets, the
vertical bar graph widget.
<ComponentWidgetList>
<components>
<component className="[Link]"
displayName="%VISUAL_TABLE_COMPONENT">
<associatedWidgets>
<widget className="[Link]"/>
</associatedWidgets>
</component>
</components>
<widgets>
<widget className="[Link]"
displayName="%VERTICAL_BAR_GRAPH_WIDGET"/>
</widgets>
</ComponentWidgetList>
As you can see, there are two sections to this file: components and widgets.
The components section contains the list of all registered components. To register a
custom component and make it available to the HATS Studio, add a <component>
tag and the associated <widget> tags to the [Link] file. You must
supply a className, displayName, and the associated widgets.
className
Identifies the Java class that contains the code to recognize the widget. The
class name is usually in the form [Link].
displayName
Identifies the name by which your custom widget is known, and how it
appears in the list of widgets in the HATS Studio. This name must be
unique among the registered widgets. The form of the displayName for a
custom widget is simply a string, without the percent sign (%). Spaces are
not allowed in the displayName. However, you can use an underscore ( _ )
in place of a space.
widget
Identifies the widgets associated with this component. There must be a
separate <widget> tag for each associated widget. All of the <widget> tags
for the component must be defined within the <associatedWidgets> tag
and its </associatedWidgets> ending tag. The <widget> tag within the
<associatedWidgets> tag only contains the className attribute, which
The widgets section contains the list of all registered widgets. To register a widget,
link it to a component, and make it available to the HATS Studio, add a <widget>
tag to the [Link] file. You must supply a className and a
displayName.
className
Identifies the Java class that contains the code to recognize the component.
The class name is usually in the form [Link].
displayName
Identifies the name by which your custom widget is known, and how it
appears in the list of widgets in the HATS Studio. This name must be
unique among the registered widgets. The form of the displayName for a
custom widget is simply a string, without the percent sign (%). Spaces are
not allowed in the displayName. However, you can use an underscore ( _ )
in place of a space.
To start HATS Administration Console, enter the following URL in your Web
browser:
[Link]
where localhost is the hostname or IP address of the machine where your HATS
applications are deployed, and appname is the name of an application in the .ear
file.
More than one HATS Administration Console can be started using different
application names included in an .ear file. The panel information in each console
displays the same license usage and session information for the set of applications
contained in the .ear file. The session information can be sorted by application
name, connection identifier, or communication status by clicking the headings
above the session information. On this panel, you can shut down one or more
connections being used by the HATS applications included in the .ear file. You
should encourage your end users to click Disconnect to terminate their session
rather than simply closing the browser window, because sessions stay active for 30
minutes when not terminated properly. This invalidation timeout value is set in
WebSphere Application Server (WAS).
where localhost is the hostname or IP address of the machine where your HATS
applications are deployed, and appname is the name of an application in the .ear
file. This Web page enables you to select the clone for which you want to view
information. To specify the individual clone, you need to know the session ID
value of the connection for an end user. You need to request that information from
the end user. The end user can find the session ID by viewing the source of their
application Web page, and searching for the following string:
<INPUT TYPE="HIDDEN" NAME="SESSIONID" VALUE="value" />
When you receive the value from your end user, insert it into the Session ID field
of the of [Link] page and click Submit to display the HATS
Administration Console for the specific clone.
You can use any text editor to modify the [Link] file. If you modify
the file, you must stop and restart the server that is running the application for the
changes to take effect.
Note: Names of the properties are case-sensitive. Do not change the property
names.
num_licenses
Specifies the number of licenses you purchased. HATS tracks the number
of HATS connections to host resources and logs a message when the value
exceeds the number of licenses purchased.
The value is an integer. There is no default. Specify num_licenses = – 1 if
you purchased an unlimited license.
licenseTracking
Specifies whether HATS tracks license usage or not. The value is binary.
The default is 0.
0 HATS does not track license usage.
The [Link] file contains the following HATS server tracing properties:
[Link]
Specifies the level of tracing for the main runtime and for all settings
under RUNTIME.* that do not specify a trace level.
The value is an integer from 0–9. The default is 0.
See the description of the tracelevel.* keys for information on values for
this setting.
To customize the trace masks, add together the following (hex) values:
x000001
Informational messages
x000002
Warning messages
x000004
Error messages
x000008
Critical error messages
x000010
API traces
x000020
Callback API traces
x000080
Method entry
x000100
Method exit
x000200
Exceptions
x000400
Miscellaneous traces
x000800
Object creation
x001000
Object disposal
x020000
Reserved
x040000
Miscellaneous data - level 1
x080000
Miscellaneous data - level 2
x100000
Miscellaneous data - level 3
HATS applications rely on input data from Servlet and Java Server Page (JSP)
API’s to retrieve HTML FORM data from the FORM character set and convert it to
Unicode. The Servlet’s getParameter() methods must decide on the character set of
The specification for FORM provides a charset value in the content-type attribute,
but most browsers do not add the charset value to content-type. Also, in
WebSphere Application Server 4.0 (WAS), there is no way for the HATS application
to dynamically specify the character set used for each form; however, you can
assign a character set mapping used by the entire WAS. A customizable properties
file provides a locale-to-character set mapping used by WAS. The file is
\\WebSphere\AppServer\properties\[Link].
The default ISO-8859 character set works in most cases; however, input data in
non-Latin1, double-byte, and bi-directional locales is frequently corrupted.
If your deployed .ear file contains the .war files for multiple applications, the
WebSphere Application Server (WAS) administrator must configure the server with
Module Visibility set to Application.
HAT0001 Loading HATS configuration data from | HAT0062 Archive file {0} could not be created.
{0}.
| Explanation: {0} is the filename of the archive file.
Explanation: {0} is the filename of the configuration
data file.
| Response: Ensure that the application’s connection
| settings, specifically the SSL certificate setting, are
Response: None. | correct. Contact IBM service for assistance.
HAT0002 The HATS message log file is {0}. HAT0300 An unexpected exception was received:
{0}
Explanation: {0} is the filename of the message log
file. Explanation: {0} is the exception.
Response: None. Response: If the exception is issued by code written
by a user, such as business logic or custom components
or widgets, contact the programmer who wrote the
HAT0003 The HATS trace log file is {0}.
code. Otherwise, contact IBM service for assistance.
Explanation: {0} is the filename of the trace log file.
Response: None. HAT0350 An error occurred reading the file {0}.
Explanation: {0} is the filename of the file being read.
HAT0040 A program exception occurred. There
Response: Ensure that the file exists and is a valid file.
may be additional messages in this log
Contact IBM service for assistance.
which describe the error. The following
information may help determine the
cause, if this log is requested by IBM HAT0351 An error occurred writing the file {0}.
service:
Explanation: {0} is the filename of the file being
written.
{0}
{1} Response: Ensure that the filename is valid. Contact
IBM service for assistance.
Explanation: {0} is the exception message string as
received by Java.
HAT0352 Cannot find the file named {0}.
{1} is the exception stack trace.
Explanation: {0} is the filename of the missing file.
Response: Check the log for additional messages.
Response: Restore the missing file.
HAT0060 File {0} was not found. | You might need to rebuild the HATS project before the
| application is run.
Explanation: {0} is the filename of the missing file.
Response: Contact IBM service for assistance. | Note: You can set your WebSphere Studio workbench
| preferences to perform a build automatically
| when a resource has been modified.
HAT0061 Directory {0} was not found.
Explanation: {0} is the missing directory.
HAT0353 Creating the file {0}.
Response: Contact IBM service for assistance.
Explanation: {0} is the filename of the file being
created.
Response: This is an informational message. No
response is required.
{0} is the name of the application. | Explanation: {0} is the name of the screen
| customization.
Response: The required file could not be located or
has been corrupted. Republish the application and | Response: Rebuild the HATS project before the
redeploy the .ear file. Tracelevel.3 runtime traces will | application is run.
display the expected filename and location.
| Note: You can set your WebSphere Studio workbench
| preferences to perform a build automatically
| when a resource has been modified.
HAT0603 Cannot insert the value {0} to the host | HAT0608 Cannot insert the value ″{0}″ to the host
screen at row {1}, column {2}, because | screen at row {1}, column {2}, because
the host screen size is {3}. | the location is not contained in an
| unprotected field.
Explanation: {0} is the value.
| Explanation: {0} is the name of the global variable.
{1} is a row number on the host screen.
| {1} is a row number on the host screen.
{2} is a column number on the host screen.
| {2} is a column number on the host screen.
{3} is the host screen size.
| Response: Choose a valid row and column location
Response: Insert a value at the row and column | for the currentl screen. Ensure that the global variable
location that is valid for the host screen size. | is being inserted into an unprotected field.
HAT0604 An exception occurred while calculating | HAT0700 The attribute ″{0}″ of widget setting does
the value for the global variable {0}. The | not exist.
action which failed was {1}. A message
containing the exception details follows. | Explanation: {0} is the attribute in the widget setting
| that does not exist.
Explanation: {0} is the name of the global variable.
| Response: Specify a valid attribute in the widget
{1} is the name of the action that failed. | setting.
Response: Use the information in the message that
follows to bypass the exception during calculation of | HAT0701 The value of attribute ″{0}″ in widget
the value for the global variable. | setting is empty.
| Explanation: {0} is the attribute of the widget setting
| HAT0605 An error occurred while processing the | that is empty.
| actions for the screen customization
| ″{0}″. | Response: Specify a value for the attribute in the
| widget setting.
| Explanation: {0} is the name of the screen
| customization.
| HAT0702 The value of attribute ″{0}″ in widget
| Response: Contact IBM service for assistance. | setting is invalid.
| Explanation: {0} is the attribute of the widget setting
| HAT0606 Global variable ″{0}″ does not exist. | that is invalid.
| Explanation: {0} is the name of the global variable. | Response: Specify a valid value for the attribute in the
| Response: Check the message log for additional | widget setting.
| information. Examine the trace file, if one exists. Check
| the application’s screen customization actions to ensure HAT0800 An exception occurred setting the
| that all required global variables are created. property of print session. A message
containing the exception details follows.
Response: Use the information in the message that
follows to bypass the exception that occurred while
All the languages are installed in a single product image. National language
support is operating-system dependent, so the appropriate font and keyboard
support for the language you want to use must be installed in the operating
system. For example, if you want to use French as the host-session language but
do not have the French font and keyboard support installed, you may not be able
to display the correct characters.
HATS supports the following code pages. You can choose the code page for each
HATS project when you create the project, and you can modify it later in the
project editor.
Table 2. Code pages
Code page Location or usage
037 Belgium
Brazil
Canada
Netherlands
Portugal
United States
273 Austria
Germany
274 Belgium (Old)
275 Brazil (Old)
277 Denmark
Norway
278 Finland
Sweden
280 Italy
284 Spain
Latin-America (Spanish)
285 United Kingdom
290 Japan (Katakana Extended)
297 France
Software environment
The following are required for bidirectional application support:
v The supported browser and its version is Internet Explorer version 5.0 or higher.
v The default locale of the machine where WebSphere Studio is installed should be
set to Arabic for Arabic users and Hebrew for Hebrew users.
v The default locale for the end user client machine must be set to Arabic for
Arabic users and Hebrew for Hebrew users.
v For data input in bi-directional code pages to be processed correctly, UTF-8 must
be specified for Hebrew and Arabic locales in
WebSphere\AppServer\[Link] on the machine running the
WebSphere Application Server. See “Incorrect data in HATS applications with
non-English locales” on page 70 for more information.
The following host function keys are available only for 3270 sessions:
Ctrl+P: Push
You can enter and edit text in the opposite direction from the field
direction.
Ctrl+O: End Push
Push mode is ended and the cursor moves to the end of the push segment.
Ctrl+A: Auto Push
You can type mixed left-to-right and right-to-left text by changing the
language layer.
The following host function key is available only for 5250 sessions:
Ctrl+C: Close
The data entered in one keystroke direction (either left-to-right or
right-to-left) is concatenated with the data that was previously entered in
the opposite direction. The cursor direction is set to be the same as the
field direction, and the language layer is set to the default for the field
direction. If the screen orientation is currently left-to-right, the cursor is
positioned at the first null to the right of the concatenated text. If the
screen orientation is currently right-to-left, the cursor is positioned at the
first null to the left of the concatenated text.
Capturing screens
In bi-directional sessions, screens can be captured either as left-to-right screens or
as right-to-left screens. Captured screens are displayed exactly as they were
captured. To capture a screen as a right-to-left screen, press Ctrl+S (Screen Reverse)
in a left-to-right screen and click Create Screen Capture.
For example, suppose you have the left-to-right screen that contains following text
(capital letters are BIDI data and lower case letters remain as English data):
BIDI TEXT pf01=help
You will customize this screen as RTL. When your application runs, the screen is
displayed as:
TXET IDIB pleh=10fp
From the end user point of view, everything is correct except the function key. The
function key is recognized, but it is displayed backwards.
For the customized screen to appear correctly, you must select the Widget
Orientation opposite to Screen Orientation check box when inserting the function
key host component into a customized screen. By default, the Text Orientation
opposite to Screen Orientation check box is also selected.
Global variables
When global variables are extracted, the extracted data is exactly the data that
appears on the screen, including the orientation of the current screen. Any global
variables inserted onto a screen as an action of a screen customization are inserted
according to the screen orientation.
Text replacement
When you use text replacement in Bidi sessions, there are three additional check
boxes you can use:
Match with LTR Screens
This option allows text replacement to be performed correctly for text on a
left-to-right display screen.
Match with RTL Screens
This option allows text replacement to be performed correctly for text on a
right-to-left display screen.
Match with Reversed Screen
If you check this box and the Match with LTR Screen check box, the
reversed string would match in a right-to-left screen. When Reverse Screen
is clicked on a left-to-right screen, the data is consistent.
You must check either Match with LTR Screen or Match with RTL Screens.
For example, suppose a left-to-right host screen contains the text: NO on. If you
define text replacement to replace “no” with “yes” and ignore the case, the results
depend on the boxes you checked, as follows:
Table 3. Bi-directional text replacement options and results
Options selected LTR screen RTL screen
Match LTR screen only yes on no ON
Match RTL screen only NO on yes ON
Match LTR screen and RTL screen yes on yes ON
Match LTR screen and match reversed yes on no sey
screen
Match RTL screen and match reversed NO sey yes ON
screen
Match LTR and RTL screen and match yes sey yes sey
reversed screen
When you create a new HATS project and select a bi-directional code page, two
additional check boxes appear: Enable screen reverse for uncustomized screens
and Enable screen reverse for customized screens. These check boxes determine
whether the Screen Reverse button appears on these screens. Initially, only the first
box is enabled. If you check the first box, the second box is enabled. There is no
way to check only the second box.
An uncustomized screen is one that was not matched by any screen customization.
An uncustomized screen, when viewed by the end user, has the same screen
orientation as the previous screen. If the first screen is uncustomized, it defaults to
left-to-right. If the screen orientation was changed on a previous screen, it is
inherited by the next uncustomized screen and reset by the next customized
screen.
The initial screen orientation of customized screens is the same as it was when the
screens were customized. For both customized and uncustomized screens, clicking
Screen Reverse changes the screen orientation. During screen recognition, a
reversed screen is considered different from the same screen before the screen has
been reversed. Therefore, Screen Reverse could cause a screen not to be
recognized. If the developer is confident that all host components that appear on a
customized screen are oriented properly, there is no need to enable the Screen
Reverse button for that screen. It is advisable to disable the Screen Reverse button
for customized screens.
HATS applications using bi-directional code pages offer a special input field called
a visual input field. Unlike regular fields, which implement logical data input and
presentation, the visual field implements visual data input and presentation. When
entering data in a visual field, you can use these functions:
Alt+Shift: Language selection
This key combination toggles the language layer back and forth between
Latin and the bi-directional language.
Alt+Enter: Screen reverse
This key combination reverses the direction of the screen.
Shift+NumLock: Push
You can enter and edit text whose direction is opposite from the field
direction.
Shift+NumPad: End push
Push mode is ended and the cursor moves to the end of the push segment.
Alt+NumPad: Auto push
You can type mixed left-to-right and right-to-left text by changing the
language layer. Autopush is especially useful for typing digits in
right-to-left fields. The push and end push functions are automatically
activated according to the language of the text being typed. In right-to-left
fields, typing a digit or a Latin letter causes the automatic initiation of
push, without a language change. Additional Latin letters or digits will
continue the push mode; any other character automatically terminates push
mode. This feature allows you to type bi-directional text with imbedded
numbers or Latin words without using push and end push. In left-to-right
fields, typing a bi-directional character causes the automatic initiation of
push. Typing any digit or Latin character causes the automatic termination
of the mode. This enables the end user to type Latin text with imbedded
bi-directional words by using language layer selection rather than push
and end push.
Screen captures
For an Arabic session with right-to-left captured screens, brackets and numerals are
affected by the symmetric and numeric swapping options of the application. With
WebSphere Studio Application Developer Version 4, to correctly view Arabic
numbers the digit substitution should be set to “Contextual” in the regional
settings.
Other considerations
v When an end user enters data to be submitted to a HATS application, the
shaping of Arabic data and Lam-Alef processing is performed according to the
current screen orientation as the end user views it in the Web browser.
v To view Arabic numbers correctly in widget previews and in the deployed
HATS application, digit substitution should be set to “None” in the regional
settings.
v Screen recognition should always be done with whole Arabic words and not
with a part of an Arabic word.
When a project uses any bi-directional code page, the application (.hap) file has an
additional enableScrRev attribute of the <session> tag, that can have the following
values:
(blank)
The Screen Reverse button is not placed on any screens.
NotCustomized
The Screen Reverse button is placed only on screens that do not match a
screen customization.
Customized
The Screen Reverse button is placed on all screens.
When a project uses any bi-directional code page, the application (.hap) file has
additional attributes for the <replace> tag within the <textReplacement> tag:
matchLTR
Text is to be replaced when the screen orientation is left-to-right.
matchRTL
Text is to be replaced when the screen orientation is right-to-left.
matchReverse
Text is to be replaced when the screen orientation is reversed.
ConvertVisualToLogical
public [Link] ConvertVisualToLogical([Link] inputBuffer,
boolean isleft-to-rightVisual, boolean isleft-to-rightImplicit)
Converts the given string from visual to implicit format and returns the
implicit format of the string
inputBuffer
The input string in visual format.
isLTRVisual
If true, inputBuffer is in visual left-to-right form.
isLTRimplicit
If true, the output buffer is in implicit left-to-right form.
ConvertLogicalToVisual
public [Link] ConvertLogicalToVisual([Link] inputBuffer,
boolean isleft-to-rightImplicit, boolean isleft-to-rightVisual)
Converts the given string from implicit to visual format and returns the
visual format of the string
inputBuffer
The input string in implicit format.
isLTRimplicit
If true, inputBuffer is in implicit left-to-right form.
isLTRVisual
If true, the output buffer is in visual left-to-right form.
Some host components have more complicated settings. For example, several
settings are used to recognize a function key or a selection list. These settings will
be described under each host component.
Command line
Consists of a string and an input field with the format:
Default
The contents of the selected region of the host screen. There are no customizable
settings for the default component.
Field
A section of the host screen defined within a user-defined region of the host
screen. There are no customizable settings for the field component.
Field table
A table in which each cell is a field that is defined on the host screen. Each field
becomes a cell of the field table. HATS determines the table size based on the
number of cells in a user-defined rectangular area of a 3270 or 5250 host screen.
There are no customizable settings for the field table component.
Function keys can have many different appearances on a host screen. To give you
flexibility in recognizing function keys, HATS breaks down the appearance of a
function key string into four parts. For example, a function key might look like
this: PF12=Exit. In this example, the leading token (also known as the start
delimiter) is PF, the delimiter (which separates the key number from the
description) is =, and the description is Exit. There is no string before the leading
token.
String before the leading token
This value is optional. If there is a string that always precedes the start
delimiter, such as ″option″, enter it here.
Start delimiter
This is the string that marks the beginning of a function key string on the
host screen. You can specify more than one value, separated by the ″|″
(vertical bar) character. Any of the values will be recognized as beginning a
function key.
Delimiter
This is the string that divides the function key number from its description.
You can specify more than one value, separated by the ″|″ (vertical bar)
character.
String after the description
This string defines the end of the function key string on the host screen. It
might be a blank character or the beginning of another function key string.
You can specify more than one value, separated by the ″|″ (vertical bar)
character.
Input field
A field in which text can be entered, with or without the field label. There are no
customizable settings for the input field component.
Menu
Similar to the Function key host component; A menu is a list of choices, in which
each choice is typically preceded by a letter or a number, with a delimiter character
separating the letter or number from the text describing that choice. A menu choice
might look like this: option [Link]. In this case, the word ″option″ is a string that
precedes all the choices in the menu, and it is called the string before the leading
token. The number 12 is the leading token, the period is the delimiter, and ″Exit″ is
the description. Alternatively, you could have a menu whose choices look like this:
M: OPEN MAIL, where the leading token is a letter, the delimiter is the colon, and
″OPEN MAIL″ is the description. There is no string before the leading token in this
example.
Delimiter
This is the string that divides the menu choice’s leading token from its
description. You can specify more than one value, separated by the ″|″
(vertical bar) character.
Selection list
A selection list is a lot like a menu, in that it presents a list of options, each of
which is preceded by a leading token and a delimiter, such as in the following
examples:
1. Prepare form
2. Work with forms you submitted
3. Work with forms requiring action
or
a. Prepare form
b. Work with forms you submitted
c. Work with forms requiring action
Subfile
An iSeries or AS/400 screen with a pattern containing all of the following:
v A subfile fingerprint in the field attributes
v Subfile actions in the first half of the host screen
v Subfile headings in the first half of the host screen for the data that follows
v A subfile marker in the second half of the host screen (such as More...).
v Subfile data between the headings and marker, containing input fields or
description text arranged in a table pattern.
Text
Text that is located within a user-defined region of the host screen. There are no
customizable settings for the text component.
For this selected region, HATS displays a 2x2 visual table with the
following contents from the host screen:
aaa cc ee
bb ddd fff
Select from the drop-down list the string used to separate columns in the
table.
Include empty rows
Check this box if you want empty rows in the visual table to appear in the
HTML output. Clear this box if you want empty rows to be omitted.
Rows to exclude
Type the numbers of the rows in the table you want to exclude from the
HTML presentation. If there is more than one row to exclude, separate the
row numbers with a comma (,).
Columns to exclude
Type the numbers of the columns in the table you want to exclude from
the HTML presentation. If there is more than one column to exclude,
separate the row numbers with a comma (,).
Widget settings
When you customize a host component, you are specifying how it will be
recognized. When you customize a widget, you specify how the widget will
appear on the Web page.
Button
Displays the host component as an HTML button. You can configure buttons to
appear as a vertical or horizontal list by adjusting the number of columns in the
display. For example, a HATS project could display buttons in one of the following
configurations:
[Prepare form]
[Work with forms you submitted]
[Work with forms requiring your action]
The button widget presents a graphical representation of a link on the Web page,
with a caption that describes its function. A button is created from a host
component such as a function key or an item in a menu or a selection list. You can
customize these settings for buttons:
Number of columns per row
Type the number of columns of buttons you want to display in each row.
Caption type
The values of the leading token and the description are derived from the
host component. Choose whether you want the caption to display the
leading token, the description, or both. For example, if the button
represents a menu item that read [Link], you can have the caption display
4, or Mail, or [Link].
Caption substitution
If you want to replace strings from the host component with new strings in
the button caption, type the substitution values in the form of a=b. If you
substitute more than one string, separate the substitutions with a
semicolon (;).
Button table
Displays a table of buttons created from host components such as menu items,
where the first column contains buttons and the second column contains
descriptive text. For example:
Default
The default widget is used to represent an area of the host screen that might
contain many different host components (the default component). The settings for
the default widget contain information both about recognizing host components
within the selected area of the screen and about how to present them.
The default widget includes numerous settings used to recognize and render PF
keys from the host screen. You can specify two different ways of recognizing and
rendering PF keys. These different ways are specified as the first and second
Drop-down list
A drop-down list widget is a way of representing a large number of choices from a
host menu or selection list without taking up a lot of room on the Web page. In the
following example, HATS displays a drop-down list that shows three items.
Field
Displays the host component in a field of the HATS project. There are no
customizable settings for the field widget.
Graph
Displays a graph in which the cells of a table (visual or field table) are divided into
data sets.
As with the Number of data sets, the following are only displayed in the settings
for the Insert Host Component wizard.
Extract data point labels
Click the checkbox if you want to extract row or column labels to show as
labels on the X-axis.
Row or Column
Type in the entry field the number of the row or column to use as
labels on the X-axis. The label for this entry field is dependent
upon the value specified for the Data set source setting. The entry
field label matches the value specified for the Data set source
setting.
Extract data set labels (for legend)
Click the checkbox if you want to extract row or column labels to show as
labels in the graph legend.
’Row’ or ’Column’
Type in the entry field the number of the row or column of text to
use as labels in the graph legend.
The label for this entry field is dependent upon the value specified
for the Data set source setting. The entry field label is the opposite
of the value for the Data set source setting.
Data sets
Click this button to display the Data Source Settings dialog, which enables
you to specify the following additional settings for the data sources:
Data set ’n’, ’row’ or ’column’
The number (’n’) of these fields matches the value specified in the
Data set source setting. Type in the entry field the number of any
row or column of data you want to use for the data set. This enables
you to reorder or duplicate sets of data in the graph.
The last part of the label for this entry field is dependent upon the
value specified for the Data set source setting. The entry field label
matches the value specified for the Data set source setting.
color
There is a color button for each of the Data set ’n’, ’row’ or ’column’
settings. The buttons show the color to use for the data set in the
graph. Click the button to display a color palette if you want to
change the data set color.
Label
Displays text for a labeled field on the host screen as a label for an input field in
the HATS project. There are no customizable settings for the label widget.
Link
The link widget presents a link on the Web page, with a caption that describes its
function. A link is created from a host component such as a function key or an
item in a menu or a selection list. You can configure links to appear as a vertical or
horizontal list by adjusting the number of columns in the display. For example, a
HATS project could display the links in one of the following configurations:
Prepare form
Work with forms you submitted
Work with forms requiring your action
Option list
The option list widget is a way of presenting a list of mutually exclusive choices as
radio buttons. For example:
O Prepare form
O Work with forms you submitted
O Work with forms requiring your action
Table
Displays the selected information on the host screen as an HTML table.
Text input
Displays the selected information on the host screen as an input field, with or
without the description. There are no customizable settings for the label widget.
Note: If you edit these source files, we recommend you use the HATS Studio
editors.
All of the files you create with HATS Studio are stored on your system under the
drive and directory where you installed your WebSphere Studio program, such as
WebSphere Studio Application Developer. In the workspace subdirectory, a folder
exists for each project with the name you supply when you create the project. For
example, if you create a project and name it Employees, the files are stored in the
following path:
drive:/ws*d_dir/workspace/Employees
where drive and ws*d_dir are the drive and directory where you installed the
WebSphere Studio program.
All of the file locations in this appendix refer to the relative path from the
directory named for your project.
You can modify the application file using any of the tabs in the project editor.
HATS Studio updates the affected information on other tabs when you make
changes on any tab.
<application> tag
The <application> tag is the enclosing tag for the project.
<session> tag
The <session> tag specifies the session characteristics for the project.
Note: If you select a bi-directional (BIDI) code page, refer to “Additions to HATS
files” on page 86.
delayInterval
Specifies the time (in milliseconds) that the server waits until a full host
screen that is not the first host screen has arrived. The initial default value
is 1500 milliseconds.
delayStart
Specifies the time (in milliseconds) that the server waits until the first full
host screen has arrived. The initial default value is 1500 milliseconds.
description
Specifies a description for the session configured for the project. This value
is always empty.
enableSSL
Specifies whether SSL is enabled. Valid values are:
true SSL is enabled for the project.
false SSL is not enabled for the project.
enhanced
Specifies whether the connection is a TN3270E connection. Valid values are
true and false. The initial default is true.
<otherParameters> tag
The <otherParameters> tag specifies additional Host On-Demand session
parameters.
<eventPriority> tag
The <eventPriority> tag is the enclosing tag for the screen customization events
you defined for the project. The order of the event tags within the <eventPriority>
tag defines which events have higher priority. The highest priority event should be
the first event in the list.
<classSettings> tag
The <classSettings>tag is the enclosing tag for the Java classes you include in the
project.
<class> tag
The <class>tag specifies the Java classes that can be included in an project.
<setting> tag
The <setting>tag specifies the methods included in the Java class.
For component or widget settings, value specifies what you specified for
the customized setting.
<textReplacement> tag
The <textReplacement> tag is the enclosing tag for any text replacement values
you define in the project.
<replace> tag
The <replace> tag specifies the text replacement values in a project.
Note: If you are using a bi-directional (BIDI) code page, refer to “Additions to
HATS files” on page 86.
Note: Care should be taken when using text replacement. Text replacement with a
disparate number of characters in the strings can cause changes in the
HTML representation of the screen. Depending on the widget used for
presenting a region of a screen, text on a line of the screen could be
contracted, expanded, or forced to a new line.
You can modify the template and transformation files using the Design or the
Source tabs in the JSP editor. HATS Studio updates the affected information on
other tab when you make changes on either tab.
A template .jsp file contains HTML tagging to define links and images for the
project page. The template .jsp file also contains a <HATS:Transform> tag that
defines the transformation to be used with the template to present the page of
your project.
A transformation .jsp file contains HTML tags to describe the layout of the
information presented to the user of the project in a Web browser. The
transformation .jsp file may also contain <HATS:Component> tags that define
HATS components and widgets used to present the page of your project. For more
information on the HATS:Component tag, see “Creating custom host components
and widgets” on page 55.
You can modify screen customization files using the Screen Recognition Criteria,
Actions, or Source tabs in the editor. HATS Studio updates the affected
information on other tabs when you make changes on any tab.
You can modify macro files using the Prompts and Extracts or Source tabs in the
editor. HATS Studio updates the affected information on the other tab when you
make changes on either tab.
Macro files contains tags that define a set of screens. The tags are:
macro Begins the definition of the macro. The macro tag has no attributes.
extracts
The associatedScreens tag encompasses the extract tag that follows. The
extracts tag has no attributes.
Screen capture files are stored in the project_name/screens directory. You can view
these files by double-clicking on the name of the screen capture in the HATS
Project View. You cannot edit screen capture files.
Introduction
IBM Host On-Demand uses XML because a macro is better suited to the state
machine model (the main reason for the move: XML is tailor made for a state
machine).
The idea of a state machine may be fairly new to you. The idea behind a state
machine, especially in the IBM Host On-Demand macro context, is simple. Think
of how you use a host system from a terminal or a terminal emulator (like IBM
Host On-Demand). The process you follow when you interact with a host system
is illustrated in these steps:
1. The host sends an expected screen down to you at your terminal.
2. You look at and understand which screen is presented to you.
3. You take the required actions based on your understanding (type keystrokes,
and so forth).
4. Another screen is presented after these actions.
5. If you see the screen you expected, repeat steps 2, 3, and 4.
6. If you do not see the screen you expected, call the help desk or handle the
error.
This is the idea behind a state machine in the Macro context (although the Macro
can’t call the help desk for you). The states are the screens you expect to see, and
you take actions on those screens to change from one state, or screen, to another.
That’s it, see a screen, perform the action, see the next screen. It is easier to
understand (and program) a macro with this approach than having several
if-then-else and do-while programming statements. Remember, see a screen,
perform the action, see the next screen.
Now take a look at how well suited XML is to coding a macro. Here is an example
of how to specify a logon macro:
<HAScript>
<screen name="Logon" entryscreen="true">
<description>
<string value="Please Logon" casesense="true"/>
<cursor row="12" col="10"/>
</description>
<actions>
<prompt name="ID" row="12" col="10" len="8"/>
<prompt name="Password" row="13" col="10" len="8"/>
<input value="[enter]"/>
</actions>
<nextscreens>
<nextscreen name="[Link]"/>
</nextscreens>
</screen>
<HAScript>
Keep in mind that the actions happen in sequence. The <screen> tag describes a
logon screen with the text Please Logon on the screen and the screen’s cursor
position at row 12, column 10. If the macro logic sees a screen matching this
description, it prompts the user for an ID and password, places the prompt results
at the specified row and column positions, and sends the ENTER key, effectively
logging on the user. The <nextscreens> tag specifies a list of <nextscreen> tags,
and the <nextscreen> tags list the names of other <screen> tags that appear later
in the macro. If a next screen does not appear, the macro logic returns an error.
Although there are many valid XML tags, XML is not complicated. A screen is
specified with a description, actions, and the next screens. When a macro is played
and a screen matching the description appears, the actions are executed for that
screen and the macro logic monitors the host for any next screens specified.
Macro
The following are valid macro tags:
<HAScript>
<vars>
<create>
<screen>
<comment>
<description>
<oia>
<cursor>
<numfields>
<numinputfields>
<string>
<attrib>
<customreco>
<varupdate>
<actions>
<prompt>
<input>
<extract>
<message>
<trace>
<filexfer>
<pause>
<mouseclick>
<boxselection>
<commwait>
<custom>
<varupdate>
<playmacro>
<if>
<else>
<runprogram>
<nextscreens>
<nextscreen>
<recolimit>
These XML tags and their attributes are valid in the IBM Host On-Demand Macro
XML namespace. This description of the tags is structured like an actual macro file.
The tag and attribute values are not case sensitive.
<HAScript> tag
The HAScript tag is the main enclosing tag for the macro. All other tags at this
level that are not HAScript are ignored by the parser.
Note: You cannot use variables as the values for HAScript tag attributes.
Note: The maximum pause time is limited to the platform on which the
macro is running.
timeout
The allowable time in milliseconds between recognition events. If time
expires, the macro goes into the error state. You can override this value in
the <nextscreens> tag. The value must be a number. The default is 60,000
milliseconds (60 seconds).
Note: The maximum pause time is limited to the largest numeric value
supported on the platform on which the macro is running.
suppressclearevents
This is an advanced feature that determines whether the system should
ignore screen events when a host application sends a clear screen
command immediately followed by an end of record indicator in the data
stream. You may want to set this value to true if you have screens in your
application flow that have all blanks in them. If there is a valid blank
screen in the macro and clear commands are not ignored, it is possible that
a screen event with all blanks will be generated by clear commands
coming from an ill-behaved host application. This will cause a screen
Example
<HAScript name="Logon Macro" description="Logs me on" author="btwebb"
creationdate="12/29/1998" promptall="true" pausetime="500" timeout="10000"
usevars="true"> ...
</HAScript>
<vars> tag
Defines variables that are used in the macro if the usevars attribute of the
<HAScript> tag is set to true. (If usevars is set to false and the macro parser finds
a <vars> tag in the macro, the parser displays an error message telling you to set
usevars to true.
Including the <vars> tag in a macro has the same effect as defining variables
through the Variables tab in the Host On-Demand Macro Editor. The <vars> tag
must occur before the <screen> tag in a macro.
Use the <create> tag to declare variables and assign initial values to them. See
“Using variables” on page 147 for detailed information on how variables can be
used in macros.
Variables can be inherited from another macro. See the description of the
<playmacro> tag for details.
<create> tag
Declares variables and assigns initial values to them. See “Using variables” on
page 147 for detailed information on how variables can be used in macros.
<screen> tag
The <screen> tag is the enclosing tag for the screen.
Note: There can be only one screen with the entryscreen attribute set to
true.
exitscreen
If true, a match on the screen causes the macro to stop playing. You can
have multiple screens with the exitscreen attribute set to true. This value
must be true or false or an expression that evaluates to true or false. This
attribute is optional. The default is false.
transient
If true, the screen is handled as transient. Transient screens exist outside
the normal macro flow. They are matched after nontransient screens. If
you specify next screens in a transient screen, the next screens are
ignored. Use this attribute to specify a throw-away screen that can appear
at any time in the screen flow. This value must be true or false or an
expression that evaluates to true or false. This attribute is optional. The
default is false.
pause Time (in milliseconds) to pause before the screen recognition engine
attempts to match next screens. A value greater or equal to 0 overrides the
value specified on the pausetime attribute of the <HAScript> tag.. The
default value is -1.
Example
<screen name="screen1" entryscreen="true" exitscreen="false" transient="false">
...
</screen>
<comment> tag
The <comment> tag for the screen. This can contain any valid Unicode character.
Example
<comment> ... </comment>
By default, when the Macro Manager records a macro, the OIA and Field Counts
descriptors are defined to identify the screen. It is recommended that you add
String descriptors for more strict and accurate screen recognition.
Example
<description uselogic="1 and (2 or !3)"> ... </description>
<oia> tag
The <oia> tag specifies an operator information area (OIA) condition to match.
This tag is optional. The default is to wait for inhibit status.
Example
<oia status="NOTINHIBITED" optional="false" invertmatch="false" />
Example
<cursor row="1" col="1" optional="false" invertmatch="false" />
<numfields> tag
The <numfields> tag defines the total number of fields on the screen. This tag is
optional. The number of fields not used if not specified.
Example
<numfields number="10" optional="false" invertmatch="false" />
<numinputfields> tag
The <numinputfields> tag defines the total number of input fields on the screen.
This tag is optional. The number of input fields is not used if not specified.
Example
<numinputfields number="10" optional="false" invertmatch="false" />
<string> tag
The <string> tag describes the screen based on a string.
Note: Negative values are valid and are used to indicate relative position
for the bottom of the screen (for example, -1 is the last row).
col The starting column position for the string at an absolute position or in a
rectangle. The value must be a number or an expression that evaluates to a
number. This attribute is optional.
erow The ending row position for string in a rectangle. The value must be a
number or an expression that evaluates to a number. This attribute is
optional. If both erow and ecol are specified, string is in a rectangle.
ecol The ending column position for string in a rectangle. The value must be a
number or an expression that evaluates to a number. This attribute is
optional. If both erow and ecol are specified, string is in a rectangle.
casesense
If true, string comparison is case sensitive. The value must be true or false
or an expression that evaluates to true or false. This attribute is optional.
The default is false.
optional
If false, this descriptor is considered non-optional during screen
recognition. If the descriptors are comprised of more than one non-optional
descriptor, and more than one optional descriptor, the non-optional
descriptors are checked first. If all of the non-optional descriptors match,
the screen matches. If at least one of the non-optional descriptors does not
match, the optional descriptors are checked. One of the optional
descriptors must match for the screen to match. Otherwise, the screen fails
to match. The value must be true or false or an expression that evaluates to
true or false. This attribute is optional. The default is false.
Examples
<string value="hello" row="1" col="1" optional="false" invertmatch="false" />
<string value="hello" row="1" col="1" erow="11" ecol="11" casesense="false"
optional="false" invertmatch="false" />
<string value="hello" />
Example
<attrib value="0x01" row="1" col="1" plane="COLOR_PLANE" optional="false"
invertmatch="false" />
<customreco> tag
The macro logic will call out to any custom recognition listeners for the custom tag
to have the listener do its own custom screen recognition logic.
Example
<customreco id="id1" optional="false" invertmatch="false"/>
<varupdate> tag
Modifies the values of variables. This element may be used anywhere within the
<description> and <actions> tag blocks. For more information about macro
variables, see “Using variables” on page 147.
Example
<screen>
<description>
<varupdate name="$var_boolean$" value="false"/>
<varupdate name="$var_int$" value="5"/>
<varupdate name="$var_double$" value="5"/>
<varupdate name="$var_string$" value="new_texts"/>
<varupdate name="$var_field$" value="4,5"/>
</description>
</screen>
<actions> tag
The <actions> tag is the enclosing tag for the actions associated with the screen.
Example
<actions promptall="true"> ... </actions>
<prompt> tag
The <prompt> tag specifies a prompt to be handled for the screen.
Example
<prompt name="ID" row="1" col="1" len="8" description="ID for Logon"
default="btwebb" clearfield="true" encrypted="true"
assigntovar="$userID$/>
<input> tag
The <input> tag specifies keystrokes to be placed on the screen.
Example
<input value="IBM[tab] is cool [enter]" row="1" col="1" movecursor="true"
xlatehostkeys="true" />
<extract> tag
The <extract> tag specifies an area where the screen’s contents are to be extracted.
The last row does not contain a new line character (/n). The variable can
be of any data type. If the variable is an integer or a double, the extracted
text must be of a matching data type; otherwise an error or unexpected
result occurs.
Example
<extract name="Get Data" srow="1" scol="1" erow="11" ecol="11"
assigntovar=$data_var$ />
<message> tag
The <message> tag specifies a message to be sent to the user.
Example
<message value="Accessing Host System" title="Message from IBM" />
<trace> tag
The <trace> tag specifies a string to be sent to one of several trace facilities.
Example
<trace value="hello" type="HODTRACE" />
<filexfer> tag
The <filexfer> tag transfers a file to or from a host system.
<pause> tag
The <pause> tag causes the macro engine to sleep for the number of milliseconds
specified. This action is useful for pausing between several file transfers. The value
specified for the <pause> tag overrides the value specified on the pausetime
attribute of the <HAScript> tag.
Example
<pause value="2000" />
<mouseclick> tag
The <mouseclick> tag simulates a user mouse click on the terminal bean. This
essentially sets the cursor at a given row and column position.
Example
<mouseclick row="20" col="16" />
<boxselection> tag
The <boxselection> tag is used for either marking or unmarking the marking
rectangle on the terminal bean.
Example
<boxselection srow="1" scol="1" erow="11" ecol="11" type="SELECT" />
<commwait> tag
The <commwait> tag is used for performing a communication status wait during a
macro’s execution.
Example
<commwait value="CONNECTION_READY" timeout="10000" />
<custom> tag
The <custom> tag enables the user to have an exit to Java code. See the Host
On-Demand Java documentation for the MacroActionCustom class.
Example
<custom id="custom1" args="IBM means world class computers" />
Example
<screen>
<actions>
<varupdate name="$var_boolean$" value="false"/>
<varupdate name="$var_int$" value="5"/>
<varupdate name="$var_double$" value="5"/>
<varupdate name="$var_string$" value="new_texts"/>
<varupdate name="$var_field$" value="4,5"/>
</actions>
</screen>
<playmacro> tag
Runs a macro from within another macro. This process is called chaining. The
currently running macro (the parent macro) stops and the macro specified in the
The <playmacro> tag must be the last action within the same screen. Any actions
after a <playmacro> tag will cause errors to occur. Any actions after a
<playmacro> tag will cause errors to occur. The exception is if a <playmacro> tag
is contained within an <if>-<else > block (that is, a condition must be satisfied for
the macro to play). You can include as many <playmacro> tags in a screen as you
like as long as each one is contained within an <if>-<else > block. Each <if>-<else
> block can only contain one <playmacro> tag and the <playmacro> tag must be
the last action in the block. Control immediately passes to the child macro if it is
executed from within an <if>-<else > block; subsequent tags in the parent macro
are ignored.
If you wish to chain macros in an application that uses the Host On-Demand beans
or HACL APIs, you need to do the following:
v Only managed macros can be chained, so you need to use the MacroManager
bean or implement your own MacroIOProvider class.
v Because macros are chained by macro name, you must assign a name to each
macro that is to be chained.
Note: You cannot use variables as the values for <playmacro> tag attributes.
Example
<actions>
<playmacro name="Macro1" startscreen="intro_screen" transfervars="Transfer" />
</actions>
<if> tag
Allows the macro to perform operations based on the truth or falsehood of some
condition. If the condition evaluates to true, the operations within the <if> block
are performed. If it evaluates to false, they are not. Optionally, an <else> tag can be
Conditions are evaluated from left to right. The operators && (logical AND)
and || (logical OR) can be used between conditions to perform logical
operations on conditional statements. If you are using a code editor to edit
the macro, you may need to enter && as &&. See “Using
variables” on page 147 for instructions on how to use the reserved
characters single quote (’) and backslash (\).
Example
<actions>
<if conditions="($var_int$ == 1) || ($var_bool)">
... # Perform macro operations
</if>
</actions>
<else> tag
An <else> tag can be used with an <if> tag to specify operations that are
performed if the <if> conditional statement evaluates to false. This tag can only be
used immediately after an <if> tag. See “Using conditional (if-else) statements” on
page 154 for more information and examples.
Example
<actions>
<if conditions="($var_int$ > 10>
... # Perform macro operations if $var_int$ is greater than 10
</if>
<else>
... # Perform other macro operations if $var_int$ is less than
# or equal to 10
</else>
</actions>
<runprogram> tag
The <runprogram> tag runs an application from a macro.
Note: See “Using variables” on page 147 for instructions on how to use the
reserved characters single quote (’) and backslash (\).
param Passes a parameter (such as a file name) to the application. The name must
be a string enclosed in single quotes (’) or a string variable.
wait If this parameter is set to true, the macro waits for the application to finish
running before resuming play. The default value is false.
assignexitvalue
Assigns the exit value of the application to a variable. The value of the
wait attribute must be set to “true” in order to use the assignexitvalue
attribute.
Example
<runprogram exe="C:\Program Files\Windows NT\Accessories\[Link]"
param="new_file.doc" wait="true"
assignexitvalue="$exitstatus$" />
<nextscreens> tag
The <nextscreens> tag contains all the valid next screens to be recognized after the
current screen’s actions have been executed.
Example
<nextscreens> ... </nextscreens>
<nextscreen> tag
The <nextscreen> tag forces a next screen. Multiple <nextscreen> tags are allowed.
If a screen appears that is in the macro but is not a next screen, the macro will go
into an error state. If the next screen refers to a screen tag that doesn’t exist, the
macro will have a parse error.
Example
<nextscreen name="screen1" />
<recolimit> tag
The <recolimit> tag is for advanced use only. It is used to enforce a limited
amount of time a screen can be recognized in a row before it goes to the screen
indicated in the goto attribute. This tag is useful for screen looping where you
Note: The actions will not be executed the last time the screen is
recognized.
goto The name of the screen to go to when recognition limit has been reached.
This can be any valid Unicode character but the screen must exist in the
macro. For Host Publisher, this attribute is optional. If no goto screen is
given, the macro terminates.
Example
<recolimit value="3" goto="endscreen"/>
You cannot use the optional attribute to decribe a screen as follows: OIA status
NOTINHIBITED and string “aaaaaaaaaaa” OR not oia NOTINHIBITED and string
“bbbbbbbbbbb”.
Optionally, you can set up more sophisticated matching conditions for screen
descriptions by using the uselogic attribute of the <description> tag. This optional
attribute allows you to match screens by specifying logical relationships among the
screen descriptors such as the following:
<description uselogic="(1 and 2) or (!1 and 3)" />
<oia status="NOTINHIBITED" />
<string value="aaaaaaaaaaa" />
<string value="bbbbbbbbbbb" />
</description>
The “!” in “(1 and 2) or (!1 and 3)” /> stands for not. It is the equivalent of the
invertmatch attribute. The numbers represent the descriptors, in the order
specified. In this example, the screen description matches if the OIA status is
NOTINHIBITED and the string value is “aaaaaaaaaaa” OR the OIA status is not
NOTINHIBITED and the string value is “bbbbbbbbbbb”. The key words AND and
OR can be used to represent the logical AND and logical OR operations. These key
words are not case sensitive.
Using variables
Variables can be used in macro commands to replace hard-coded values and store
the results of operations, just like in any other programming language. They can be
created by using the graphical user interface of the Macro Editor or by including
the <vars>tag in an existing macro and declaring them with the <create> tag.
Variables can also be inherited from other macros; see the description of the
<playmacro> tag for details.
To use variables within a macro (including inherited variables), set the usevars
attribute of the <HAScript> tag to true. The values of macro tag attributes are then
parsed for variable names and arithmetic operators. The value of the usevars
attribute is automatically set to false unless a variable was created by using the
Host On-Demand Macro Editor. If the value of usevars is false and the macro
parser finds a <vars> tag in the macro, the parser displays an error message telling
you to set usevars to true.
Note: When you create a macro or edit an existing macro in the Macro Editor, the
first time that you check ″Use Variables and Arithmetic Expressions in
Macro″ in the Macro Editor (setting the usevars attribute of the <HAScript>
tag to “true”), Host On-Demand displays a warning that the macro is about
to be converted for use with variables and other advanced macro features.
(Macros created under Version 6 and earlier of Host On-Demand will still
run if they are not converted; the conversion is necessary only to use
variables and some other new features introduced in Version 7.)
v If you click OK, usevars is set to true and the macro is converted. All
attributes that take string arguments (as opposed to boolean, integer, or
keyword arguments) and can be assigned values that are variables or
expressions (that is, not the <HAScript> attributes, screen names, or
uselogic attributes) are converted. Single quotes are placed around all of
the strings that are already assigned to these attributes. For example, if
you had an input action with the value “hi”, it becomes “’hi’”.
Backslashes are placed in front of existing single quotes in the string
(“robin’s” will become “’robin\’s’”), and an extra backslash is placed in
front of existing backslashes (“ab\c” will become “’ab\\c’”).
v If you do not click OK, usevars remains set to false and the macro is not
converted to the new format. You may choose not to convert if you have
already converted your macro, if you would like to convert it by hand, or
if you change your mind about using variables. You can then go into the
code and set usevars to true yourself.
Variable names are specified in a macro as $varname$, where varname is the name
assigned to the variable when it was declared using the <create> tag. The
Variables that are not defined within a macro can be assigned as attribute values
because the variables may be inherited from a parent macro (see the description of
the <playmacro> tag for details). However, when you create a variable, you cannot
set its value to that of an inherited variable because variables are created and
initialized when the macro is parsed, not at run-time.
Variable types
The following types of variables are supported:
boolean
Represents boolean values. A boolean variable can be assigned a value of
either “true” or “false”. Note that boolean variables are not case sensitive:
values such as “False” or “FALSE” are valid. A string variable or a field
variable can be assigned to a boolean variable, as long as the string or field
variable contains a valid boolean value. The default value is false.
integer
Represents integer numbers. An integer variable must be assigned a valid
integer number (for example, 3 or -4). If it is updated with a non-integer
value, the decimal portion of the value is truncated (for example, if an
integer variable is assigned a value of 4.8, the assigned value is truncated
to 4). An integer variable can be assigned an actual integer value or the
results of an arithmetic operation. The default value is 0.
double
Represents double-precision numbers. A double variable can be assigned
an actual double-precision value or the results of an arithmetic operation
when it is created. The default value is 0.0.
string Represents text strings. A string variable can be assigned combinations of
boolean, integer, double, string, or field variables, and actual text strings.
String values must be enclosed in single quotes (’). The default value is “”,
(an empty string).
field Represents text entered into a field on the terminal screen. The position
within the field is given as two integers separated by a comma (for
example, 2,3). Initially, field variables are empty. A field position must be
provided by using the <varupdate> tag, the <prompt> tag, or the <extract>
tag (if it is extracting “integer, integer” values from the screen). The text of
the field containing the specified field position is assigned to the field
variable at run-time. If the value given for the field position does not
evaluate to “integer, integer” at runtime, a runtime error occurs unless the
field’s value has been set to null (″″). If a field variable is used before a
value is assigned to it, its value is automatically set to null (″″).
Updating variables
Variable values can be updated in four different ways:
The following example shows the different ways that variables can be updated.
<HAScript usevars="true">
<vars>
<create name="$var_bool$" type=boolean value="true"/>
<create name="$var_int$" type="integer" value="1"/>
<create name="$final_count$" type="integer"/>
<create name="$var_double$" type="double" value="1.0"/>
<create name="$var_string$" type="string" value="some_texts"/>
<create name="$var_field$" type="field"/>
</vars>
<screen>
<description>
<varupdate name="$var_bool$" value="false" />
</description>
</screen>
<actions>
<prompt name="textstring" row="1" col="1" len="72"
description="Enter a text string"
clearfield="true" encrypted="false"
assigntovar=$var_string$/>
<prompt name="intnumber" row="2" col="1" len="24"
description="Enter an integer"
clearfield="true" encrypted="false"
assigntovar=$var_int$/>
<varupdate name="$var_field$" value="4,5" />
<extract name="Get Double value" srow="4" scol="1"
erow="4" ecol="18" assigntovar=$var_double$ />
<runprogram exe="C:\myapps\[Link]"
wait="true" assignexitvalue="$final_count$"/>
</actions>
</HAScript>
Arithmetic operations
Arithemetic operations can be performed on numbers, integer variables, double
variables, field variable, and string variables. Boolean variables can be used in
concatenation operations. The following operations are supported:
v + - Add
– If the + operator is used on two numbers, they are added.
– If the + operator is used on two strings or a string and a number, the
operands are concatenated.
To display these characters on the screen, specify them as literal strings enclosed in
single quotes (’) - for example, to display the plus sign (+) on the screen, specify
the string ’+’ in the macro. (For instructions on how to use the reserved characters
single quote (’) and backslash (\), see “Using Special Characters in Macros” on
page 157.
The following examples show how to use arithmetic operations on variables. Each
example gives the syntax of the operation and shows its result. In these examples,
the name of the variable is also what the variable evaluates to (for example., $5$
has a value of 5).
"(1 + 2) + ’, ’ + (3 + 5)" = 3, 8
"’Hello ’ + $Fred$ + ’!’" = Hello Fred!
"$Hi$ $There$" = Error, need a + sign to join strings
"$Hi$+$There$" = HiThere
"$Hi$+’+’+$There$" = Hi+There
"’8.13’ + 12" = 8.1312 (’8.13’ is a string)
"1 + 2 * 5" = 11
"(1 + 2) * 5" = 15
"10 - (2 / 4)" = 9.5
"(10 - 2) / 4" = 2
"11 / 4" = 2.75
"11 % 4" = 3
"11.0 / 4" = 2.75
"11 / 4.0" = 2.75
"11.0 % 4" = 3.0
"’abc1.08e4’ + 3.4e5" = abc1.08e4340000.0
"’5*3’" ="5*3"
"5 + $3$" = 53, where $3$ is a string variable
"5 + $3$" = 8, where $3$ is an integer variable
"’abc\\de’" = abc\de
"’that\’s’" = that’s
The following example shows some of the ways that arithmetic operations can be
used when creating, using, and updating variables.
<vars>
<create name="$var_boolean$" type="boolean" value="false" />
<create name="$var_int$" type="integer" value="100" />
<create name="$var2_int$" type="integer" value="$var_int$*5" />
#OK to use $var_int$ since it is defined already. Result = 500
<create name="$var_double$" type="double" value="100.9" />
#Result = 100.9
<create name="$var2_double$" type="double" value="$var_int$*5" />
#Result = 500.0
<create name="$var_string$" type="string">
<create name="$var1_string$" type="string" value="FirstString" />
</vars>
<description>
<actions>
<prompt name="’UserID:’" description="" row="20" col="16" len="8"
default="" clearfield="false" encrypted="false" movecursor="true"
xlatehostkeys="true" assigntovar="" varupdateonly="false" />
<input value="’[tab]’" row="0" col="0" movecursor="true"
xlatehostkeys="true" encrypted="false" />
<prompt name="’Password:’" description="" row="21" col="16" len="8"
default="" clearfield="false" encrypted="true" movecursor="true"
xlatehostkeys="true" assigntovar="" varupdateonly="false" />
<input value="’[enter]’" row="0" col="0" movecursor="true"
xlatehostkeys="true" encrypted="false" />
</actions>
<nextscreens timeout="0" >
<nextscreen name="Screen2" />
</nextscreens>
</screen>
</HAScript>
Assume that you want to use this macro in a Host Access Beans program and you
want to store the user ID into a variable and save for later use (for example, in the
Welcome message). You could do this directly by modifying the macro, but one
reason for doing this programmatically would be to avoid having to maintain
many different macros for different situations. You could instead have a base
“skeletal” macro and modify it programmatically depending on the situation. The
following is an example of how you can do this:
// Assume macro is an instantiated Macro with the appropriate listeners set up.
// (See the Javadoc for the Macro bean and the Macro variables demo program,
// [Link], in the Host Access Toolkit samples directory
// for details.)
// Assume macroString is a String containing the previous macro script
[Link](macroString);
MacroScreens ms = [Link]();
//creates a variable $userid$ with initial value of ""
[Link]("$userid$", null);
//get the first screen
MacroScreen mscrn = [Link](0);
//get the actions from the first screen
MacroActions mas = [Link]();
//get the first prompt action
MacroActionPrompt map = (MacroActionPrompt)[Link](0);
//assign the prompt response to the variable $userid$
[Link]("$userid$");
//get the second screen
MacroScreen mscrn2 = [Link](1);
//get the actions from the second screen
MacroActions mas2 = [Link]();
Suppose you now want to add a second message to the actions for Screen2. In this
message, you want to display the time and date, which you extract from the
screen. You would add the following lines before [Link](ms):
//create a variable $datetimestamp$ with initial value ""
[Link]("$datetimestamp$", null);
//create new extract to get date and time from second row of screen
MacroActionExtract mae = new MacroActionExtract(2, 35, 2, 71, "’datetimeextract’");
//assign the date and time string to $datetimestamp$
[Link]("$datetimestamp$");
//add the extract after the first message
[Link](mae);
//create a new message to //display the date and //timestamp
[Link](mae);
MacroActionMessage mam2 = new MacroActionMessage("’You have logged on at ’
+ $datetimestamp$", "’Date Time Stamp’");
//add the message after the extract
[Link](mam2);
Note that at the point when the attribute containing the variable(s) is associated
with the MacroScreens, you must have already created the variable (through one of
the createVariable() methods). For example, this code sequence would also be
valid:
MacroActionExtract mae = new MacroActionExtract(2, 35, 2, 71, "’datetimeextract’");
[Link]("$datetimestamp$");
[Link]("$datetimestamp$", null);
[Link](mae);
MacroActionMessage mam2 = new MacroActionMessage("’You have logged on at
’ + $datetimestamp$", "’Date Time Stamp’");
[Link](mam2);
The default value of the MacroScreens method isUseVars() is false. However, if you
call one of the createVariable() methods on your MacroScreens, isUseVars() will
return true automatically. If you don’t create any variables, but want to have your
attributes scanned for variables and arithmetic anyway (for example, you may be
writing a chained child macro that has no variables of its own but is anticipating
some from the parent), you must call setUseVars(true) on your MacroScreens.
This is because mai has not yet been associated with any MacroScreens with
isUseVars() returning true. Therefore, “$rowvar$ + 1.” is being treated as a string
rather than a variable plus one. Note also that if you had call the setAttribute()
methods to set up variables and expressions after the object containing these
attributes have been associated with the MacroScreens, you will likely experience a
savings in processing time as the attributes would otherwise need to be reparsed
for variables/expressions at the point when they are added to the MacroScreens.
Conditional <if> - <else> statements are used in <actions> tag blocks and provide
selection structures to control program flow. When used in conjunction with
variables, they are a powerful tool for creating sophisticated macros.
The operators && (logical AND) and || (logical OR) can be used between
conditions to evaluate their logical relationships. If you are entering && through a
code editor, you may need to enter it as &&.
The following example shows an <if> - <else> statement with multiple conditions:
<vars>
<create name="$condition1$" type="string"/>
<create name="$condition2$" type="boolean" value="false"/>
<create name="$condition3$" type="integer"/>
</vars>
<screen>
<description>
... # Screen elements
</description>
<actions promptall="true">
<extract name="Get condition 1" srow="2" scol="1" erow="2"
ecol="80" assigntovar="$condition1$"/>
<extract name="Get condition 2" srow="3" scol="1" erow="3"
ecol="80" assigntovar="$condition2$"/>
<extract name="Get condition 3" srow="4" scol="1" erow="4"
The local format is determined by checking the NLS locale of the current Host
On-Demand session. The <HAScript> usevars attribute must be set to “true” to
use these conversion methods. Conversion methods can be nested.
These conversion methods can be used as the values of macro attributes in the
same way as variables. As their parameters, they can take numeric values, strings,
or variable expressions that evaluate to a numeric value or string. Parentheses are
reserved. To specify an argument string containing one of these characters (for
example, an arithmetic expression), assign the argument string to a variable first,
then use the variable as the argument.
In the following example, the value 3.24 is converted to its local equivalent (for
example, 3,24) when it is sent to the screen:
<input value="$FormatNumberToString(3.24)$" row="1" col="1"
movecursor="true" xlatehostkeys="false" />
If variables are in use in the macro (that is, if the <HAScript> tag’s usevars
attribute is set to ″true″), special characters are used in a macro as follows:
v \ - Used to identify special characters. If you want to write a ″\″ character to
the screen, you must enter \\ in the macro. For example, ’C:\\[Link]’
writes ″C:\[Link]″ to the screen.
v ’ - Used to identify literal strings (such as ’some text’). If you want to actually
write a ″’″ character to the screen, you must enter \’ in the macro. For example,
’it\’s’ writes ″it’s″ to the screen.
v The characters +, -, *, /, %, >, <, =, & and | are evaluated as operators unless
enclosed in single quotes (’) as part of a literal string.
v The characters $x$ identify a variable or method (where x is the variable’s name,
such as $MyVariable$) unless enclosed in single quotes (’) as part of a literal
string.
If variables are not in use (that is, if the <HAScript> tag’s usevars attribute is not
set to ″true″), special characters are treated as follows:
v The single quote and backslash characters are not treated specially. For example,
C:\[Link] writes ″C:\[Link]″ to the screen and it’s writes ″it’s″ to the
screen.
v The characters +, -, *, /, %, $, >, <, =, & and | are evaluated as literal characters,
not operators.
IBM may have patents or pending patent applications covering subject matter
described in this document. The furnishing of this document does not give you
any license to these patents. You can send license inquiries, in writing, to:
IBM Director of Licensing
IBM Corporation
North Castle Drive
Armonk, NY 10504-1785
U.S.A.
For license inquiries regarding double-byte (DBCS) information, contact the IBM
Intellectual Property Department in your country or send inquiries, in writing, to:
IBM World Trade Asia Corporation
Licensing
2-31 Roppongi 3-chome, Minato-ku
Tokyo 106, Japan
The following paragraph does not apply to the United Kingdom or any other
country where such provisions are inconsistent with local law:
INTERNATIONAL BUSINESS MACHINES CORPORATION PROVIDES THIS
PUBLICATION “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER
EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS
FOR A PARTICULAR PURPOSE. Some states do not allow disclaimer of express or
implied warranties in certain transactions, therefore, this statement may not apply
to you.
Any references in this information to non-IBM Web sites are provided for
convenience only and do not in any manner serve as an endorsement of those Web
sites. The materials at those Web sites are not part of the materials for this IBM
product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it
believes appropriate without incurring any obligation to you.
The licensed program described in this information and all licensed material
available for it are provided by IBM under terms of the IBM Customer Agreement,
IBM International Program License Agreement, or any equivalent agreement
between us.
This information contains examples of data and reports used in daily business
operations. To illustrate them as completely as possible, the examples include the
names of individuals, companies, brands, and products. All of these names are
fictitious and any similarity to the names and addresses used by an actual business
enterprise is entirely coincidental.
COPYRIGHT LICENSE:
If you are viewing this information softcopy, the photographs and color
illustrations may not appear.
Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the
United States, other countries, or both.
Other company, product, and service names may be trademarks or service marks
of others.
Glossary 165
WebSphere Application Server
An IBM software product that provides the core software needed to
deploy, integrate and manage e-business applications. HATS applications,
when assembled and transferred to a server, run as WebSphere Application
Server applications.
WebSphere Studio
Any of several IBM software products that provide an integrated
development environment based on the Eclipse open-source platform.
widget
A visual element of a Web page, such as a button, entry field, or
drop-down list. HATS applications transform host components into
widgets.
wizard
An interface that enables you to complete a task in defined steps. HATS
uses wizards to create projects and their resources.
workbench
Synonym for WebSphere Studio.
XML See Extensible Markup Language.
Index 169
HATS (continued) hostName attribute keypad (continued)
screen capture 6 session tag 108 changing 50
screen customization 4 hostorientation attribute host 14
basic principles 17 filexfer tag 139
screen customization action 4
screen recognition 4 L
template 5, 31
CSS style 33
I lamalefcompression attribute
id attribute filexfer tag 139
designing 32
custom tag 141 lamalefexpansion attribute
overview 5
ID attribute filexfer tag 139
tracing 65
customreco tag 133 len attribute
transformation 4
if tag 143 prompt tag 136
designing 25
image files 122 license tracking 66
troubleshooting 65
immediateKeyset attribute log files 67
widget
apply tag 116 logging 65
classes 58
importing Java code 42 logic
creating 58
importing macros 38 business 5
HATS Studio support 60
index attribute
HATS:Component tag 55
extract tag 117
overview 5
registering 58
insert tag 116
set tag 117
M
setWriter() 58 macro
indexed attribute
widgets 92 description 5
extract tag 117, 121
HATS Studio support HATS 5
input tag 136
custom component 60 macro (.hma) file 120
insert global variable action 21
custom widget 60 macro attribute
insert global variable wizard 28
HATS terminal 6 play tag 119
insert host component wizard 26
description 6 macro key
insert macro key wizard 27
HATS:Component tag inserting 27
insert prompt wizard 37
attributes 55, 102 macro script 123
insert tabbed folder wizard 27
example 55 macro tag 120
insert tag 116
operations 56 macro tags
Integration Objects
HOD logon macro actions 135
Host Publisher 43
example 126 attrib 133
invertmatch attribute
host applications, Web environment 1 boxselection 140
attrib tag 133
host component 89 comment 128
cursor tag 130
custom commwait 141
customreco tag 134
creating 57 create 127
numfields tag 131
inserting 26 cursor 130
numinputfields tag 131
settings 89 custom 141
oia tag 119, 129
host component, HATS customreco 133
string tag 120, 132
classes 57 description 129
invertmatch criteria 19
creating 57 else 144
custom 57 extract 121, 137
HATS:Component tag 55 extracts 120
overview 5 J filexfer 138
host components Java code HAScript 122
HATS 89 importing 42 overview 125
host keyboard support if 143
See keyboard support input 136
host keypad
HATS 14
K macro 120
message 138
keyboard support 14
settings 14 mouseclick 140
cascading style sheet 50
Host On-Demand macros nextscreen 145
defining 50
importing 38 nextscreens 145
description 6
Host On-Demand tracing 70 numfields 130
enabling 49
host print support numinputfields 131
end users 51
See print support oia 129
HATS 6, 14
Host Publisher pause 140
keypads
EJB Access Beans 43 playmacro 142
changing 50
Integration Objects 43 prompt 121, 135
kinds 49
remote Integration Objects 43 prompts 121
mapped keys 51
Web Services 43 recolimit 145
mapping 51
Host Publisher macros runprogram 144
overview 49
importing 38 screen 128
settings 14
hostfile attribute string 131
keypad
filexfer tag 139 trace 138
application 14
Index 171
S srow attribute
boxselection tag 140
transformation (continued)
description 4
save attribute extract tag 117, 137 design tab 25
extract tag 121 SSL security editing 25
scol attribute enabling 53 HATS 4
boxselection tag 140 overview 53 preview tab 28
extract tag 117, 137 startscreen attribute source tab 28
screen capture playmacro tag 143 transformation (.jsp) file 115
description 6 status attribute transformation attribute
HATS 6 oia tag 119, 129 apply tag 116
screen capture (.hsc) file 122 string tag 119, 131 transformation, HATS
screen customization style ,sheet cascading 50 designing 25
action 4 stylesheet (.css) file 122 transient attribute
actions tab 19 stylesheets screen tag 128
cursor position criteria 18 using 33 type attribute
description 4 suppressclearevents attribute boxselection tag 141
editing 17 HAScript tag 125 create tag 127
field criteria 17 syntax, macro script 123 event tag 116
HATS 4 HATS:Component tag 102
ordering 23 session tag 110
overview tab 17
screen recognition criteria tab 17 T set tag 117
trace tag 138
source tab 23 tabbed folder
text string location criteria 18 inserting 27
screen customization (.evnt) file 115 template
screen customization action description 5 U
description 4 design tab 32 unwrap attribute
HATS 4 HATS 5 extract tag 137
screen recognition preview tab 33 URL
description 4 source tab 33 showing 23
HATS 4 template (.jsp) file 115 url attribute
screen recognition criteria tab template attribute show tag 119
screen customization 17 application tag 105 uselogic attribute
screen tag 119, 128 apply tag 116 description tag 129
screenSize attribute template tab usevars attribute
session tag 110 modifying projects 12 HAScript tag 126
server considerations 8 template, HATS Using stylesheets 33
applying service 9 creating 31
license tracking 9 designing 32
logging 9 overview 5
selecting 31
V
maintenance 9 value attribute
tracing 9 terminal
attrib tag 133
session tag 106 HATS 6
commwait tag 141
sessions tag 106 text replacement tab
create tag 127
set global variable action 22 modifying projects 12
input tag 137
set tag 117 text string location criteria
insert tag 116
setting tag 112 screen customization 18
message tag 138
settings 89, 92 textReplacement tag 114
pause tag 140
application keypad 14 timeout attribute
prompt tag 122
client locale 15 commwait tag 141
recolimit tag 146
host keypad 14 filexfer tag 139
setting tag 114
keyboard support 14 HAScript tag 125
string tag 119, 131
show tag 119 nextscreens tag 145
tag 134
show URL action 23 title attribute
trace tag 138
showHandler attribute message tag 138
varupdate tag 142
extract tag 121 to attribute
variable
skip-screen macros replace tag 115
global 5
description 37 trace files 66
variableIndex attribute
source attribute trace tag 138
prompt tag 122
insert tag 116 tracing 65
variableName attribute
prompt tag 121 Host On-Demand 70
extract tag 121
source tab runtime 67
prompt tag 122
macros 39 tracking
vars tag 126
modifying projects 15 license 66
varupdate tag 134, 142
screen customization 23 transfervars attribute
varupdateonly attribute
template 33 playmacro tag 143
prompt tag 136
transformation 28 transformation
applying 20
X
xlatehostkeys attribute
input tag 137
prompt tag 136
xml tags
application 105
class 112
classSettings 112
event 112
eventPriority 111
otherParameters 110
replace 114
session 106
sessions 106
setting 112
textReplacement 114
Index 173
174 IBM® WebSphere® Host Access Transformation Server Developer’s Guide
Readers’ Comments — We’d Like to Hear from You
IBM® WebSphere® Host Access Transformation Server
Developer’s Guide
Version 4
Overall, how satisfied are you with the information in this book?
How satisfied are you that the information in this book is:
When you send comments to IBM, you grant IBM a nonexclusive right to use or distribute your comments in any
way it believes appropriate without incurring any obligation to you.
Name Address
Company or Organization
Phone No.
___________________________________________________________________________________________________
Readers’ Comments — We’d Like to Hear from You Cut or Fold
SC31-6324-00 Along Line
_ _ _ _ _ _ _Fold
_ _ _and
_ _ _Tape
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Please
_ _ _ _ _do
_ _not
_ _ staple
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _Fold
_ _ _and
_ _ Tape
______
NO POSTAGE
NECESSARY
IF MAILED IN THE
UNITED STATES
IBM Corporation
Software Reengineering
Department G7IA/ Bldg 503
Research Triangle Park, NC 27709-9990
_________________________________________________________________________________________
Fold and Tape Please do not staple Fold and Tape
Cut or Fold
SC31-6324-00 Along Line
Printed in U.S.A.
SC31-6324-00