COBOL Programming Exercises 


These pages contain -

  • Simple COBOL programming exercises with sample answers.
  • Programming exam specifications with sample answers.
  • Programming project specifications with no answers provided.

Where required, test data files are also supplied.

The simple programming exercises are normally given as lab exercises. Good students should be able to do these in little more than one or two hours.

The specifications for the programming exams are actually old exam papers. Good students should be able to produce a working program in four to six hours.

Unlike the exercises described above, the programming project specifications require programs that can not be written in one sitting. For each project, an estimate of the number of hours it should take to complete the project has been given.

In our course we normally allow students about one week for every 5 hours of the completion estimate. In other words if we estimate that a programming project will take 20 hours to complete, we allow the students 4 weeks to do it.

Copyright Notice

These COBOL programming exercises, program specifications, and sample programs are the copyright property of Michael Coughlan. You have permission to use these materials for your own personal use but you may not reproduce them in any published work without written permission from the author.

Simple Programming Exercises

Programming Exam Specifications

Student Fees Report

Write a program to apply a transaction file of student payments to a Student Master File and then produce a report showing those students whose fees are partially or wholly outstanding.
(Indexed files, Print files, READ..NEXT RECORD, START, WRITE, REWRITE, IF,

Aromamora Summary Sales

A program is required to produce a summary sales report from an unsorted sequential file containing the details of sales of essential and base oils to Aromamora customers.
(SORT with Input Procedure and Output Procedure, Print Files, Sequential Files, COMPUTE)


FlyByNight Summary File

A program is required which will read the tourist bookings master filee to produce a summary file sequenced upon ascending Destination-Name.
(Pre-Filled Tables, Sequential Files, SORT with Input Procedure, SEARCH, INSPECT)


A program is required which will apply a file of sorted, validated transactions to the Oil-Stock-File and then produce a report based on the contents of both the Oil-Details-File and the Oil-Stock-File. The report writer must be used to produce the report which must be printed sequenced on ascending Oil-Name.
(Indexed files, Relative Files, Sequential Files, Report Writer, EVALUATE, COMPUTE, READ, WRITE, REWRITE, START)


A program is required to produce a Purchase Requirements Report from the Publisher, Book and Purchase Requirements files. The report should be sequenced on ascending Publisher Name and should only detail the purchase requirements for the semester under scrutiny.
(Indexed files, Report Writer, Report Section, INITIATE, GENERATE, TERMINATE, READ, WRITE, REWRITE, START)

ACME Stock Reorder

A program is required which will process the Stock and Manufacturer files to create an Orders file containing ordering information for all the parts that need to be re-ordered (i.e. where the QtyInStock is less than the ReorderLevel). For EU countries only, the COSTOFITEMS and POSTAGE fields of each Orders file record must be calculated. The Postage rate is obtained by calling an existing program.
(Indexed files, Relative Files, SubPrograms, CALL..USING, READ, WRITE, REWRITE, Condition Names (level 88s), EVALUATE, UNSTRING, MULTIPLY..ON SIZE ERROR)

File Conversion A program is required to convert the unsorted Client-Names file of free-format, variable length, records into a sorted file of fixed length records. The sorted file must be sorted into ascending Client-Name within ascending County-Name. In addition to converting and sorting the file, the program must ensure that the county name is valid and must convert it to a county number.
(Sequential files, SORT with Input Procedure, Pre-Defined Table of values, STRING, UNSTRING, INSPECT, SEARCH ALL )
USSR Ship Report

A program is required to produce a report detailing the major vessels (Vessels of tonnage 3,500 or greater and all submarines) in each of oceans and major seas of the world.
(Sequential files, SORT with Input Procedure, Print Files, Pre-defined tables, Condition Names)

Science Fiction by mail A program is required to apply the Orders file (containing customer orders) to the Book Stock file and to produce the Processed Orders file.
(CALL, subprograms, Sequential files, Indexed files, READ, WRITE, REWRITE, COMPUTE, UNSTRING)

A program is required which will produce a file, sorted on ascending email domain, from the unsorted GraduateInfo file.
(SORT with Input Procedure and Output Procedure, Sequential Files, Pre-Defined Tables, Run time filled tables, SEARCH)


Each time a book is borrowed, the Pascal Memorial Library pays the author a small sum of money as royalty.  Royalties are paid to authors through their agents. A report is required which processes the Authors file and the Books File to produce a report which shows the amount to be sent to each agent, shows the breakdown of the agent payment into author payments, and shows the breakdown of each author payment into royalty payments per book.


The manager of Metropolis Videos has asked you to write a program to produce a report showing the top three Video Suppliers (by total store video earnings) and for each of the top three the most popular video title (by average earnings) must be shown.
(Indexed Files, Relative Files, Print Files, READ, START, Tables, DIVIDE)

FolioBestSellersRpt The Folio Society is a Book Club that sells fine books to customers all over the world. A program is required to print a list of the ten best selling books (by copies sold) in the Book Club.
(Sequential Files, Print Files, SORT with Input Procedure and Output Procedure, Tables)
DueSubsRpt NetNews is a company which runs an NNTP server carrying the complete USENET news feed with over 15,000 news groups. Access to this server is available to internet users all over the world. Users of the system pay a subscription fee for access. The fee may be paid monthly ($20), half-yearly ($100) or yearly ($180). A program is required to produce a report showing the subscriptions which are now due. The report will be based on the Due Subscriptions file.
(Sequential Files, Print Files, SORT with Input Procedure, Tables, SEARCH ALL)

Programming Project Specifications

Back to Student Resources To Student Resources Please fill out our evaluation form Evaluation Form Search the CSIS Web Site Search CSIS Web Site
Selectable Site Contents

Last updated : June 2002
e-mail :