Demonstrations of COBOL

Windows

You can use the Samples Browser tool to access the available samples. In the main window of Samples Browser you have:

  • The pane on the left lists the categories of samples.
  • The central pane lists the demonstration programs for each category.
  • Click on a sample in the list to preview its readme in the bottom pane.
  • Click Open sample folder to open the folder containing the files of the sample in Windows Explorer.

To access the demonstrations:

  1. Click Start > All Programs > Micro Focus Enterprise Developer > Samples > Visual COBOL Samples. This opens the Samples Browser form.
  2. Select a sample in the central pane and click Open sample folder.

    This opens the folder that contains the files of the sample. Copy the full path to the folder.

  3. To open the sample in Eclipse, start Enterprise Developer.
  4. Click File > Import.
  5. Choose General > Existing Projects into Workspace and click Next.
  6. In the Select root directory field, specify the location of the sample and press Enter.

    This loads the list of the sample projects available in the specified location.

  7. Select the samples you want from the list, check Copy projects into workspace, and click Finish.

UNIX

The demonstrations programs are contained in a .jar file that needs to be imported into your Eclipse workspace.

To access the demonstrations:

  1. Select File > Import.
  2. Choose General > Existing Projects into Workspace and click Next.
  3. Choose Select archive file and browse to /opt/microfocus/EnterpriseDeveloper/demo and double-click samples.jar.

    This opens the list of sample projects.

  4. Select the samples you want from the list and click Finish.
This loads the selected projects into your workspace.

The following samples are supplied:

Airport Demo (JVM)
Shows a Java Web application with a JVM COBOL back-end that runs on an Apache Tomcat server.
Airport Demo (Native)
Shows how to use native COBOL to handle indexed data items. The demonstration is a console application that helps calculate the distance between two airports. The airport codes are stored in the airports.dat file.
Arrays (JVM)
Demonstrates the JVM COBOL syntax for arrays.
Collections (JVM)
Demonstrates how to use the LIST and DICTIONARY collection types in JVM COBOL.
Core (JVM)
This is an introduction in programming in JVM COBOL.
DB2 ECM - Connect
Shows the syntax variants for connecting to and disconnecting from a DB2 database using Type 1 CONNECTs that DB2 LUW supports.
DB2 ECM - Dynamic
Shows how to use dynamic SQL with DB2 LUW to perform various SQL operations.
DB2 ECM - LOB Data Types
Shows how to use the LOB LOCATOR and VALUES functions to retrieve Lob data from DB2 LUW.
DB2 ECM - Select
Shows how to use the singleton SELECT and the cursor-based FETCH statements with DB2 LUW.
DB2 ECM - Whenever
Shows how to use EXEC SQL WHENEVER for error handling, and DB2(MSGAREA) to specify a COBOL variable for retrieving error messages larger than 70 bytes.
Delegate Combining (JVM)
Shows how to combine delegates using the '+' and '-' operators.
Delegates (JVM)
Shows how to use delegates in COBOL for JVM.
Enums (JVM)
Demonstrates how to use enumeration in COBOL for JVM.
Events (JVM)
Shows how to attach a method to an event and then - to detach it.
Exception Handling (JVM)
Shows methods of exception handling in COBOL for JVM.
Extension Methods (JVM)
Demonstrates how to extend methods in COBOL for JVM.
IMTK - COBOL Program Tutorial
Shows how to create a service interface from a COBOL program, and then deploy it as a service.
Indexers (JVM)
Demonstrates how to use indexers in COBOL for JVM.
Iterators (JVM)
Demonstrates how to use iterators in COBOL for JVM.
JVM COBOL to Native COBOL Interop
Demonstrate how COBOL for JVM can interoperate with native COBOL.
Local Variables (JVM)
Demonstrates how to declare local variables in COBOL for JVM.
OESQL - Getting Started
Shows how to use static SQL with OpenESQL to perform various SQL operations.
OESQL - Getting Started with JDBC (JVM)
Shows how to use OpenESQL with JDBC and how to connect to a database using either Connection Strings or Data Sources.
OESQL - Behavior
Shows how to use the OpenESQL Compiler directives to assist in migrating database applications from the mainframe for offload development.
OESQL - Catalog
Shows the information about all data types supported by the data source, a list of all tables in the data dictionary, and information about the columns in the table 'orders'.
OESQL - Connect
Shows how to use static SQL with OpenESQL to perform various SQL operations.
OESQL - Dynamic
Shows how to use dynamic SQL with OpenESQL to perform various SQL operations.
OESQL - Select
Shows how to use singleton SELECT and cursor-based FETCH statements with OpenESQL.
OESQL - Whenever
Shows how to use EXEC SQL WHENEVER for error handling, and MFSQLMESSAGETEXT to retrieve error messages larger than 70 bytes.
Operator Overloading (JVM)
Demonstrates operator overloading in COBOL for JVM.
Optional Parameters (JVM)
Shows how to define methods with optional parameters and various ways to call such methods, including the use of named parameters.
Properties (JVM)
Demonstrates how to use properties in COBOL for JVM.
SwingBook (JVM)
Demonstrates how to use Java style inner-classes (SHARING PARENT) in JVM COBOL and shows the use of Swing with JVM COBOL. Swing is part of the Java Foundation Classes which provides an API for a graphical user interface (GUI) for JVM programs. The application shows a Swing front-end to the COBOL legacy book program which accesses an indexed data file with book stock information.
PI (Java)
Demonstrates a Java program receiving information from a COBOL program via the run-time system cobcall interface.
ARRAYS (Java)
Demonstrates how to read and update a Java array from procedural COBOL via the run-time system cobcall interface.
PrimTypes (Java)
Demonstrates a COBOL program reading and updating Java primitive types via the run-time system cobcall interface.
Record (Java)
Demonstrates creating a record item which is passed to COBOL which updates and returns the record.
tictac
Demonstrates how to develop native COBOL applications.

UNIX installations have the following additional samples:

adsamp
Demonstrates how to use the Screen Section to create a character user interface.
cobolctf
Shows how to enable a COBOL program to use the Consolidated Trace Facility.
mthread
Demonstrates how a main server thread responds to client requests by starting off separate threads to handle those requests.

Windows installations also have demonstrations of mainframe subsystem support.