Presentation on theme: "iSeries Database Files"— Presentation transcript:
1 iSeries Database Files Physical Files *FILE PF-DTALogical Files *FILE LFPhysical 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.
2 Physical Files It is an as/400 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 programData physical files usually have 1 member (but can have more)
3 Data Files Files, Records, Fields A file member contains one or more recordsA record is made up of one or more fields which give it its record format or file descriptionEach field contains a unique piece of information e.g. student no, first name, last name, address, telephone no, etc.
4 Examples of Files, Records, Fields 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 informationStudent file - student records (1 per student)- student info: name, address...
5 More Examples of Files, Records, Fields Parts file - parts records - info about part: part number, description, warehouse location, supplier, quantity on hand,Payroll file - payroll records - payroll info for employees: employee number, name, date of hire, hourly or salary, hourly rate or annual salary, income tax info….
7 Creating Physical Data Files Creating an AS/400 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).
8 Tools for Describing Database Files Data Description Specifications (DDS)AS/400 language to create source code for FilesOthers:SQL (Structured Query Language), (you will do this in DB2 course)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.
9 Using DDSSource code is entered into a source physical file member in the form of DDS statements. This is done using the iSeries editor SEUThe DDS statements describe each field of the record in detail e.g. field name, data type (numeric, character, packed numeric, etc), standard column headings, etc.The source file for DDS is QDDSSRC.Can edit all kinds of DDS files including screen and printer DDS files.
10 Example of DDS Columns . . . : 1 71 Browse DMENKEN/QDDSSRC SEU==> STUPFFMT PF .....A T.Name++++++RLen++TDpB......Functions*************** Beginning of data *************************************A R STUPFRA SOCINS S COLHDG('Social' 'Insurance'A FNAME A COLHDG('First' 'Name')A LNAME A COLHDG('Last' 'Name')PHONE S COLHDG('Phone' 'No.')A ADDR A COLHDG('Street' 'Address')A ADDR A COLHDG('City')A ZIP S COLHDG('Zip Code')****************** End of data ****************************************
11 Creating a Database File Create the source file (CRTSRCPF) which is named QDDSSRC (only done once)Create a source member, type PFEnter the source code using SEUSave source code and compile to create the filePut data into the file.
12 The source type:tells SEU what type of source you are creating e.g. TXT, PF, LF, etc. Used for prompting and checking the syntaxwill tell PDM which compiler to use when creating the object.
13 Entering DDS codeFirst statement is the Record Format statement. Put an R in the Name Type field and the record name in the Name field.Then enter the field info (field name, length, data type, decimal positions, standard column heading) (nothing in Name Type field)
15 Compiling the Source Code CRTPF command or Option 14 in PDM takes the source code and creates the object i.e. the physical file the physical file is what holds the data
16 How do you know if the compile worked??? DSPMSG- you will have a message which tells you whether your job completed normally or not.An output file is created with each compile (the compile listing) which tells you what happened. READ it!Where is that output file??In your output queue!!
17 Question!If the compile ended abnormally, what do you do? How can you find out why?
18 Unique feature of iSeries Files The record description is stored with the file object (externally described file)It can then be used by iSeries utilitiesThe record description does not have to be coded in programs that use it.Can be viewed using DSPFD, DSPFFD
19 Entering dataIf 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
20 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 recordsF23 to delete a record
Your consent to our cookies if you continue to use this website.