Module 2 Defining Data Revised 2011. Defining Data All definitions of data for COBOL takes place in the DATA DIVISION. All data defined are visible to.

Slides:



Advertisements
Similar presentations
DT266/2 COBOL Basics – Declaring Data Basic Operations.
Advertisements

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.
Conditions.. IF Syntax.   Simple Conditions l Relation Conditions l Class Conditions l Sign Conditions   Complex Conditions   Condition Names 
Binary Numbers.
Significant Figures Part II: Calculations.
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.
Programming in COBOL-85 For IBM Mainframe System 390
Fractions, Decimals, and Percents. 1. Find the prime factorization of each number (similar to p.17 #55-71)
Rational Numbers 3-1.
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
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;
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.
Pharmacology I Math Review.
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 in COBOL-85 For IBM Mainframe System 390 Jyothi Sridhar Kini E&R, Infosys Mail-id: Phone:
Lecture 31 Numeric Edited Alphabetic (A) AlphaNumeric (X) Numeric (9, V, S) Numeric Edited (9, Z, comma, decimal point, minus sign) –Z = zero suppressed.
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.
Module 4 Constants Copy Statement Perform Verb Part 1.
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).
FRACTIONSDECIMALSPERCENTS: “”SEA”- ng THE CONNECTIONS “”SEA”- ing THE CONNECTIONS 25% 90% 1/2 13/ …
Lecture 41 Arithmetic Clauses The ROUNDED clause –Place ROUNDED after the variable that holds the result ADD A TO B ROUNDED. ADD A TO B GIVING C ROUNDED.
More Syntax in COBOL  Moving Data  Selection Statements  System Date  Indicators in Display files.
Exercise Rename as an equivalent fraction with a denominator of 100.
EEL 3801C EEL 3801 Part I Computing Basics. EEL 3801C Data Representation Digital computers are binary in nature. They operate only on 0’s and 1’s. Everything.
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.
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.
Lecture 21 ENVIRONMENT DIVISION  defines files external to the program and devices.  contains two sections: 1.CONFIGURATION SECTION.  identifies computers.
B121 Chapter 5 Working with Numbers. Number representation ThousandHundredsTensUnits Natural numbers: 1,2,3,4,5……… Integers: Natural numbers.
COBOL for the 21 st Century Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout (Emeritus)
Continued Four Operations-Division
Any Questions! 2 Agenda Moving data Arithmetic Verbs Compute statement.
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.
Fractions, Decimals, and Percents. 1. Find the prime factorization of each number.
Pre-Algebra 3-1 Rational Numbers Learn to write rational numbers in equivalent forms.
PERCENT(%) Lesson 11.
FRACTIONS DECIMALS PERCENTS.
Submitting Instructions on web site CS 1024 students Read guide
Daily Warm-Up 1/20/
FRACTIONS DECIMALS PERCENTS.
Structured Programming
Fractions and Decimals
FRACTIONS DECIMALS PERCENTS.
Programming in COBOL.
FRACTIONS DECIMALS PERCENTS.
FRACTIONS DECIMALS PERCENTS.
Chapter 3 The DATA DIVISION.
FRACTIONS DECIMALS PERCENTS.
An Introduction to Structured Program Design in COBOL
Structured COBOL Programming
Chapter 14 Sorting and Merging.
Variables and Expressions
Agenda Collating sequence / Sorting data
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
CHAPTER 17 The Report Writer Module
Decimal / Binary Conversions
What is 13 ÷ 4.
Any Questions?.
Fractions, Decimals, & Percents
FRACTIONS DECIMALS PERCENTS.
Decision Making Using the IF and EVALUATE Statements
Programming in COBOL.
Presentation transcript:

Module 2 Defining Data Revised 2011

Defining Data All definitions of data for COBOL takes place in the DATA DIVISION. All data defined are visible to all routines in the PROCEDURE DIVISION. Data Definitions fall into one of the following: Alphabetic Alphanumeric Numeric

COBOL ‘PICTURE’ Clause To create the required ‘picture’ the programmer uses a set of symbols. The following symbols are used in picture clauses: 9 ( the digit nine) is used to indicate the occurrence of a digit at the corresponding position in the picture. X (the character X) is used to indicate the occurrence of any character at the corresponding position in the picture. V (the character V) is used to indicate the position of the decimal point in a numeric value. S (the character S) indicates the presence of a sign.

Group & Elementary Items In COBOL the term “group item” is used to describe a data item which can be further divided: - A Group item is declared using a level number and a data name. It cannot have picture clause. Where a group item is the highest item in a data hierarchy it is referred to as a record and uses the level number 01. “elementary item” is the lowest item in a data hierarchy. It cannot be further divided. An “elementary item” declaration consists of a level number, a data name and a picture clause.

Level Numbers Express Data Hierarchy 01Student Details. 02 Student Name. 03 SurnamePIC X (8). 03 InitialsPIC XX. 02StudentIdPIC 9(7). 02CourseCodePIC X(4). 02GenderPIC X.

Level Numbers Express Data Hierarchy 01Student Details. 03 Student Name. 05 SurnamePIC X(8). 05 InitialsPIC X(2). 03StudentIdPIC 9(7). 03CourseCodePIC X(4). 03GenderPIC X.

Abbreviating Recurring Symbols Recurring symbols can be specified using a ‘repeat’ factor inside the round brackets. PIC 9(6) is equivalent to PICTURE PIC 9(6)V99 is equivalent to PIC V99 PICTURE X(10) is equivalent to PIC XXXXXXXXXX

Group Items/Records 01StudentDetailsPIC X(20). LEWISTT79866CSEB112M

Group Items/Records 01StudentDetails. 02StudentNamePIC X(5). 02StudentIDPIC X(7). 02 CourseCodePIC X(7). 02 GenderPIC X. LEWISTT79866CSEB112M StudentName StudentID CourseCode Gender