Exercise 1.4: Deploying the application

Before you begin, you must complete Exercise 1.3: Creating the Java method.

Creating the TestECIMPO file

  1. Expand the CustomerProj project, expand the Java Resources section and select the sample.cics. package.
  2. Right click and select New. Select the New Java class icon class option to create a new Java class.
  3. In the Java class name field, type TestECIMPO.
  4. Open TestECIMPO in the Java editor.
  5. Replace all the code in the editor with the following:

TestECIMPO.java

/*******************************************************************************
 * Licensed Materials - Property of IBM
 *  
 * com.ibm.j2c.cheatsheet.content
 *  
 * Copyright IBM Corporation 2004. All Rights Reserved. 
 * 
 * Note to U.S. Government Users Restricted Rights:  Use, duplication or disclosure restricted by GSA ADP  Schedule Contract with IBM Corp. 
 *******************************************************************************/
package sample.cics;

import sample.cics.data.*;
public class TestECIMPO
{

	

	public static void process(InputComm input)
	{
		
	 System.out.println("processing....");
     try {
		//CustomerInfoMOImpl proxy = new CustomerInfoMOImpl();
		CustomerInfoMOImpl proxy = new CustomerInfoMOImpl();
     	OutputComm output = proxy.getCustomerInfo (input);

		BadCust badCust = output.getBadCust();
		PrefCust prefCust = output.getPrefCust();
		RegCust regCust = output.getRegCust();

		if (regCust != null)
		{
			System.out.println("Reg Customer");
			System.out.println("account name:  " + regCust.getAccountname());
			System.out.println("balance:  " + regCust.getBalance());
			System.out.println("cust code:  " + regCust.getRcustcode());
			System.out.println("cust no:  " + regCust.getRcustno());
		}
		else if (prefCust != null)
		{
			System.out.println("Pref Customer");
			System.out.println("assets:  " + prefCust.getAssets());
			System.out.println("cust code:  " + prefCust.getPcustcode());
			System.out.println("cust no:  " + prefCust.getPcustno());
		}
		else if (badCust != null)
		{
			System.out.println("Bad Customer");
			System.out.println("amount:  " + badCust.getAmount());
			System.out.println("cust code:  " + badCust.getBcustcode());
			System.out.println("cust no:  " + badCust.getBcustno());
			System.out.println("days overdue:  " + badCust.getDaysoverdue());
		}
		else
			System.out.println("No match");
	}
	catch (Exception exc)
	{
		System.out.println (exc);
		exc.printStackTrace();
	}
		
	}
	
	public static void testPrefCust()
	{
	   System.out.println("===========testPreCust==============");
	try {
		InputComm input = new InputComm();
		String prefC = "12345";
		input.setICustNo (prefC);
		process(input);
	}
	catch (Exception exc)
	{
		System.out.println (exc);
		exc.printStackTrace();
	}	
		
				
	}
	
	public static void testRegCust()
	{
	   System.out.println("===========testRegCust==============");
	try {
		InputComm input = new InputComm();
		String regC = "34567";
		input.setICustNo (regC);
		process(input);
	}
	catch (Exception exc)
	{
		System.out.println (exc);
		exc.printStackTrace();
	}
	
	}
	
	public static void testBadCust()
	{
	  
		System.out.println("===========testBadCust==============");
	try {
		
		InputComm input = new InputComm();
		String badC = "123";
		input.setICustNo (badC);
		process(input);
		
	}
	catch (Exception exc)
	{
		System.out.println (exc);
		exc.printStackTrace();
	}
	}
	
	
	public static void main (String[] args)
	{
		testPrefCust();
		testRegCust();
		testBadCust();
		
	}
}


Step 9: Testing the Application

  1. Right-click TestECIMPO.java and select Run > Application.
  2. The console should have the following output.

    TestEDIMPO output

Congratulations! You have completed the CICS Taderc25 Tutorial.

Finish your tutorial by reviewing the materials in the Summary.

Terms of use | Feedback

(C) Copyright IBM Corporation 2000, 2005. All Rights Reserved.