Presentation is loading. Please wait.

Presentation is loading. Please wait.

IBC233 Week 6.

Similar presentations


Presentation on theme: "IBC233 Week 6."— Presentation transcript:

1 IBC233 Week 6

2 Homework Lab 4 Part E due June 18 Work on Lab 5 and Lab 7

3 Agenda Database Files Physical files Logical files

4 Database Files

5 DB2 Database Files Physical Files *FILE PF-DTA Logical Files *FILE LF
Physical files contain actual data. Logical files show a view of a physical file (I.e. different key field and selection criteria). A logical file does not contain data. Printer files determine how a spool file will be displayed (I.e. fonts, characters per inch etc.) Display files determine how screens such as menus, information and data entry screens well look.

6 Physical Files It is an system i file used to store data or source code. Physical files have members. The members contain data or source code. Source physical files have many members eg. One for each program Data physical files usually have 1 member (but can have more)

7 How do we create data physical files?

8 Creating Physical Data Files
Creating an ibm i data file is very similar to creating a program: Write the source code (the source code will describe what the file will look like). The source code is stored in a member in a source file. Compile the source code (this creates a *file object).

9 Tools for Describing Database Files
Data Description Specifications (DDS) system i language to create source code for Files SQL (Structured Query Language DDS is the most popular. Can use utilities SDA (screen design aid) to create DDS screen files and RLU (report layout utility) to create DDS report files.

10 Layout of a DDS Program File level keywords Record format name
Eg. UNIQUE, Function Keys Record format name Shouldn’t be the same name as the object List the fields Name, type, size and functions TEXT (used by DFU and DSPFFD) COLHDG (used by Query/400) Access Path information

11 Item File Write the DDS code to define a *FILE that has the following attributes: Item Number (5 numeric – 1 digit/byte) Also the primary key Item Name (30 Alphanumeric) Stocking Size (5 Alphanumeric) In Stock Quantity (7 numeric including 2 decimals – 2 digit/byte) Date Last Updated

12 Unique feature of db2 Files
The record description is stored with the file object (externally described file) It can then be used by system i utilities The record description does not have to be coded in programs that use it. Can be viewed using DSPFD, DSPFFD

13 Entering data If the compile was successful, you will have a new object in your library, a physical file. To enter data into that file, use DFU, Data File Utility UPDDTA

14 DFU STRDFU, then option 5 or… PDM option 18
F10 to enter new records (entry mode) F11 to change records (change mode), page up and down to find records F23 to delete a record

15 Viewing records RUNQRY QRYFILE(filename) DSPPFM filename

16 Allows us to sort or select/omit data
Access Paths Allows us to sort or select/omit data

17 Logical Files

18 Logical Files Resort data in a physical file
Select/Omit specific sets of data Hide data Join or Merge physical files together

19 Why a logical file A customer file is made up of customer records (1 per customer). Each customer record has fields containing unique pieces of info about a particular customer e.g. customer name, address, sales territory,billing info, shipping instructions, credit information If we want to make sure that the customer id is unique If we want to display customer records sorted by name If we want to select customers in a specific territory If we want to provide a maintenance screen hiding Credit Information

20 Creating a Logical File
Create the source file (CRTSRCPF) which is named QDDSSRC (only done once) Create a source member, type LF Enter the source code using SEU Save source code and compile to create the file Put data into the file.

21 Create a logical file that sorts Item file by Name and Stocking Size


Download ppt "IBC233 Week 6."

Similar presentations


Ads by Google