Generated Java Code

Introduction and Generated application architecture
Compiling applications using Sun JDK or Other compilers
Running Programs
Building a new project in Symantec Visual Café
Trouble Shooting
Installing ACM Components into Symantec Visual Cafe
Introduction and Generated application architecture
COBOLTranslator generates Java 2 code / screens which can be viewed at design time using Symantec Visual Café or Borland JBuilder. The generated Java code can be compiled using Sun JDK, or other Java compilers such as Microsofts, Symantecs, or etc. You can set COBOLTranslator to generate code for either of the above development tool using the Setup page.

Every COBOL program which has screen input/outputs is converted to 2 programs - one containing the screen layout, and one containing the program logic. For example Cobol program program1 will be translated to
- CFrmProgram1.java - Screen Layouts
- CProgram1.java - Inherits from CFrmProgram1.java and contains program logic.
The screens are based on a sub-class of java Panels (ACMProgramPanel - source code provided), and require that the applet / application main form to 'implement ACMAppLauncher' class (source code provided) - and start the translated programs within a separate thread.

Main Application Form. A template Applet is provided: AppletTemplate.java in ACMJava directory. Copy this file to your project directory, and modify the run() method to call your programs. You may want to rename this AppletTemplate to another name. For example the DateTime example has renamed this file to 'DateTimeLauncher.java'. See the provided examples.The following is the basic hierarchy of the classes:
Cprogram1 Contains the logic of the original COBOL structure. All screens are defined in its parent class.Use statementCprogram1.RunProgram(ACMAppLauncher instance);to run the program from any Java applet or application.Inherits from CfrmProgram1 - to get its screen definitions
CfrmProgram1 Contains the screen definitions as extracted from original COBOL programs. Best viewed by Symantec Visual Café.

Inherits from ACMJava.awt.ACMProgramPanel .
ACMProgramPanel Inherits from on java.awt.Panel
.
Main Application Form Whether you are running your software as an Application or Applet, you need to declare the 1st screen to implement the ACMAppLauncher class.
Compiling applications using Sun JDK or Other compilers
Move the all necessary folders to the main project directory and the compiler will have access to all files without you having to change the CLASSPATH. .For example create the following file structure
C:\Corect_output\progs --> will contain your translated code. Compile your code from this directory
C:\Corect_output\progs\FDInc --> If system has generated any files in the FDInc directory - move them here
C:\Corect_output\progs\WSInc --> If system has generated any files in the WSInc directory - move them here
C:\Corect_output\progs\ACMJava -->Move / Copy ACM classes to here..
Running Programs
Setup the project directories as described in Compiling applications using Sun JDK or Other compilers , and you can start the application from C:\Corect_output\progs directory. For applets, create an HTML file with the appropriat <APPLET> tag (see examples) and place in C:\Corect_output\progs directory.
Building a new project in Symantec Visual Café
Copy the following files into your project directory and include them into your project
Trouble Shooting
If the Symantec Visual Café does not recognise the layout of the generated screens - try the followingWhen the screen Frame is inherited from anything but the java.awt.Frame class, then Symantec sometimes fails to successfully parse the screen definitions. A solution which offen works is to make the screen programs inherit directly from the java.awt.Frame to force the system to reparse, this usually makes Symantecs parser to recongise the screen layout. You can change the File to inherit from the original class AFTER Symantec Visual Cafe has recognised the screens. e.g. change the line

public class CFrmProgram1 extends ACMProgramPanel {

to

public class CFrmProgram1 extends Panel {

and save the program. This causes Symantec Visual cafe to reparse and usually recognise the screen layouts. After it has recognized the screen layouts you can change the line back to

public class CFrmProgram1 extends ACMProgramPanel {
Installing ACM Components into Symantec Visual Cafe
From top menu bar select Projects|options, Go to the directories page, add the project output directory (c:\JAVA-AP as default) to the project path.

Copy the ACMJava directory to c:\Corect_output\ directory or alternatively you will need to set the project path (CLass path) so it also will see this directory.

- From the top menus Select WINDOW|Component Library
- In the Component Library window right click the mouse and select 'Insert GROUP'.
-Change the name of the newly inserted group to ACM

- From the top menus Select INSERT|Component into library and specify the following files, and insert them into the newly created 'ACM' Group:
ACMButton.class
ACMChoice.class
ACMPanel.class
ACMLabel.class
ACMList.class
ACMTextArea.class
ACMTextField.class

- Go to component library window (tree view), right-click on the 'ACM' group and select 'Add to palette'.