COBOL User Groups Logo COBOL COBOL Programming
Home to COBOL | Discussions Forums | Join COBUG | Change COBUG Profile | Donations | Advertise with us | Contact us | About us | Site Map | Search Website |
 COBOL Training:  4-day COBOL Training Course

COBOL Jobs
 >  Job Listing
 >  Job Seekers
 >  Employers
 >  Interview Questions
 >  Job Resources

COBOL Resources
 >  Blogs
 >  COBOL Books
 >  Computer Timeshare
 >  COBOL Examples
 >  Forums
 >  Knowledge Bases
 >  Magazines
 >  Manuals
 >  Portals
 >  Support
 >  Syntax/Commands
 >  COBOL Training
 >  COBOL Tutorials
 >  User Groups
 >  White Papers

COBOL Software
 >  Change Management
 >  COBOL Compilers
 >  Data Access
 >  Database
 >  Documentation
 >  Editors
 >  File Conversion
 >  Free COBOL Software
 >  GUI
 >  Legacy Migration
 >  Legacy Modernization
 >  Mainframe Security
 >  Report Generators
 >  COBOL Sort
 >  Terminal Emulators
 >  COBOL Test
 >  COBOL Tools
 >  Trans. Processing

COBOL Information
 >  Events
 >  News Articles
 >  Newsletters
 >  Product News
 >  COBOL Standards

COBOL Email List Rental
You can reach a highly targeted, qualified, opt-in audience of COBOL users by renting the COBUG email list. Contact us today advertise@cobug.com for details about our email list and rental rates.

Website Advertisement
Advertise on the COBUG website and reach tens of thousands of COBOL users. Increase your sales leads. Contact COBUG at advertise@cobug.com for advertising rates.

Support COBUG
COBOL Donation
 

COBOL Examples / Sample COBOL Programs

 

COBOL Examples, sample COBOL programs and COBOL source code examples compiled with Micro Focus, NetCOBOL, Fujitsu, IBM COBOL, iSeries, Liant RM, and AcuCOBOL and CA-Realia COBOL compilers.

The samples cover client/server, database, Java, JCL, COBOL .Net, XML, object oriented, transaction processing, and other COBOL programming techniques:
 
COBOL Community Contributions
COBOL Code Examples by Source
COBOL Java Code Examples
COBOL JCL Examples
COBOL .Net Code Examples
COBOL Object Oriented Code Examples
COBOL Syntax & Commands
COBOL XML Code Examples
Client/Server Code Examples
Database Code Examples
File Handling Code Examples
General COBOL Code Examples
Graphical User Interfaces Code Examples
iSeries (AS400) COBOL Code Examples
COBOL Object Oriented Code Examples
Transaction Processing Code Examples
 

COBOL Community Contributions

 > COBOL Syntax Accessing mySQL Database
A solution for accessing mySQL database using traditional COBOL commands.

 > Read From COM Port
Here is a program that is used for reading from a COM port. It has been used with a few different compilers so hopefully it will work for you without many amendments.

 > Future Date Calculation
This is a MicroFocus COBOL program example which calculates a date in the future, based on business days, not on calendar days.

 

[ Go to Top of Page ]
 

COBOL Examples by Source

 > Micro Focus Acucobol Program Samples
This is a collection of COBOL program examples that help illustrate general programming techniques integral to developing with Acucobol.

 > AS/400, iSeries COBOL Programming Tips & Techniques
These are iSeries (AS/400) COBOL programming tips and techniques covering APIs, CGI COBOL, XML COBOL, and other COBOL code examples.

 > Bristol Community College, Priscilla Grocer
These sample programs cover COBOL language elements, two and three files matching, random and sequential files, bubble sort, relative files, screen processing, variable length records, working with dates, object oriented programs, and data structures.

 > C# Corner
Here you will find various COBOL .NET in C# related source code examples.

 > Capitalware
Several WebSphere MQ COBOL code samples and COBOL code samples for the NetCOBOL / Fujitsu COBOL compiler, including PowerCOBOL code samples, are provided.

 > COBOL Bible
These are notes that have been obtained from various sources on how to write the syntax of COBOL programs.

 > COBOL Center
Here are examples of date routines, free-form number routine, loan amount/payment, convert numeric dollars, edit and reverse name, and table sort.

 > COBOL8M
Here are examples of integrating operating system functions into MicroFocus Net Express.

 > Davar Web Site
Here are examples of how to output the current date and time as DB2 timestamp to a file and how to edit input of an unsigned integer number.

 > Free Programming Resources
Here are links to free COBOL resources and COBOL code.

 > GT Software / NetCOBOL
This is a collection of sample programs using Fujitsu COBOL, NetCOBOL for Windows, and PowerCOBOL.

 > GUI Innovations
This example demonstrates TCP/IP server for the HPe3000 server. It contains a sample TCP/IP client, written in Visual Basic, and a sample TCP/IP server for the HPe3000 server written in COBOL.

 > HostBridge Technology
Here is a collection of examples that have been developed to make it easy for a COBOL CICS program to send an outbound TCP/IP request (and optionally wait for a response). These programs are available in both Assembler and COBOL and can be used without HostBridge.

 > IT Doctors
This is a sample of VS COBOL code.

 > KernerlThread
This sample was developed with the Open COBOL compiler. The Towers of Hanoi as a COBOL program.

 > Lawrence Truett
This site contains examples that demonstrate various COBOL syntax.

 > Murach
Here are downloads of the COBOL code of the programs in the Murach's Structured COBOL book.

 > Norcom
This Norcom sample program will display and handle user interaction with any type of GUI ScreenIO panel (including a property sheet or a wizard), regardless of the type or number of controls it contains.

 > Penn State Lehigh Valley
This program in COBOL sample is for beginner's.

 > SimoTime
This is a suite of samples that were written using the IBM VS COBOL II or Micro Focus Net Express COBOL, covering Java, bit manipulation, data access, and more.

 > Softech Solutions
This is an example of a COBOL II bubble sort.

 > Sun Valley Systems
Here are samples that demonstrate date routines, free-form extraction, loan amount calculation, money to text, validate/reverse name, and table sort.

 > Sybase
Here are COBOL SQL sample programs that demonstrate features such as how to code a batch of INSERT requests, how to code a DB2 input pipe, how to code a transfer request, how to code keyword input, how to embed SQL in COBOL programs, and more.

 > University of Limerick
This is an accumulation of examples for beginner's that demonstrate selection and iteration, sequential files, sorting and merging, direct access files, calling sub-programs, string handling, the COBOL report writer, and COBOL tables.

 > University of Michigan - Dearborn
This sample COBOL code for beginners presents a hello word program and accept_num program.

 > VyomWorld.com
General COBOL programs are provided that include COBOL scripts and code snippets.

 > zingCOBOL
This sample COBOL code is for beginner's.

 

[ Go to Top of Page ]
 

Client/Server Code Examples

 > CGI Examples Using iSeries COBOL
Here are a couple of sample COBOL CGI programs for the iSeries COBOL community. This library offers a COBOL interface to the CGI service program. A COBOL CGI tutorial is included.

 > MQSeries for MVS/ESA - Message Handler Sample
This example provides C and COBOL sample code for a message handling application for WebSphere MQ for z/OS.

 > TCP/IP Server
This is a COBOL sample Client/Server application to show the basic mechanics of TCP/IP protocol and the HPe3000. It contains a TCP/IP client, written in Visual Basic, and a sample TCP/IP server for the HPe3000 server written in COBOL.

 > TCP/IP Sockets, MVS - Datagram Socket COBOL Server Program
Here you will find basic TCP/IP socket programming information for MVS COBOL program developers who plan to use the socket programming interfaces of IBM TCP/IP for MVS.

 > Web Services from NetCOBOL
This demonstrates the use of a Web Service with the client developed using NETCOBOL for .NET.

 > WebSphere MQ COBOL Code Samples
The sample COBOL programs demonstrate how to send a request message, wait for a reply message, process a request message, and send a reply message. Samples are included from the MQSeries toolkit.

 

[ Go to Top of Page ]
 

Database Code Examples

 > ADO.NET/ COBOL/Stored Procedures
This COBOL sample provides an example of how to access a stored procedure to perform a specific task such as create a new table, retrieve data from one or more tables, update one or more tables or perform many other tasks.

 > COBOL Procedures
COBOL procedures are to be written in a similar manner as COBOL subprograms. This COBOL example describes handling parameters in a COBOL procedure and exiting a COBOL procedure.

 > DB2 Explain Command
How to Explain a DB2 SQL Command for a single table.

 > DB2/SQL/COBOL Samples
Several IBM COBOL and MicroFocus COBOL samples that include COBOL DB2 API sample programs with no embedded SQL, COBOL DB2 API embedded SQL sample programs, and COBOL SQL sample programs with no DB2 APIs.

 > DB2/SQL/COBOL for AS/400 Example
The SQL COBOL example demonstrates how to code SQL statements using iSeries (AS400) COBOL.

 > Sybase COBOL SQL Samples
The COBOL sample programs demonstrate features such as how to code a batch of INSERT requests, how to code a DB2 Input Pipe, how to code a transfer request, how to code keyword input, how to embed SQL in COBOL programs, and more.

 

[ Go to Top of Page ]
 

File Handling Code Examples

 > COBOL Coding for Files Example
The general format of COBOL input-output coding is shown.

 > COBOL File Status Code with Text Information
This COBOL file status example will show how to convert the two byte file status code that may contain binary data to a four byte numeric value that may be displayed.

 > COBOL File System and Programming
Here are COBOL file system and programming source code examples.

 > COBOL Record Format Examples
COBOL sample code describing record description, determining fixed-length record size, determining fixed-length record size for files with multiple record descriptions, creating variable-length records with the DEPENDING ON Phrase, creating variable-length records with the RECORD VARYING Phrase, and creating variable-length records and using the OCCURS Clause with the DEPENDING ON Phrase.

 > Comma delimited, QSAM, and COBOL VSAM Files
Here are several COBOL data access sample programs that cover handling comma delimited, QSAM, and COBOL VSAM files.

 > Displaying Record-Lock Messages
This iSeries COBOL subroutine displays record-lock messages.

 > EBCDIC to ASCII
This COBOL program converts EBCDIC-sequential to ASCII-indexed.

 > Line Sequential File Example
This COBOL sample demonstrates line sequential file handling.

 > Read an IFS File
This is an iSeries Cobol example showing how to read lines from an IFS file.

 > COBOL VSAM and QSAM COBOL File Status Keys/Error Codes
This is a COBOL program example of how to determine the COBOL VSAM and QSAM COBOL file status keys/error codes in an IBM Enterprise COBOL environment.

 > VSAM File Access for COBOL
If you are interested in writing COBOL programs that utilize VSAM datasets, I hope this documentation has provided you with the information you need to install my routine and get started writing programs on your own.

 

[ Go to Top of Page ]
 

General COBOL Code Examples

 > Micro Focus Acucobol Sample Programs
This is a collection of sample programs that help illustrate certain concepts integral to developing with ACUCOBOL-85 and ACUCOBOL-GT.

 > Bubble Sort in COBOL
This is an example of a COBOL II bubble sort.

 > COBOL Example Programs
This is a list of COBOL examples that demonstrate date routines, get free-form number routine, table sorts, and more.

 > COBOL Example Programs
These sample programs illustrate date routines, free-form extraction, loan amount calculation, money to text, validate/reverse name, and table sort.

 > COBOL Example for Beginner's
This example is for beginner's.

 > COBOL Programs for Beginner's
Here is a large number of examples for beginner's.

 > COBOL Programs for Beginner's
Here are sample COBOL programs that include hello word, accept number, and sales file processing.

 > COBOL Programs for Beginner's
Here is collection of sample code for beginner's.

 > COBOL Reference, Syntax, and Examples
The COBOL samples here cover COBOL syntax for current-date function, evaluate statement, if and end-iIf statement, initialize statement, in-line perform, inspect statement, and reference modification

 > COBOL Sample Programs
These sample programs cover COBOL language elements, two and three files matching, random and sequential files, bubble sort, relative files, screen processing, variable length records, working with dates, object oriented programs, and data structures.

 > Dateout COBOL II Procedure
This program outputs current date and time as DB2 timestamp to a file.

 > Editint COBOL Subroutine
This subroutine determines validity of input unsigned integer number and edits it in its place.

 > How to Write the Syntax of COBOL Programs
These are notes that have been obtained from various sources on how to write the syntax of COBOL programs.

 > HP COBOL II/XL Program Example
This example contains a complete COBOL program listing from the HP COBOL II/XL compiler.

 > General COBOL Sample Programs
This is a collection of COBOL examples that show sequential file program, balance sheet printing, calculating yearly depreciation, computing interest, and more

 > Micro Focus Sample Programs
Here are examples of integrating operating system functions into Micro Focus Net Express.

 > Structured COBOL
This is the source code from Murach's Structured COBOL book.

 > Towers of Hanoi
This program was developed with the Open COBOL compiler.

 > VS COBOL Code
This is a typical example of the type of COBOL programs in many mature installations.

 

[ Go to Top of Page ]
 

Graphical User Interfaces Code Examples

 > Graphical User Interface (GUI) Samples.
The Micro Focus Acucobol sample programs demonstrate the products GUI features.

 > GUI ScreenIO
This Norcom COBOL sample will display and handle user interaction with any type of GUI ScreenIO panel (including a property sheet or a wizard), regardless of the type or number of controls it contains.

 

[ Go to Top of Page ]
 

COBOL iSeries (AS400) Code Examples

 

[ Go to Top of Page ]
 

COBOL Java Code Examples

 > Using Java and COBOL Together
It introduces the different ways that Java and COBOL applications can call each other.

 

[ Go to Top of Page ]
 

COBOL JCL Examples

 > Job Control Language (JCL) - Wikipedia
This shows an example of COBOL JCL statements necessary to copy an existing dataset to a new dataset.

 > Job Control Language (JCL) Standard for MVS & JES2 - University of California, Santa Barbara
There are various COBOL JCL examples and illustrations.

 > Just Enough JCL Tutorial to be dangerous
The purpose of this booklet is to get you started with COBOL JCL when there is no other way - you don't have time to go to a class, don't want to buy a complete book on it and try to find the things you need to know.

 > MVS JCL - Louisiana Tech University
This is an example of print hello world on job output

 > OS/390 and z/OS JCL - Mike Murach & Associates
It contains the COBOL JCL coding segments and job streams that are used as examples in the book.

 > Sample COBOL JCL - Mainframes.com
Here are various COBOL JCL samples.

 > Sample COBOL JCL Coding - IBM MAINFRAMES.com
It includes sample COBOL JCL codings that are useful for students and training centers.

 > The COBOL JCL Connection, Managing JCL, Procedures and PDS's - SimoTime Enterprises
The JCL Connection provides a suite of sample programs and documentation that use the mainframe Job Control Language (JCL).

 

[ Go to Top of Page ]
 

COBOL .Net Code Examples

 > COBOL and .Net Interoperability
This Micro Focus COBOL .NET example illustrates how you can use Microsoft's .NET Framework to develop applications that use COBOL business logic.

 > COBOL and .Net Samples
Here you will find various Fujitsu COBOL .NET source code samples using NetCOBOL for .NET.

 

[ Go to Top of Page ]
 

COBOL Object Oriented Code Examples

 > Object-Oriented COBOL Programming
Shapes OO Example: COBOL Code.

 > Object Orientation for COBOL
This OO COBOL sample can be registered as a COM server and called by client programs written in COBOL or other languages, including ASP.NET or VB.NET or C#.

 

[ Go to Top of Page ]
 

Transaction Processing Code Examples

 > CICS COBOL Program Examples
This references the source code to 12 complete COBOL CICS programs in the Murach's CICS for the COBOL Programmer.

 > CICS COBOL Sample Socket Programs
This is a collection of CICS COBOL sample programs that have been developed to make it easy for a CICS COBOL program to send an outbound TCP/IP request (and optionally wait a response).

 > CICS COBOL TCP/IP Socket Interface
Here you will find a description of the TCP/IP for MVS: Socket Interface for CICS.

 > COM Transaction Integrator (COMTI)
The COBOL CICS sample programs are for application integration using COMTI (COM Transaction Integrator) for CICS and IMS included with the Host Integration Server 2000 Software Development Kit.

 > Sample CICS COBOL Program
This CICS COBOL program sample accepts input from terminal, prefix string 'OUTPUT : ' to the input data, and send it back to the modified data to terminal.

 

[ Go to Top of Page ]
 

COBOL XML Code Examples

 
 
[ Go to Top of Page ]
Visual COBOL Ad
COBOL Database Tool - Faircom Database Technology Ad
COBOL Application Modernization - Fresche Legacy Ad
COBOL Application Modernization - EvolveWare Ad
NetCOBOL - GT Software Ad
COBOL Legacy Mainframe Migration - Transoft Ad
COBOL Interpreter - McKinney Ad








COBOL Job Seekers
COBOL Jobs Looking for a COBOL job? Submit your resume here and have it viewed by employers and recruiters hiring for COBOL positions.

Employers & Recruiters
Post COBOL Jobs Do you need to fill a COBOL position? Post your COBOL jobs here and find the most qualified COBOL candidates to fill your COBOL position.

Call for Articles
COBOL Newsletters Articles are being sought for the COBUG newsletters.
Will you help us in our efforts to provide newsletters for the COBOL community at large? Contribute to the COBUG newsletters! Answer this call for COBOL and related legacy articles.

Local COBOL User Groups
COBOL User Group Check out the list of local COBOL user groups from around the world and join a user group near you.


Call for User Group Leaders!
COBOL User Groups Get Involved! We are looking for user group leaders to help organize and coordinate a local COBOL user group.

Join COBUG!
COBOL User Groups Become a part of COBUG and the global COBOL community today. Join Now ...


COBOL Forums
COBOL Forum Try our COBOL forums for help!
Let the COBUG members help you. Post your issues!


COBOL (c) Information Computing Services. All Rights Reserved. COBOL