Chapter 4 The Identification, Environment, and Data Divisions.

Slides:



Advertisements
Similar presentations
2-1 Chapter 2.  Coding Requirements of IDENTIFICATION DIVISION  Sections of ENVIRONMENT DIVISION  Assigning Files to Devices in ENVIRONMENT DIVISION.
Advertisements

Methodology for Program Development Tuition billing program –Specs –File descriptions –Report layout –Processing requirement $200/cr $25 union dues if.
Figure 3.4The Building Blocks of Structured Programming A B (a) Sequence BA CONDITION? (b) Selection : ENTRYEXIT A B N (d) Case CONDITION? A (c) Iteration.
3-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emertius)
- Kav Shrestha.  Introduction  History  Features  COBOL Usage  Characteristics  Structure of COBOL Programs  COBOL Divisions  Data Items  Variable.
The IDENTIFICATION and ENVIRONMENT DIVISIONS Chapter 2.
Lesson 5 Packed-Decimal or Computational-3 (COMP-3) MOVE TO WS-AMOUNT ====> 4 bytes instead of 7. Significant storage saving. On the.
COBOL COmmon Business Oriented Language  Work began in 1959 and has never stopped.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
VSAM KSDS and COBOL Department of Computer Science Northern Illinois University August 2005 Some of the illustrations are from VSAM: Access Method Services.
Advanced Sequential Files 1.. Single Record Type Files  In a file which contains only one record type (the kind we have examined so far) the record structure.
Chapter 15 Relative Files.  File organization that converts key field to actual disk address to find location of record No need to look up disk address.
Structured COBOL Programming, Stern & Stern, 9th edition
Programming in COBOL-85 For IBM Mainframe System 390
COBOL Basics 1. COBOL coding rules  Almost all COBOL compilers treat a line of COBOL code as if it contained two distinct areas. These are known as;
2-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Chapter To familiarize you with  Why COBOL is a popular business-oriented language.  Programming practices and techniques  History of COBOL.
Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout.
3-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emertius)
Introduction to COBOL. COBOL  COBOL is an acronym which stands for Common Business Oriented Language.  The name indicates the target area of COBOL applications.
History COBOL (Common Business Oriented Language) was one of the earliest high-level programming languages. COBOL was first proposed in 1959 by the Conference.
Chapter 5 Using Data and COBOL Operators. Initializing Variables When you define a variable in WORKING- STORAGE, you also can assign it an initial value.
Programming Examples to Accompany Structure Topic Please use speaker notes for additional information!
COBOL Cobol is one of the most robust language in the software field, so far Cobol turned 50, in 2009 Cobol has stood the test of time Common Business.
Programming in COBOL-85 For IBM Mainframe System 390 Jyothi Sridhar Kini E&R, Infosys Mail-id: Phone:
Agenda Reporting Work on Assignment 4! Printing on power systems.
1 Chapter 14 - Sorting System Concepts –Sort key Major Key (Primary) Minor Key (Secondary) –Sort sequence Ascending - Low to high Descending – High to.
The DATA DIVISION Chapter 3. COBOL Data Organization Field - group of characters forming a meaningful unit or basic fact –Characters in a name or digits.
3-1 Chapter 3. To familiarize you with  Ways in which data is organized in COBOL  Rules for forming data-names  Defining input and output files in.
3-1 The DATA DIVISION Chapter Chapter Objectives To familiarize you with Systems design considerations Ways in which data is organized Rules for.
UNIT 1 UNIT 1 Stephen S. Linkin Houston Community College System 8/28/ Copywrite © Houston Community College System 2007 Graphics Courtesy of IBM.
1 Interactive vs Batch Programs Cobol suited for developing both types of programs Interactive programs Accept input data from keyboard Input data processed.
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
COBOL Basics 2. H E N N E S S Y R M L M F Group Items/Records StudentDetails WORKING-STORAGE SECTION. 01StudentDetailsPIC X(26).
Chapter 7 File I/O 1. File, Record & Field 2 The file is just a chunk of disk space set aside for data and given a name. The computer has no idea what.
1 Chapter – 12 Table Lookups Table Codes –Expanded Values –Types of Codes Numeric Alphabetic Alphanumeric.
COBOL (Common Business Oriented Language). 1. Introduction to COBOL History of COBOL Coding rules Program Structure Data names and Identifiers Figurative.
CPSC3111/CISM3111 COBOL Structured COBOL Programming Text: murach’s structured COBOL Authors: Murach, Prince, Menendez.
Explanation of SAMPLEIF (if88in1.cbl or if88in1.html) Please use speaker notes for additional information!
1 The Data Division. 2 Main Two Sections File Section –Used to define files and record formats –Field names within records Working Storage Section –All.
Figure 9.9Duplicate Data Names 01 STUDENT-RECORD. 05 STUDENT-NAMEPIC X(20). 05 SOCIAL-SECURITY-NUMPIC 9(9). 05 STUDENT-ADDRESS. 10 STREETPIC X(15). 10.
1 IDENTIFICATION and ENVIRONMENT DIVISIONS. 2 Objectives Basic Structure of COBOL Programs General Coding and Formatting Rules Identification and the.
Structured Programming
Any Questions!. Test Coming Up! Agenda Printing with Externally Described Printer Files Arrays.
Structured COBOL Programming, Stern & Stern, 9th Edition CHAPTER 2 Cobol Language Fundamentals.
1 Chapter 5 – The Procedure Division File handling statements –OPEN statement Initiates processing for a file Input Output Each file opened must have been.
Any Questions? Agenda Level 77 Initialize Display & Accept Arithmetic Verbs Compute statement String/Unstring Inspect.
2-1 COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
1.  Introduction  The Benefits of the Report Writer Module ◦ For Detail and Summary Printing ◦ For Control Break Processing ◦ For Printing Headings.
IBM-Mainframes COBOL Class-1. Background and History  COBOL is an acronym for: Common Business Oriented Language  COBOL was developed in 1959 by the.
Module 1 1. Cobol Hierarchy Revised on COBOL Hierarchy There are four DIVISIONS:- IDENTIFICATION DIVISION. ENVIRONMENT DIVISION. DATA DIVISION.
Lecture 21 ENVIRONMENT DIVISION  defines files external to the program and devices.  contains two sections: 1.CONFIGURATION SECTION.  identifies computers.
Any Questions? Week 1 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Analysis of SAMPLE1.CBL Please check speaker notes for additional information!
COMP 430 Intro. to Database Systems Course overview Slides adapted from those by Chris Jermaine.
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
371 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Introduction to Sequential Files. COBOL's forte  COBOL is generally used in situations where the volume of data to be processed is large.  These systems.
16- 1 Chapter 16.  To familiarize you with  COPY statement for copying parts of a program stored in a library  CALL statement for executing called.
Submitting Instructions on web site CS 1024 students Read guide
The Selection Structure
Programming in COBOL.
Chapter 3 The DATA DIVISION.
An Introduction to Structured Program Design in COBOL
Structured COBOL Programming
CHAPTER 17 The Report Writer Module
Programming in COBOL.
Presentation transcript:

Chapter 4 The Identification, Environment, and Data Divisions

Figure 4.1COBOL Notation GREATER THAN LESS THAN EQUAL TO identifier-1GREATER THAN OR EQUAL TO identifier-2 IF literal-1 IS [ NOT ]LESS THAN OR EQUAL TO literal-2 arithmetic expression-1> arithmetic expression-2 = <= Required word Choice required Optional entry Programmer supplied Optional reserved words

IDENTIFICATION DIVISION. PROGRAM-ID. Program-name. AUTHOR. [Nombre del autor.] INSTALLATION. [Nombre Centro de cómputos.] DATE-WRITTEN. [Fecha se escribio el prog.] DATE-COMPILED. [Fecha compilación.] SECURITY. [Documentación del programa.]

ENVIRONMENT DIVISION CONFIGURATION SECTION. [CONFIGURATION SECTION. [SOURCE-COMPUTER. Computer-name.] [OBJECT-COMPUTER. Computer-name.]]

ENVIRONMENT DIVISION INPUT-OUTPUT SECTION. [INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT file-name-1 ASSIGN TO implementor-name.]

FD file-name [BLOCK CONTAINS integer-1 RECORDS ] [RECORD CONTAINS integer-1 CHARACTERS] LABEL [DATA RECORD IS data-name-1]. FILE SECTION. RECORDS ARE OMITTED RECORD IS STANDARD

Figure 4.2Blocked versus Unblocked Records (a) Unblocked Records (One Logical Record per Physical Record) (b) Blocking Factor of Two (Two Logical Records per Physical Record) (b) Blocking Factor of Three (Three Logical Records per Physical Record)

Figure 4.3Student Exam Record STUDENT-EXAM-RECORD STUDENT-NAMEEXAM-SCORESSS-NUM LAST NAME FIRST NAME INIT MATHENGLISH ALGGEOREADVOCLIT ALPHANUMERICNUMERIC

Figure 4.4Level Numbers and PICTURE Clauses 01 STUDENT-EXAM-RECORD. 05 STUDENT-NAME. 10 LAST-NAMEPICTURE IS X(15). 10 FIRST-NAMEPICTURE IS X(15). 10 MID-INITIALPICTURE IS X. 05 SOC-SEC-NUMPICTURE IS 9(9). 05 EXAM-SCORES. 10 MATH. 15 ALGEBRAPICTURE IS 9(5). 15 GEOMETRYPICTURE IS 9(5). 10 ENGLISH. 15 READINGPICTURE IS 9(5). 15 VOCABULARYPICTURE IS 9(5). 15 LITERATUREPICTURE IS 9(5). 01 STUDENT-EXAM-RECORD. 04 STUDENT-NAME. 08 LAST-NAMEPIC X(15). 08 FIRST-NAMEPIC X(15). 08 MID-INITIALPIC X. 04 SOC-SEC-NUMPIC 9(9). 04 EXAM-SCORES. 08 MATH. 12 ALGEBRAPIC GEOMETRYPIC ENGLISH. 12 READINGPIC VOCABULARYPIC LITERATUREPIC (a) Initial Coding (b) Alternative Specification

Figure 4.5Assumed Decimal Point INCOMING RECORDDATA DIVISION RECORD DESCRIPTION VALUES v v v 9 87|65 4|3 | INCOMING-DATA-RECORD. 05 STUDENT-NAME PIC 9V STUDENT-NAMEPIC 99V9. 05 STUDENT-NAMEPIC STUDENT-NAMEPIC V

Figure 4.6 The Working- Storage Section WORKING-STORAGE SECTION. 01 COUNTER-AND-SWITCHES. 05 TOTAL-STUDENTS PIC 9(3) VALUE ZEROES. 05 DATA-REMAINS-SWITCH PIC X(2) VALUE SPACES. 01 PROGRAM-CONSTANTS. 05 REQUIRED-CREDITS PIC 999 VALUE REQUIRED-MAJOR PIC X(10) VALUE ‘ENGINEERING’. 05 REQUIRED-GPA PIC 9V99 VALUE HEADING-LINE. 05 FILLER PIC X(10) VALUE SPACES. 05 FILLER PIC X(12) VALUE ‘STUDENT NAME’. 05 FILLER PIC X(110) VALUE SPACES. 01 DETAIL-LINE. 05 FILLER PIC X(8) VALUE SPACES. 05 PRINT-NAME PIC X(25). 05 FILLER PIC X(10) VALUE SPACES. 05 PRINT-MAJOR PIC X(15). 05 FILLER PIC X(74) VALUE SPACES. 01 TOTAL-LINE. 05 PIC X(4) VALUE SPACES. 05 PIC X(14) VALUE ‘TOTAL STUDENTS’. 05 PIC X(2) VALUE SPACES. 05 TOT-STUDENTS PIC 9(3) VALUE ZEROES. 05 PIC X(110) VALUE SPACES. 01 DASHED-LINE. 05 FILLER PIC X(132) VALUE ALL ‘-’. El FILLER es opcional.

Figure 4.7Development of a COBOL Program (File Section) (b) COBOL Entries FD STUDENT-FILE RECORD CONTAINS 27 CHARACTERS. 01 STUDENT-RECORD. 05 STU-NAME. 10 STU-LAST-NAME PIC X(15). 10 STU-INITIALS PIC XX. 05 STU-CREDITSPIC 9(2). 05 STU-UNION-MEMBER PIC X. 05 STU-SCHOLARSHIP PIC 9(4). 05 STU-GPAPIC 9V99. STUDENT NAME LAST GPA INITIALS CREDITSUNION MEMBER SCHOLARSHIP (a) Program Specifications

Figure 4.8Development of a COBOL Program (Constants and Rates) (b) COBOL Entries WORKING-STORAGE SECTION. 01 CONSTANTS-AND-RATES. 05 PRICE-PER-CREDIT PIC 9(3) VALUE UNION-FEEPIC 9(2) VALUE ACTIVITY-FEES. 10 1ST-ACTIVITY-FEEPIC 99 VALUE ST-CREDIT-LIMITPIC 99 VALUE ND-ACTIVITY-FEEPIC 99 VALUE ND-CREDIT-LIMITPIC 99 VALUE RD-ACTIVITY-FEEPIC 99 VALUE MINIMUM-SCHOLARHSIP-GPA PIC 9V9 VALUE 2.5. (a) Excerpt from the Program Specifications 1. Calculate tuition due at the rate of $200 per credit. 2. The union fee is $ Compute the activity fee based on the number of credits taken; $25 for 6 credits or less, $50 for 7 to 12 credits, and $75 for more than 12 credits. 4. Award a scholarship equal to the amount in the incoming record if, and only if, the GPA is greater than 2.5.

Figure 4.9Development of a COBOL Program (Print Lines) (a) Report Layout

Figure 4.9Development of a COBOL Program (Print Lines) (b) COBOL Entries 01 HEADING-LINE. 05 FILLERPIC X VALUE SPACES. 05 FILLERPIC X(12) VALUE ‘STUDENT NAME’. 05 FILLERPIC X(10) VALUE SPACES. 05 FILLERPIC X(7) VALUE ‘CREDITS’. 05 FILLERPIC X(2) VALUE SPACES. 05 FILLERPIC X(7) VALUE ‘TUITION’. 05 FILLERPIC X(2)VALUE SPACES. 05 FILLERPIC X(9)VALUE ‘UNION FEE’. 05 FILLERPIC X(2)VALUE SPACES. 05 FILLERPIC X(7)VALUE ‘ACT FEE’. 05 FILLERPIC X(2)VALUE SPACES. 05 FILLERPIC X(11)VALUE ‘SCHOLARSHIP’. 05 FILLERPIC X(2)VALUE SPACES. 05 FILLERPIC X(10)VALUE ‘TOTAL BILL’. 05 FILLERPIC X(48)VALUE SPACES. 01 DETAIL-LINE. 05 FILLERPIC X VALUE SPACES. 05 DET-LAST-NAMEPIC X(15). 05 FILLERPIC X(2) VALUE SPACES. 05 DET-INITIALSPIC X(2). 05 FILLERPIC X(5) VALUE SPACES. 05 DET-CREDITSPIC 9(2). 05 FILLERPIC X(2)VALUE SPACES. 05 DET-TUITIONPIC 9(6). 05 FILLERPIC X(7)VALUE SPACES. 05 DET-UNION-FEEPIC 9(3). 05 FILLERPIC X(8)VALUE SPACES. 05 DET-SCHOLARSHIPPIC 9(5). 05 FILLERPIC X(6)VALUE SPACES. 05 DET-IND-BILLPIC 9(6). 05 FILLERPIC X(49)VALUE SPACES.

End of Chapter 4