Home > Store

COBOL Programmer's Notebook

Register your product to gain access to bonus material or receive a coupon.

COBOL Programmer's Notebook

  • By
  • Published May 29, 1998 by Pearson.

Book

  • Sorry, this book is no longer in print.
Not for Sale

Description

  • Copyright 1998
  • Dimensions: 7" x 9-1/4"
  • Pages: 352
  • Edition: 1st
  • Book
  • ISBN-10: 0-13-977414-9
  • ISBN-13: 978-0-13-977414-0

COBOL is making a comeback! There's a shortage of COBOL programmers to maintain millions of business-critical COBOL applications -- and to fix critical Y2K bugs. This easy-to-use tutorial/reference is perfect for programmers who want to refresh their COBOL skills, or learn COBOL for the first time.KEY TOPICS:COBOL Programmer's Notebook's unique dual-page format places code examples on the right, with annotations and explanations on the left. It's perfect for programmers who say "Show me the code and help me figure out the rest." Best-selling author Jim Keogh walks through every important aspect of COBOL programming, including working with the editor, compiler and linker; variables, constants, operators and expressions; arrays; program control; data structures; data input; I/O; indexed files, printed output and functions. There's a full chapter dedicated specifically to identifying and fixing Y2K problems.MARKET:For all programmers who want to learn COBOL, or solve problems on COBOL systems.

Sample Content

Table of Contents

1. Working with the Editor, Compiler, and Linker.
Dissecting a Simple COBOL Program. Editors. Naming Files. Compiler Errors. COBOL Areas. COBOL Organization. Identification Division. Environment Division Configuration Section. Environment Division Input-Output Section. Environment Division Input-Output Section I-O Control Paragraph. Data Division. Data Division Linkage Section. Procedure Division. Words to Avoid Using.

2. Working with Constants and Variables.
Constants and Variables. Naming Variables. Defining Variables. Assigning Values to Variables. Displaying the Value of Variables. Using a Variable as a Constant. Dealing with Alphanumeric Variables. Initializing Variables. Initializing Variables with Zeros and Spaces. Truncation. Decimal Variables. Displaying Decimal Variables. Suppressing Zeros. Limit Variables to Alphabetic Characters. Insert a Bank into Data. Currency Data. Insert Commas into the Data. Indicate Debit or Credit. Changing the Currency Symbol. Changing the Decimal Point Symbol. Replace Leading Zeros with Asterisks. Date Data. Use Blanks Instead of Zeros. Signed Numbers. Ways to Store Data. Assign Values to Many Variables.

3. Working with Data Structures.
Creating a Data Structure. Using a Data Structure. Formatting a Data Structure. A Common Mistake Using Data Structures. Nested Data Structures. RENAMES. REDEFINES. Identifying Member Variables. Creating an Array. Accessing an Array. Looping through an Array. Assigning Values to an Array from the Keyboard. Defining an Index Variable.

4. Working with Program Control.
Flow Control. PERFORM. PERFORM UNTIL. PERFORM VARYING UNTIL. GO TO. GO TO DEPENDING ON. IF and IF...ELSE Statements. Nested IF Statement. Creating a Relational Expression. GREATER THAN. LESS THAN. NOT GREATER THAN. NOT LESS THAN. GREATER THAN OR EQUAL TO. LESS THAN OR EQUAL TO. AND OR Operators. CLASS. EVALUATE.

5. Working with Operators and Expressions.
Numeric Operators. Addition. Addition Verb. Subtraction. Subtraction Verb. Multiplication. Multiplication Verb. Division. Division Verb. Precedence. Reusing an Expression in an Array. Reusing an Expression Using the PERFORM Command.

6. Working with Data Input and Screens.
ACCEPT and DISPLAY. Displaying a Menu. Reading a Selection from a Menu. Processing a Menu Selection. Handling Selection Errors. Creating a Menu Tree. Data Entry Screen. Data Display Screen.

7. Working with Other Programs.
Module Programming. Calling Another Program. Passing Data to the Called Program. Passing Data Back to the Calling Program. Returning Control Back to a Calling Program.

8. Working with Files.
What Is a File? What Is a Record? What Is a Field? Fixed Length and Delimited Files. What is an index? Defining a Logical File. Defining a Physical File. Opening and Closing a File. Creating a Sequential File? Writing a Record to a Sequential File. Reading a Record from a Sequential File. Rewriting a Record from a Sequential File. Looping Through a File. Creating a Relative File. Writing a Record to a Relative File. Reading a Record Sequentially from a Relative File. Reading a Record Relatively from a Relative File. Rewriting a Record to a Relative File. Deleting a Record from a Relative File. Creating an Indexed File. Adding Records to an Indexed File. Reading Records Using an Indexed File. Rewriting Records in an Indexed File. Deleting Records in an Indexed File. Using Alternative Keys.

9. Working with File Errors.
SELECT OPTIONAL. Sequential I-O File Status. Relative I-O File Status. Indexed I-O File Status. Trapping the File Status.

10. Working with Sorting and Merging.
Creating a Sort Definition. Sort into Another File. Changing the Order of the Sort. Upper and Lower Case Sorts. Sorting Duplicates. Sorting a File to a Procedure. Sorting a Procedure to a File. Sorting a Procedure to a Procedure. Merging Files. Changing the Order of the Merge. Upper and Lower Case Merge. Merging Duplicates. Merge a File to a Procedure.

11. Working with the Printer.
Defining a Physical Printer. Preparing to Print a Record. Printing a Record. Print a Record from a Sequential File. Printing All Records in a File. Printing Records from an Indexed File. Printing Text With Fields. Creating a Report Layout. Printing Fields in Columns. Printing Report Title. Printing Column Headings. Printing Report Trailer. Determining the End of the Page. Printing Page Numbers at Top Left of Page. Printing Page Numbers at Top Right of Page. Printing Page Numbers at Bottom Left of Page. Printing Page Numbers at Bottom Right of Page. Create Multiline Text.

12. Working to Solve the Year 2000 Problem.
What Is the Year 2000 Problem? DATE. The Fixed Window Method. The Sliding Window Method. Fixing the Day of The Week. Leap Year. Finding Dates. Hiding the Century Digits in the Existing Date. The Single Character Solution. The No Date Problem. Embedded Dates. Programmer's Checklist. General. Keywords, Constants and Variables. Expressions and Operators. Program Control. Input-Output. Year 2000 Problem.

Index.

Preface

Preface
Many readers associate COBOL (Common Business Oriented Language) with older applications that have been running successfully for decades on mainframe computers and with applications containing the Year 2000 Problem.

COBOL is at the center of the Year 2000 Problem because many applications written in COBOL fail to use the century digits. Instead, they use the year digit such as 99 rather than 1999. This works well until the year 2000 when the year becomes 00.

Does 00 represent the year 2000 or 1900? If the COBOL program subtracts dates, will 00-99 result in a -99 or will the program stop running altogether?

How long will it take a programmer to locate and fix the problem if this occurs? Remember, business and government operations might stop until the problem is fixed. Will it take an hour, a day? Or will this occur in several programs requiring a team of programmers a week or more to address the problem?

The answer is no one really knows because the computer industry has never experienced such a problem before. Every line of code in every COBOL program must be reviewed, and fixed if necessary.

This book is designed to bring novice COBOL programmers up to speed quickly using COBOL and fixing the Year 2000 Problem. The clock is ticking. There's less than 1000 days remaining.

The Picture Book Approach
COBOL, as any computer language, is complex and has many rules that must be obeyed. Learning those rules can be time-consuming, especially for readers who already know how to program in a language other than COBOL. Those readers want to jump into the language and begin writing simple code almost immediately.

Many programmers who learn COBOL as their second language have their own philosophy about learning the language. "Show me sample code and I'll figure out the rest," is a statement that summarizes their approach. And that's what I do in this book.

The picture book concept places the focus of the book on a picture of the code. Around this picture are callouts that describe each keyword and statement. The rules are presented in tables that are positioned near the picture. Furthermore, there is a picture for each variation of the topic that is discussed in the chapter.

A reader who wants to jump into COBOL can study the picture, then copy the code into a compiler and make the executable program without having to sift through pages of text. The rules can be referenced later, when the reader needs to expand this use of the routine.

This approach is not intended to circumvent a thorough presentation of the COBOL language. In fact, this book presents C++ in its completion. Instead, the picture-book approach presents material in the way programmers want to learn a new computer language.

Each example is a complete program that is unlike many computer books that show snippets of code, then expect you to know how to assemble all the other necessary pieces into a program that will compile.

Navigating This Book
I organized this book into traditional chapters. Each chapter covers a topic of COBOL in a logical progression. So, if you are not familiar with the basics of COBOL, then begin with the first chapter and continue through each chapter in progression. At the end of the last chapter you will have a good foundation in COBOL and how to begin solving the year 2000 problem.

However, these chapters can be used also for quick reference. Jump to the chapter that discusses the topic that you want to review. The topic within the chapter is presented in its entirety with a focus on examples of code.

Each chapter is further divided into two page spreads. That is, careful attention is given to the relationship between the left and right pages. The left page contains text that describes the topic that is illustrated on the right page. The right page focuses on COBOL code that contains callouts describing each facet of the code example.

The most efficient way to use a two-page spread is to first study the example on the right page. If you understand the function of each statement in the example, then you can continue and write your own program. However, if a statement or keyword is confusing, then read the callout that describes the item. Still confused? Read the text on the left page.

Careful attention is given to clarity of the code example, the right page. You will notice that the syntax of the COBOL code is shown in color. Parts of the statements that are not colored are pieces that the programmer creates.

For example, the statement ACCEPT LNAME. reads data from the keyboard and stores it in the variable LNAME.Notice ACCEPT is bold as is the period after the LNAME. They are part of the syntactic of COBOL. The word LNAME, however, is a name of a variable that can be any name that complies with the rule of COBOL.

Updates

Submit Errata

More Information

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.