More About COBOL Tables

Slides:



Advertisements
Similar presentations
2000 Prentice Hall, Inc. All rights reserved. 1 Capitolo 4 - Arrays Outline 4.1Introduction 4.2Arrays 4.3Declaring Arrays 4.4Examples Using Arrays 4.5Passing.
Advertisements

Copyright © 2002 Pearson Education, Inc. Slide 1.
CS 141 Computer Programming 1 1 Arrays. Outline  Introduction  Arrays  Declaring Arrays  Examples Using Arrays  Sorting Arrays  Multiple-Subscripted.
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
Chapter 12 Array Processing and Table Handling. Defining Series of Input Fields Coding record with 24 independent hourly fields is cumbersome 01Temp-Rec.
7-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)
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Chapter 6 - Arrays Outline 6.1Introduction 6.2Arrays.
Microsoft Visual Basic 2005: Reloaded Second Edition Chapter 8 Arrays.
 2006 Pearson Education, Inc. All rights reserved Arrays.
An Object-Oriented Approach to Programming Logic and Design Chapter 7 Arrays.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
CPS120: Introduction to Computer Science Information Systems: Database Management Nell Dale John Lewis.
12-1 Structured COBOL Programming Nancy Stern Hofstra University Robert A. Stern Nassau Community College James P. Ley University of Wisconsin-Stout John.
12-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)
Copyright © 2003 Pearson Education, Inc. Slide 8-1 The Web Wizard’s Guide to PHP by David Lash.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
12- 1 Chapter 12.  Single-Level OCCURS Clauses  Processing Data Stored in Array  Using OCCURS Clause for Table Handling  Use of SEARCH Statement 
CHAPTER THREE Representing Data: Constants and Variables.
 2006 Pearson Education, Inc. All rights reserved Arrays.
© Copyright 1992–2005 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. Tutorial 8 - Interest Calculator Application: Introducing.
To enhance learning, service, and research through an advanced information technology environment. Our Mission:To enhance learning, service,and research.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 9 Arrays.
Chapter 12 (part 2) Table Handling and Search Techniques.
1 5. Abstract Data Structures & Algorithms 5.2 Static Data Structures.
Hashing Hashing is another method for sorting and searching data.
An Introduction to Programming with C++ Fifth Edition Chapter 11 Arrays.
12- 1 Chapter 12.  Single-Level OCCURS Clauses  Processing Data Stored in Array  Using OCCURS Clause for Table Handling  Use of SEARCH Statement 
7-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)
1 Review for test 2 Chapters 7, 8, 9, 11, What is wrong with the following paragraphs? PARA-A. PARA-B. ADD A TO B MOVE 0 TO X PERFROM PARA-A PERFORM.
CHAPTER EIGHT ARRAYS © Prepared By: Razif Razali1.
CHAPTER THREE Representing Data: Constants and Variables.
12-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)
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Arrays Outline 6.1Introduction 6.2Arrays 6.3Declaring.
© Copyright 1992–2004 by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Arrays + Functions Outline 6.5Passing Arrays to Functions.
Data Integrity & Indexes / Session 1/ 1 of 37 Session 1 Module 1: Introduction to Data Integrity Module 2: Introduction to Indexes.
Arrays 1.
12-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)
Representing Data: Constants and Variables
Chapter 3 Data Representation
Tables In COBOL An Introduction
Chapter 13: Overloading and Templates
Data-Basics Training & Support
Microsoft Visual Basic 2005: Reloaded Second Edition
Tables and PERFORM..VARYING
Screen I/O ACCEPT DISPLAY Relevant to the Fujitsu Compiler.
The Selection Structure
Review Graph Directed Graph Undirected Graph Sub-Graph
Pointers and Arrays Chapter 12
Variables and Arithmetic Operations
Visual Basic .NET BASICS
Simplifying Flow of Control
One-Dimensional Array Introduction Lesson xx
Topics Introduction to File Input and Output
7 Arrays.
Structured COBOL Programming
Iteration: Beyond the Basic PERFORM
Hash Tables Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common.
Regrading Project 2 Exam 2 One week period TA: Huiyuan TA: Fardad
Pointers and Arrays Chapter 12
Computing in COBOL: The Arithmetic Verbs and Intrinsic Functions
THE COMPUTE STATEMENT Purpose: performs mathematical calculations
Chapter 9: Value-Returning Functions
CHAPTER 17 The Report Writer Module
Chapter 7 Using SQL in Applications
Topics Introduction to Functions Defining and Calling a Function
Data Types and Expressions
Hash Tables Chapter 12 discusses several ways of storing information in an array, and later searching for the information. Hash tables are a common.
Programming Logic and Design Fifth Edition, Comprehensive
Lecture 14: Problems with Lots of Similar Data
Topics Introduction to File Input and Output
Presentation transcript:

More About COBOL Tables SFASU M. M. Pickard, PhD Copyright, 1996 © Dale Carnegie & Associates, Inc.

Introduction Beyond the basics: indexes versus subscripts the SET verb the SEARCH verb

Indexes versus Subscripts Definition (declaration). Modification. Reference. Lookup

Indexes versus Subscripts ----------Definition-------------- Appearance in ‘INDEXED BY’ clause 01 A-TABLE. 05 A-MESS PIC X(20) OCCURS 20 INDEXED BY A-INDEX. Definition as an integer data item 01 MISC. 05 XAMPL-SUB PIC 99.

Indexes versus Subscripts ----------modification------------ PERFORM…VARYING SET statement SEARCH statement PERFORM…VARYING arithmetic statements MOVE statement INITIALIZE statement

The SET statement Format 1: SET index-name-1 . . . TO index-name-2 or or identifier-1 identifier-2 or integer-1

The SET statement Format 2: SET index-name-1 UP BY identifier-1 or or DOWN BY integer-1

SEARCH verb Allows search of an indexed table Two search methods serial search binary search Table being searched MUST have a KEY clause and an INDEXED BY clause

SEARCH verb Serial search: SEARCH table-entry AT END executable-statement WHEN condition executable-statement(s) . . . [END-SEARCH]

SEARCH verb Binary search: SEARCH ALL table-entry AT END executable-statement WHEN equality condition executable-statement(s) [AND equality condition executable-statement(s)] . . . [END-SEARCH]

SEARCH verb Binary search SEARCH ALL (serial search doesn’t use ALL) Requires use of KEY clause on table in addition to INDEXED BY clause Elements of table must be in the specified order

Advantages of Indexed Tables Because indexes are stored in a format that is optimized for address calculation, table references for indexed tables are faster. An “automatic” binary search of an indexed table is possible.

Advantages of Subscripted Tables Subscripts are somewhat easier for beginners to understand.

Advantages of Subscripted Tables Debugging of code that uses subscripts is slightly easier. A subscript can be used with any table; an index can only be used with the table in which it is defined.

Summary - 1 Both subscripts and indexes can be used with tables having the INDEXED BY clause. Only subscripts may be used with non- indexed tables.

Summary - 2 Indexes have no PICTURE clause. Index values are kept in an internal format that is ideal for address computation. Indexes can not be adjusted with ordinary mathematical operations.

Summary - 3 Indexes are much faster Subscripts are slightly easier