This sample is a native graphical console application that enables you to view the geographical location and the distance between airports. It shows how to use native COBOL to handle indexed data files. The information about the airport codes is stored in the airports.dat file.
This sample also demonstrates using the Rocket Unit Testing Framework for unit testing the Airport sample.
The sample is structured into three projects:
src/aircode- The program containing the business logic.src/airport- The program containing the UI logic.test/AirportTests- Unit tests for the aircode program.
The files include:
src/airport/airports.dat- Data file with all airport records.src/airport/Application.config- Config file that defines the location of the .dat file to be used.
- Open a Developer Command Prompt for VS 2022.
- Execute
msbuild Airport.sln /p:Configuration=Debug /p:Platform=x64to build the sample. - Open a Visual COBOL or Enterprise Developer Command Prompt (64-bit).
- Execute
cd bin\x64\Debugto navigate to the directory containing the built binaries. - Execute
.\airport.exeto run the sample. - Execute
mfurun AirportTests.mfuto run all the tests.
- Open Airport.sln.
- Build the solution and start debugging.
- Follow the instructions on the console. To see the available airport codes view the airports.dat file by opening it using the Data File Editor.
- Open the "Unit Testing" tool window and click "Run All" to run all the unit tests.
- To run the unit tests with code coverage, first edit the project properties of aircode and AirportTests, select the COBOL tab and ensure "Enable code coverage" is checked. Then click "Run with Code Coverage" in the "Unit Testing" tool window.
- Open Enterpise Developer for Eclipse.
- From the Project Explorer select
Import,General,Existing projects into workspace. Navigate to where you cloned the projects to,Select all,Finish(Do not copy the projects into the workspace). - Build the project.
- Right-click the Airport project,
Run As,Run configurations. ChooseCOBOL Aplication, create a new launch configuration and open it. - Navigate to the
Environmenttab and add:dd_airportsand../airports.datas the variable and value. - You can now run and debug using your new launch configuration.
- Right-click the AirportTests project,
Run As, 'Run configurations'. ChooseCOBOL Unit test, create a new launch configuration and open it. - Navigate to the
Environmenttab and add:dd_airportsand../../../src/airport/airports.datas the variable and value. - You can now run all the unit tests using your new launch configuration.
- For Airport and Aircode right-click on each of the projects and select
Properties -> COBOLsetEnable code coverageto true. - Open the launch configuration you made to run and debug the program, navigate to the 'Dynamic analysis' Tab. Check 'Enable code coverage'
- Build and run the sample.
- To view code coverage results navigate to the
Code coveragetab of the bottom plain of the IDE. Selectimport, and select the .tcz file within the coverage folder of the project folder structure. - You should now be able to see and interact with coverage data.
Copyright 2023-2025 Rocket Software, Inc. or its affiliates. This software may be used, modified, and distributed (provided this notice is included without modification) solely for internal demonstration purposes with other Rocket® products, and is otherwise subject to the EULA at https://www.rocketsoftware.com/company/trust/agreements.
THIS SOFTWARE IS PROVIDED "AS IS" AND ALL IMPLIED WARRANTIES, INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, SHALL NOT APPLY. TO THE EXTENT PERMITTED BY LAW, IN NO EVENT WILL ROCKET SOFTWARE HAVE ANY LIABILITY WHATSOEVER IN CONNECTION WITH THIS SOFTWARE.