Skip to content

RocketSoftwareCOBOLandMainframe/Book-Sample

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

COBOL Book Sample

This sample is a native console application that demonstrates a simple command line application wrapping a legacy program which can maintain a book repository using conventional COBOL file IO.

This sample is targeted towards development and debugging in Visual Studio Code. This can be run on both Windows or Linux locally or remotely using Microsoft's remote development extensions for vscode.

📄 Structure

The sample is structured as follows:

  • .editorconfig - Configuration file containing source formatting options.
  • bld.bat - Windows build script for building the sample.
  • Makefile - Linux makefile for building the sample.
  • directives.mf - Contains COBOL compiler directives required for building the sample.
  • src/book.cbl - The business logic for the book repository.
  • src/cli.cbl - Entry program that accepts a command line and calls book.
  • cpy/book-rec.cpy - Copybook shared between programs.
  • obj/ - Directory where object and debug files get written.
  • bin/ - Directory where the application binary is written to.
  • .vscode/tasks.json - Configuration for building the sample within vscode.
  • .vscode/launch.json - Configuration for running and debugging the sample within vscode.
  • add-books.bat - Windows batch script that adds sample data to the book repository.
  • add-books.sh - Unix shell script that adds sample data to the book repository.

⚡ Running the Sample

Visual Studio Code

  1. Open the folder in Visual Studio Code.
  2. Press F5, or Run -> Start Debugging to run the application.
  3. You can debug the code by inserting a breakpoint and running the application.
  4. To add a set of sample books, open a Rocket® Visual COBOL® terminal and run .\add-books.bat (Windows) or ./add-books.sh (Linux).

Command line (Windows)

  1. Open a Visual COBOL or Enterprise Developer prompt.
  2. Navigate to the root directory for this sample.
  3. Execute bld.bat to build the sample.
  4. Execute bin\book.exe to run the sample.
  5. Execute .\add-books.bat to add some sample data to the book repository.

Command line (Linux)

  1. Setup a devhub environment. Typically this would be done as follows:

    . /opt/microfocus/VisualCOBOL/bin/cobsetenv
  2. Navigate to the root directory for this sample.

  3. Execute make to build the sample.

  4. Execute bin/book to run the sample.

  5. Execute ./add-books.sh to add some sample data to the book repository.

📋 Exercises

Below are some exercises that you are welcome to follow that can help you become more familiar with the Rocket® Visual COBOL® tooling and language.

  • Fix a bug that prevents the -f option from working correctly.
  • Display the genre of the books when executing the list command.
  • Refactor shared data items and constants between cli and book (e.g. ws-function, and ws-file-status) to a copybook that is included by both programs.
  • Refactor the sample to use local variables and parameterised sections.

⚖️ License

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.

About

Book sample application written in Rocket® Visual COBOL®.

Topics

Resources

Stars

Watchers

Forks