142 Using IBM WebSphere Host Access Transformation Services V5
3. In the macro, we add two actions:
An Add Prompt Action to request the account number needed for the
customer information request. The variable name is account. See
Figure 2-74.
An Extract Prompt Action. The variable name is myresult. We use this
extract action to show the results of the request. See Figure 2-74.
Figure 2-74 Credit account demonstration
2.3.2 Generating an Integration Object with a 3270 application
In the beginning of this chapter, we explain that you can generate Integration
Objects using APIs or macros. In this case, we use the macro to generate the IO.
account variable
myresult variable
Chapter 2. Integrating HATS with business applications 143
1. As shown in Figure 2-75, select project name
Macros macro name
(TCHM2). Right-click and select Create Integration Object.
Figure 2-75 Starting Create Integration Object
144 Using IBM WebSphere Host Access Transformation Services V5
2. After a few seconds, HATS generates a Java application with the same name
of the macro. You can see the IO generated when you select project
name
Source IntegrationObject TCHM2 as shown in Figure 2-76.
Figure 2-76 IO generated
3. Example 2-5 shows the IO code that you can use to validate your IO.
Example 2-5 IO example
package IntegrationObject;
import com.ibm.HostPublisher.IntegrationObject.*;
import com.ibm.HostPublisher.Server.Ras;
public class TCHM2 extends HPubHODCommon
{
public static float getIOTemplateVersion() { return 5.0F; } //
Template version - HATS 5.0
public static String getIOTemplateType() { return "-DEFAULT"; } //
Template type - Host Default
public static String getIOVersionInfo() { return "(IBM)"; } //
Version info - IBM supplied
public static String getIOTemplateRevision() { return ":1.1"; } //
Template revision per version - internal value
public String hPubIOVersion= getIOBaseVersion()+";"+getHPubBeanType()+
getIOTemplateType()+getIOTemplateVersion()+
getIOTemplateRevision()+getIOVersionInfo();
public String getIOVersion() { return hPubIOVersion; }
// Generated Objects
Chapter 2. Integrating HATS with business applications 145
HAOVariable account = new
HAOVariable("account","null","account",true,"",0,0,5,0,HAO_VARIABLE_SIMPLE);
HAOVariable myresult = new
HAOVariable("","myresult","myresult",false,"",0,0,12,5,HAO_VARIABLE_SIMPLE);
// Constructor
public TCHM2()
{ // Generated vector population
vHAOVariables.addElement(account);
vHAOVariables.addElement(myresult);
hPubStartPoolName = new String("main");
hPubStartChainName = null;
hPubStartType = BEAN_START_FROM_POOL;
hPubEndChainName = null;
hPubEndType = BEAN_END_TO_POOL;
stringHODMacroFilename = "TCHM2.hma";
stringBeanName = new String("TCHM2");
hPubBeanName = new String("TCHM2");
}
// ***********************************************************************
/* Generated Setters */
public void setAccount( String stringToBe)
{
hPubErrorOccurred = 0;
allowTracing(); // call made in case started from IDE and was not able to
// start tracing on the constructor
if (HPubTracingOn) { Ras.traceEntry( className, "setAccount(String)",
stringToBe); }
account.stringValue = stringToBe;
}
/* Generated Getters */
public String getAccount()
{
hPubErrorOccurred = 0;
if (HPubTracingOn) { Ras.trace( className, "getAccount simple: ",
account.stringValue); }
return (account.stringValue);
}
public String getMyresult()
{
hPubErrorOccurred = 0;
if (HPubTracingOn) { Ras.trace( className, "getMyresult simple: ",
myresult.stringValue); }

Get Using IBM WebSphere Host Access Transformation Services V5 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.