Java Sample Application

In this sample you will create a Java application that sends input to and receives output from your client operation, using a Java bean and a CICS host type. The sample application and the files used to create and deploy it are all installed on your computer when you install Transaction Studio

Sample Files

The sample consists of several different files with different purposes. The purposes of each file are explained in the sections after the list below. The files below can be found in the following location:

install_directory/Samples/AMNU/

Task Creation and Output

In this sample, AMNU.jar (from the COBOL copybook, AMNU.cbl) is provided. You do not have to use the Transaction Studio to create it. However, you can generate this file yourself by following these steps:

  1. Create a new project named AMNU.
  2. Add a new Host Transaction using program name 'DFH$AXCS'.
  3. Import the copybook AMNU.cbl.
  4. Add a new Client Operation GetUserInfo.
  5. Customize the input and output fields to match your desired API. In this example, several fields were removed from the inputs, and fields were renamed to read more clearly.
  6. For this example, the Project Properties were edited to use the package name sample.amnu. You should use unique package names to reduce the chance that generated classes will have naming conflicts between projects.
  7. Save and build the project.

Task Usage in Sample Application

The application in Sample.java demonstrates how to use the API created by the Transaction Studio to execute the transaction AMNU on your host with some provided input values, and writes the returned values to OutputFromHost.txt.

BridgeAPI.jar is not included in the Samples directory, but is included in VBI distributable. It is a runtime dependency for communication with the host.

Before running the Sample application, you will need to provide some configuration information on where it can find your host, and how to authenticate. This can be done in the AMNU.properties file, or in the application code. For the purposes of this sample, we recommend you put the host and port values in the properties file, and username and password in the run.bat or run.sh script used to execute the sample. See the comments in AMNU.properties and Sample.java for more information

Related Topics
Bullet Using Java Development Environments
Bullet Java Input and Output Examples