Example of manually exposing interactionSpec: CICS® Taderc99 sample

You can expose the properties of InteractionSpec and ConnectionSpec for output so that your Java™ application can get the property values after the transaction has been executed.

Before you begin

To expose properties of InteractionSpec for output, you must create an output class and modify the interface and implementation files of your J2C bean before using it in an application.

Procedure

The sample code exposes the functionName InteractionSpec property from the taderc99 example. Here is an example of the wrapper class:
package sample.cics.data;

public class WrapperBean {
	protected CustomerInfo customerInfo;
	protected String funcName;

	/**
	 * @return Returns the functionName.
	 */
	public String getFuncName() {
		return funcName;
	}
	/**
	 * @param functionName The functionName to set.
	 */
	public void setFuncName(String functionName) {
		this.funcName = functionName;
	}
	/**
	 * @return Returns the customerInfo.
	 */
	public CustomerInfo getCustomerInfo() {
		return customerInfo;
	}
	/**
	 * @param customerInfo The customerInfo to set.
	 */
	public void setCustomerInfo(CustomerInfo customerInfo) {
		this.customerInfo = customerInfo;
	}
}

Example

Here is the updated method. The changes to be made are marked in bold, and the changed generated code is in italics:

/**
	 * @j2c.interactionSpec class="com.ibm.connector2.cics.ECIInteractionSpec"
	 * @j2c.interactionSpec-property name="functionName" value="TADERC99"
	 * @j2c.interactionSpec-returnProperty name="functionName" outputBinding="funcName"
	 * @generated
	 */
	public WrapperBean getCustomer(sample.cics.data.CustomerInfo arg) throws javax.resource.ResourceException {
		ConnectionSpec cs = getConnectionSpec();
		InteractionSpec is = interactionSpec;
		if (is == null) {
			is = new com.ibm.connector2.cics.ECIInteractionSpec();
			((com.ibm.connector2.cics.ECIInteractionSpec) is).setFunctionName("TADERC99");
		}
		sample.cics.data.CustomerInfo output = new sample.cics.data.CustomerInfo();
		invoke(cs, is, arg, output);
		WrapperBean bean = new WrapperBean();
		bean.setCustomerInfo(output);
		bean.setFuncName(((com.ibm.connector2.cics.ECIInteractionSpec) is).getFunctionName());
		return bean;	}

Feedback