Presentation © Copyright 2002, Bryan Meyers Externally Described Files Chapter 6.

Slides:



Advertisements
Similar presentations
Disk Storage, Basic File Structures, and Hashing
Advertisements

iSeries Database Files
Computer Codes Rohit Khokher. Computer Codes Data types NumericNonnumeric IntegerRealAlphabet A, B, C, …,Z a, b, c,…,z Digits 0,…,9 Special Characters.
Advanced RPG Chapter 8 Interactive Applicatons. Interactive Applications  Batch Processing: Program is run without human intervention or control.  Interactive.
Chapter 3: Modules, Hierarchy Charts, and Documentation
1 Chapter 2 The Digital World. 2 Digital Data Representation.
Presentation © Copyright 2002, Bryan Meyers Arithmetic and Assignment Operations Chapter 4.
Exploring Microsoft Excel 2002 Chapter 7 Chapter 7 List and Data Management: Converting Data to Information By Robert T. Grauer Maryann Barber Exploring.
ACS-4902 Ron McFadyen Chapter 15 Algorithms for Query Processing and Optimization.
METU Department of Computer Eng Ceng 302 Introduction to DBMS Disk Storage, Basic File Structures, and Hashing by Pinar Senkul resources: mostly froom.
A Guide to SQL, Seventh Edition. Objectives Understand the concepts and terminology associated with relational databases Create and run SQL commands in.
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 13 Disk Storage, Basic File Structures, and Hashing.
Modules, Hierarchy Charts, and Documentation
Guide To UNIX Using Linux Third Edition
Data Representation (in computer system) Computer Fundamental CIM2460 Bavy LI.
Digital Logic Chapter 2 Number Conversions Digital Systems by Tocci.
Structured COBOL Programming, Stern & Stern, 9th Edition
Introduction to Database Systems
Presentation © Copyright 2002, Bryan Meyers Defining Data with Definition Specifications Chapter 3.
Getting Started Chapter 2 Presentation © Copyright 2002, Bryan Meyers
IS 320 Notes for Chapter 8. ClassX Problems: Low-Tech Fix Use last year's videos on ClassX  Select "Semesters" tab  Select IS 320  Select the week/lecture.
Chapter 13 File Structures. Understand the file access methods. Describe the characteristics of a sequential file. After reading this chapter, the reader.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 17 Disk Storage, Basic File Structures, and Hashing.
Chapter Four UNIX File Processing. 2 Lesson A Extracting Information from Files.
Guide To UNIX Using Linux Fourth Edition
Prof. Yousef B. Mahdy , Assuit University, Egypt File Organization Prof. Yousef B. Mahdy Chapter -4 Data Management in Files.
Computers Data Representation Chapter 3, SA. Data Representation and Processing Data and information processors must be able to: Recognize external data.
Foundations of Computer Science Computing …it is all about Data Representation, Storage, Processing, and Communication of Data 10/4/20151CS 112 – Foundations.
C Tokens Identifiers Keywords Constants Operators Special symbols.
Cis303a_chapt03-2a.ppt Range Overflow Fixed length of bits to hold numeric data Can hold a maximum positive number (unsigned) X X X X X X X X X X X X X.
SAS Efficiency Techniques and Methods By Kelley Weston Sr. Statistical Programmer Quintiles.
AS/400 Concepts & Tools. Day 1 Introduction to the AS/400 Basic Technical Concepts Programming Environment & Tools Programming Development Manager (PDM)
File Structures Foundations of Computer Science  Cengage Learning.
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.
Presentation © Copyright 2002, Bryan Meyers Top-Down, Structured Program Design Chapter 5.
Printing on power systems Program/ Command Data Report Layout (Printer File) Job Output Queue *FILE Spooled File.
Information Systems & Databases 2.2) Organisation methods.
MIS 3020 ABAP Programming Lecture 2 Elementary & User Defined Types Domains, Elements, Variables/Fields.
Database Management Systems.  Database management system (DBMS)  Store large collections of data  Organize the data  Becomes a data storage system.
FILES AND DATABASES. A FILE is a collection of records with similar characteristics, e.g: A Sales Ledger Stock Records A Price List Customer Records Files.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
Welcome to RPG544. Bit about Cindy Administrative Stuff Standards Due Dates Web Page.
DATABASE MANAGEMENT SYSTEM ARCHITECTURE
File Structures. 2 Chapter - Objectives Disk Storage Devices Files of Records Operations on Files Unordered Files Ordered Files Hashed Files Dynamic and.
DBT544. DB2/400 Advanced Features Level Check Considerations Database Constraints File Overrides Object and Record Locks Trigger Programs.
Relational Databases. Relational database  data stored in tables  must put data into the correct tables  define relationship between tables  primary.
Presentation © Copyright 2002, Bryan Meyers Introduction to Programming and RPG Chapter 1.
PowerPoint Presentation: Richard H. Baum, Ph.D. DeVry Institute of Technology 9th Edition Structured COBOL Programming Nancy Stern Hofstra University Robert.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Chapter 10 Designing Databases. Objectives:  Define key database design terms.  Explain the role of database design in the IS development process. 
Introduction ABAP Fields and Variables. Slide 2 Fields (Introduction) In ABAP, fields (or data objects) are named locations in memory Variables store.
NTFS Filing System CHAPTER 9. New Technology File System (NTFS) Started with Window NT in 1993, Windows XP, 2000, Server 2003, 2008, and Window 7 also.
1 Week # 4 Introduction to PDM PDM is a workbench environment that lets programmers and system operators navigate the three levels of the AS/400’s object-based.
Week 2/3 - 2nd Lecture Intro to COBOL Programming Defining Files and Processing Data.
Data Resource Management Lecture 8. Traditional File Processing Data are organized, stored, and processed in independent files of data records In traditional.
FILES AND EXCEPTIONS Topics Introduction to File Input and Output Using Loops to Process Files Processing Records Exceptions.
Chapter 3 Data Representation
How’s assignment 1 coming? Winter 2007
GO! with Microsoft Office 2016
Indexing Structures for Files and Physical Database Design
IBC233 Week 6.
Structured Programming
GO! with Microsoft Access 2016
Chapter 9 Designing Databases
Designing and Debugging Batch and Interactive COBOL Programs
Disk Storage, Basic File Structures, and Hashing
Chapter 3 The DATA DIVISION.
Chapter Four UNIX File Processing.
IBC233 Week 5.
Presentation transcript:

Presentation © Copyright 2002, Bryan Meyers Externally Described Files Chapter 6

Programming in RPG IV Third Edition 2 Objectives: Define physical and logical files Discuss data types Discuss storage implications of numeric and character types Access physical and logical files from an RPG program Discuss field reference files Define externally described printer files

Programming in RPG IV Third Edition 3 Physical File Stores data records Can be defined as key sequence –Designate a key Can be defined as arrival sequence –First-in, first-out If the key field is not defined, then access is limited to arrival sequence

Programming in RPG IV Third Edition 4 Logical File Does not actually contain data Stores access paths –Pointers to records in physical files RPG programs use logical files just as though the logical files themselves contained data

Programming in RPG IV Third Edition 5 Introduction to DDS Use SEU to create a source member of definition statements Source type for physical files is PF Source type for logical files is LF Description Specifications (DDS) define files File, record and field level keywords are used to define a file CRTPF command creates physical file from DDS source –CRTLF command creates logical file

Programming in RPG IV Third Edition 6 Physical File Example * A* T.Name++++++RLen++TDpB Functions A UNIQUE A R EMPREC A EMPNO 9S 0 A LNAME 15A A FNAME 10A A DEPT 3A A SALARY 6P 0 A STREET 15A A CITY 15A A STATE 2A A ZIP 5S 0 A K EMPNO

Programming in RPG IV Third Edition 7 Data Types and Data Storage A = Character S = Zoned decimal B = Binary P = Packed decimal

Programming in RPG IV Third Edition 8 Packed Decimal Only the digit (low order) bits of a number are stored Sign occupies right-most four bit positions iSeries converts all numeric data to packed decimal before values are used in calculations Packed fields take (n+1)/2 bytes of storage –n=number of digits

Programming in RPG IV Third Edition 9 Extended Binary Coded Decimal Interchange (EBCDIC) Digit EBCDIC

Programming in RPG IV Third Edition 10 Zoned Decimal Representation Digit EBCDIC # of Bytes ________ ________ ________

Programming in RPG IV Third Edition 11 Packed Decimal Representation Digit EBCDIC # of Bytes ________ ________

Programming in RPG IV Third Edition 12 Simple Logical Files Contain the record level keyword PFILE and the name of the physical file Have one or more field level keywords Widely used to change the retrieval order of records in a file –Same as physically sorting a physical file

Programming in RPG IV Third Edition 13 Simple Logical File Example * A* T.Name++++++RLen++TDpB Functions A R EMPREC PFILE(EMPMST) A K LNAME

Programming in RPG IV Third Edition 14 Simple Logical File Example * A* T.Name++++++RLen++TDpB Functions A R EMPREC1 PFILE(EMPMST) A EMPNO A LNAME A FNAME A DEPT A SALARY A K DEPT A K EMPNO

Programming in RPG IV Third Edition 15 Simple Logical File Example * A* T.Name++++++RLen++TDpB Functions A R EMPREC1 PFILE(EMPMST) A EMPNO A LNAME A FNAME A DEPT A SALARY A K DEPT A K EMPNO A S DEPT VALUES(‘MIS’ ‘ACT’)

Programming in RPG IV Third Edition 16 Multiple Record Formats Defined based on two or more physical files Each format is based on a different physical file Gives the appearance that the two physical files have been merged together

Programming in RPG IV Third Edition 17 Multiple Record Formats * A* T.Name++++++RLen++TDpB Functions A R STUDREC PFILE(STUDMAST) A K STUD_NO * A R CRSEREC PFILE(STUDCRSE) A K STUD_NO A K SEMESTER

Programming in RPG IV Third Edition 18 Join Logical Files Fields are combined from different physical files into a single record JFILE signals which physical files are used by the logical file JOIN designates which physical files are used in this join JFLD keyword indicates which fields’ values are to be matched

Programming in RPG IV Third Edition 19 Join Logical File Example * A* T.Name++++++RLen++TDpB Functions A R EMPREC JFILE(ORDERS INVENT) A J JOIN(ORDERS INVENT) A JFLD(PART_NUM PART_NO) A ORDER_NO A CUST_NO A PART_NO A DESCRPT A SELL_PRICE A QTY_ORD

Programming in RPG IV Third Edition 20 Externally Defined Files Code an ‘E’ in position 22 on the F spec Omit any entry for record length If file is keyed, code a ‘K’ in position 34 –Omitting the ‘K’ results in record retrieval based on arrival sequence Input specs not needed for externally defined files Program makes no distinction made between physical and logical files If you change a file (physical or logical) after you have compiled a program using that file, you must recompile the program * FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords FEmpMaster IF E K DISK

Programming in RPG IV Third Edition 21 Additional Database Concepts Keywords can be used for data validity checks, for interactive data entry, and editing output Data dictionary or Field Reference File is used to provide field definitions for use in subsequent file creation –You never actually use this file for data storage

Programming in RPG IV Third Edition 22 Additional Database Concepts To use a field from the Field Reference File, use the file-level keyword REF and code an ‘R’ in positions 29 on the field referenced Field-reference files can enforce a uniformity and consistency File names should consist of an agreed- upon mnemonic prefix to denote the system

Programming in RPG IV Third Edition 23 Database File Naming File names should contain a short alphabetic mnemonic code to uniquely identify the file –Often related to key field Suffix of P (Physical), L (logical), F (field reference), S (screen), R (report) –and a number to differentiate between similar files CCSSTUP - CCS system, student, physical file

Programming in RPG IV Third Edition 24 Externally Described Printer Files Printer files can be created the same as physical files –Use CRTPRTF command DDS –Each record format begins with an ‘R’ in position 17 –Specify the field’s or constant’s beginning position Where it starts on the line –Use SPACEA, SPACEB, SKIPA, and SKIPB keywords for spacing and skipping –Use DATE and PAGNBR for UDATE and PAGE –Use EDTWRD and EDTCDE keywords for editing

Programming in RPG IV Third Edition 25 Externally Described PRTF * A* T.Name++++++RLen++TDpBLinPosFunctions A R HEADINGS SKIPB(1) A 10DATE EDTCDE(Y) A 22’SALES REPORT’ A 37’PAGE’ A 42PAGNBR EDTCDE(3) A SPACEA(2) A 14’SLSPSN.’ A 34’AMT.’ A SPACEA(2) A R DETAILLINE SPACEA(1) A SALESPRSN 4 15 A SALESAMT EDTCDE(1) A R BREAKLINE SPACEB(1) SPACEA(2) A 20’TOTAL’ A SLSPTOTAL EDTCDE(1) A 40’*’ A R TOTALLINE A 16’GRAND TOTAL’ A GRANDTOTAL EDTCDE(1)

Programming in RPG IV Third Edition 26 Externally Described Printer Files File Specification –Code printer file name Not QPRINT –‘E’ in position 19 –Omit any entry for record length –Device (36-42) must be PRINTER –The overflow indicator cannot be OA - OF or OV Use OFLIND keyword to specify almost anything else (*IN10, *IN11, *IN99 etc.) Named indicators also allowed * FFilename++IPEASFRlen+LKlen+AIDevice+.Keywords FSalesRpt O E PRINTER OflInd(EndOfPage)

Programming in RPG IV Third Edition 27 Externally Described Printer Files Calculation Specifications –Use WRITE instead of EXCEPT Output Specifications not needed

Programming in RPG IV Third Edition 28 Points to Remember The iSeries defines data files independently of your programs Physical files contain data records, while logical files provide access paths, or pointers to the physical file Both physical and logical files may contain a key –Allows records to be retrieved based on the value of the key (key sequence)

Programming in RPG IV Third Edition 29 Points to Remember The key can consist of one or several data fields –In the latter case, the key is called a composite or concatenated key A physical file may contain only a single record format Logical files may contain multiple record formats, based on records from two or more physical files

Programming in RPG IV Third Edition 30 Points to Remember A logical file also may contain a single record format that actually combines data fields stored in different physical files –Called a join logical file Logical files can be used to select or omit records from the physical file

Programming in RPG IV Third Edition 31 Points to Remember A Field Reference File (data dictionary) can be used to record field definitions –Physical files can then reference this file rather than having the field definitions included directly within the physical files themselves

Programming in RPG IV Third Edition 32 Points to Remember Numeric data can be stored in a physical file in one of three common formats –Zoned decimal –Packed decimal –Binary Define packed fields with odd number of positions

Programming in RPG IV Third Edition 33 Points to Remember Externally described printer files offer several advantages –Report formats can be changed without modifying programs –RLU can be used to design the reports and generate the DDS –Output specs can be eliminated from your programs –Formats can be shared by other programs