Mid Range Concepts - Fox Valley Technical College

Download Report

Transcript Mid Range Concepts - Fox Valley Technical College

Mid Range Concepts
Chapter 11
Logical Files
Defining Keys
 File Access:

Direct Access: the storage device can go directly to the
location and read the information stored there.


Primary Key: Field whose value is unique for each record.
Sequential Access: storage device must go through all
storage locations that physically precede the storage
location being sought.

Relative Record Number: Each record is given a number based
on it relative position within the file.
Defining Keys
 Key Fields: DDS provides the ability to
define key fields.

KSAP (Keyed sequence access path): Provides
the programmer the ability to access the records
in both arrival sequence and keyed sequence.
 Key Fields can be Primary or Secondary


Primary: unique
Secondary: not unique
Defining Keys
 Primary Keys:


Place the word UNIQUE prior to any file
references in DDS.
AFTER record specifications reenter the field
name of the key with a K in position 17.
 Secondary Keys:

Same as above but DO NOT specify unique.
Logical Files
 Logical Files: usually created to satisfy
different user access requirements.




They offer a different view of the data than
supplied by the physical file.
They do not contain any data.
They are based on a physical file and cannot
exist independently.
Utilize DDS to define the record layout.
Logical Files
 Record level keyword PFILE is required to
specify the physical file they are based on.
 Would you want to perform updates to
logical files?

Be careful when not all the fields of the physical
file are present.
Logical Files
 Can add or delete records of a physical file
and the logical file will automatically see the
adjustments.
 Cannot delete an entire physical file if logical
files exist using it.

Command: DSPDBR (Display Database
relations) will display all dependent files for a
specified file.
Logical files
 Logical files are much easier to change than
physical files.

Can use the command FNDSTRPDM to find all
programs that use the logical file because they
will need to be recompiled.
Logical Files
 Joining logical file: Can contain information
from multiple physical files.




Up to 32 files can be joined in a logical file.
JFILE keyword is used to specify file names.
JOIN keyword is used to specify files joined.
JFLD keyword is used to specify fields used to
join the files.
Logical Files