Download presentation
Presentation is loading. Please wait.
Published byLionel Lawson Modified over 9 years ago
1
COBOL for the 21 st Century Stern, Stern, Ley Chapter 1 INTRODUCTION TO STRUCTURED PROGRAM DESIGN IN COBOL
2
COBOL for the 21 st Century Stern, Stern, Ley COMPUTER PROGRAMMING: AN OVERVIEW
3
COBOL for the 21 st Century Stern, Stern, Ley Types of Computer Programs COBOL is one of the many languages used to write customized applications programs.
4
COBOL for the 21 st Century Stern, Stern, Ley Applications Programs Interactive vs. Batch Processing Interactive applications typically accept input data from a PC, workstation, or terminal. Batch Processing applications process large volumes of input at periodic intervals.
5
COBOL for the 21 st Century Stern, Stern, Ley Applications Programs Applications programs that are written for a specific user are called customized programs. Programs that are relatively standard are application packages that might be purchased.
6
COBOL for the 21 st Century Stern, Stern, Ley All programs executed by the computer must be in machine language. Machine Language Programs
7
COBOL for the 21 st Century Stern, Stern, Ley Symbolic Programs Symbolic Programs use English- like or symbolic instructions. –These programs must be translated or compiled into machine language. –COBOL is a symbolic programming language used for commercial applications.
8
THE APPLICATIONS PROGRAM DEVELOPMENT PROCESS
9
COBOL for the 21 st Century Stern, Stern, Ley PROGRAM DEVELOPMENT PROCESS 1. Determine Program Specifications –Program Specifications consist of the following: Record layout forms to describe the input and output Printer spacing charts for printed output Screen layouts for interactive input/output
10
COBOL for the 21 st Century Stern, Stern, Ley PROGRAM DEVELOPMENT PROCESS 2. Design the Program Using Program Planning Tools using Common Tools: –Flowcharts A block diagram providing a pictorial representation of the logic to be used in a program –Pseudocode English-like expressions to depict the logic of the program –Hierarchy Charts Charts showing relationships among sections in a program
11
COBOL for the 21 st Century Stern, Stern, Ley PROGRAM DEVELOPMENT PROCESS 3. Code and Enter the Program 4. Compile the Program –The COBOL compiler checks the source code to insure there are no rule violations. –A syntax error is a type of error that is found if a programming rule is violated.
12
COBOL for the 21 st Century Stern, Stern, Ley PROGRAM DEVELOPMENT PROCESS 5. Test the Program –Programs are tested or debugged to ensure they have no errors. –A logic error is a type of error that the programmer may find only when the program is tested with sample or test data. 6. Document the Program –Procedure manuals for users and computer operators, called documentation, is prepared for use by the operating staff for regular production.
13
COBOL for the 21 st Century Stern, Stern, Ley PROGRAM DEVELOPMENT PROCESS ************************************************ Remember, coding is undertaken only after the program requirements have been fully specified and the logic has been carefully planned. *************************************************
14
COBOL for the 21 st Century Stern, Stern, Ley DEBUGGING TECHNIQUES Desk Checking – Reviewing the program before and after keying Correcting Syntax Errors –Using the printed source list of the diagnostic messages to find and correct the errors
15
COBOL for the 21 st Century Stern, Stern, Ley DEBUGGING TECHNIQUES Program Walkthroughs –Manually stepping through the program with test data. Detecting Logic Errors by Executing the Program –Often the most difficult part of debugging. –The preparation of test data is an extremely critical aspect of debugging.
16
COBOL for the 21 st Century Stern, Stern, Ley THE NATURE OF COBOL COBOL is a Business-Oriented Language –COBOL, is one of the most widespread commercial applications languages in use today. –COBOL is an abbreviation for CO mmon B usiness O riented L anguage, COBOL is a Standard Language –COBOL is a common programming language available on most computers.
17
COBOL for the 21 st Century Stern, Stern, Ley THE NATURE OF COBOL COBOL is an English-like Language –All instructions can be coded using English words. –The rules conform to many rules for writing in English COBOL is a User-Friendly Language –Because users are able to understand the English-like instructions it is considered a user-friendly language.
18
COBOL for the 21 st Century Stern, Stern, Ley THE FUTURE OF COBOL COBOL is likely to remain an important language in the years ahead for three reasons: 1. Older, mainframe-based “legacy” systems will need to be maintained by maintenance programmers who know COBOL. 2. COBOL is still being used by many organizations for new application development. 3. It is a very efficient language.
19
COBOL for the 21 st Century Stern, Stern, Ley QUESTIONS?!
20
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 1. A program must be in _________ language to be executed or run. Solution: machine
21
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 2. Programs are typically written in a _______ language rather than in machine language because __________. Solution: symbolic; machine languages are very complex
22
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 3. Programs written in a language other than machine language must be _______ before execution can occur. Solution: translated or compiled
23
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 4. The process of converting a source program into machine language is called ___________. Solution: compilation or translation
24
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 5. The program written in a programming language such as COBOL is called the ________ program. Solution: source or applications
25
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 6. The object program is the _______. Solution: set of instructions that has been converted into machine language
26
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 7. A ______ converts a source program into a(n)_____ program. Solution: compiler or translator program: object or machine language
27
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 8. The errors that are detected during compilation denote ______; they are usually referred to as ________ errors. Solution: any violation of programming rules in the use of the symbolic programming language; syntax
28
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 9. Before executing a program with test data, the logic of the program can be checked manually using a technique called a ____________. Solution: program walkthrough
29
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 10. COBOL is an abbreviation for _________. for _________. Solution: Common Business Oriented Language
30
COBOL for the 21 st Century Stern, Stern, Ley SELF-TEST QUESTIONS 11. COBOL is a common language in the sense that ______. Solution: it can be used on many computers
31
COBOL for the 21 st Century Stern, Stern, Ley TECHNIQUES FOR IMPROVING PROGRAM DESIGN
32
COBOL for the 21 st Century Stern, Stern, Ley Structured Programming Using Modular Design for Coding Paragraphs The most important technique for improving the design of a program in any language is called structured programming. Structured Programming is a technique using logical control constructs that make programs easier to read, debug, and modify if changes are required.
33
COBOL for the 21 st Century Stern, Stern, Ley Structured Programming Using Modular Design for Coding Paragraphs Structured programming is often called GO-TO-less programming since programmatic branches do not use GO TO statements. In COBOL this means writing programs using PERFORM statements
34
COBOL for the 21 st Century Stern, Stern, Ley Structured Programming Using Modular Design for Coding Paragraphs The typical structured program is divided into paragraphs or modules, where a main module calls in other modules as needed. –Each module can be tested independently. Paragraph, routine, module are used interchangeably
35
COBOL for the 21 st Century Stern, Stern, Ley The Top-Down Approach for Coding Modules Proper design is best achieved by developing major modules before minor ones. Main routines are coded first and are followed by intermediate routines and then minor ones.
36
COBOL for the 21 st Century Stern, Stern, Ley The Top-Down Approach Coding using the top-down manner gives the primary attention to the origination of the program. Details are deferred or saved for minor modules, which are coded last.
37
COBOL for the 21 st Century Stern, Stern, Ley A BRIEF OVERVIEW OF PROGRAM PLANNING TOOLS
38
COBOL for the 21 st Century Stern, Stern, Ley RULES FOR INTERPRETING PSEUDOCODE 1. A pseudocode begins with a START and ends with a STOP. 2. All instructions are read in sequence. 3. The instructions between the: PERFORM...END-PERFORM are executed repeatedly UNTIL there are no more records to process.
39
COBOL for the 21 st Century Stern, Stern, Ley 100-MAIN MODULE 200 - WAGE ROUTINE HIERARCHY OR STRUCTURE CHART Structure charts identify WHAT each module does, and how it relates to other modules. –The following chart shows the relationships among modules in a program:
40
COBOL for the 21 st Century Stern, Stern, Ley CHAPTER SLIDES END HERE CHAPTER SUMMARY COMES NEXT
41
COBOL for the 21 st Century Stern, Stern, Ley CHAPTER SUMMARY A. The Nature of COBOL 1. It is the most widespread commercial programming language in use today. 2. COBOL is the abbreviation for Common Business Oriented Language. 3. It is an English-like language.
42
COBOL for the 21 st Century Stern, Stern, LeySUMMARY B. Program Preparation and Debugging 1.Get program specifications from the analyst or prepare them yourself. 2.Use planning tools--flowcharts, pseudocode, hierarchy charts--for program design. 3.Code the program. 4.Compile the program and fix syntax errors. 5.Test the program using debugging techniques. 6.Document the program.
43
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY C. Techniques for Improving Program Design 1. Structured Programming a. Referred to as GO-TO-less programming b. Structured programs are subdivided into modules or paragraphs. 2. Top-Down Programming a. Major modules are coded before minor ones. B. Similar to developing an outline before writing a report.
44
COBOL for the 21 st Century Stern, Stern, LeySUMMARY D. The COBOL Divisions Identification Division a. Identifies the program to the computer system. b. May provide some documentation as well. c. PROGRAM-ID is the only required entry. Environment Division –Assigns a file-name to each file used. –Specifies the device that the file will use.
45
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY Data Division a. Defines & describes all input, output & work area b. File-Section (1) Each file-name is described in an FD. (2) Each record format within every file is an 01 entry. (3) Record fields are described with a PICTURE clause that specifies the size & type. c. Working-Storage Section (1) Defines work areas (2) An end-of-file indicator is coded here.
46
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY COBOL DIVISIONS Procedure Division a. Subdivided into paragraphs or modules. b. Includes all instructions to process input and produce output. c. All instructions are executed sequence. PERFORM...UNTIL... END-PERFORM is a loop.
47
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY Procedure Division c. All instructions are executed sequence, unless there is a loop such as PERFORM UNTIL... PERFORM UNTIL... ….. ….. END-PERFORM
48
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY Procedure Division d. Main-module entries: –The following are typical entries in a main module: (1) Files are either INPUT or OUTPUT and activated in an OPEN statement. (2) A PERFORM... …. END-PERFORM is a loop that is executed until there are no more records.
49
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY Main-module entries (continued): (3)Within the PERFORM we often code a READ... AT END... NOT AT END… END-READ. (4) A CLOSE statement deactivates all files. (5) STOP RUN ends processing.
50
COBOL for the 21 st Century Stern, Stern, Ley SUMMARY e. Calculation or processing paragraphs (1) These paragraphs are executed when a statement in the main module specifies a PERFORM paragraph name. (2) For example, logic for processing an input record may be contained in one or more paragraphs.
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.