You are on page 1of 3

DB2

The following are the relational operations that can be performed on data.
*Sequence – The default order of retrieval of rows related to row sequences
*Selection – Selecting particular rows of information
*Project – Retrieving and performing column selection (or) retrieving data from selected
columns.
*Unions – Rows from multiple tables
*join – Retrieving data from one or more tables is join.
PHYSICAL FILE
Has an Object header, format, access path and data.
To find format
DSPFD (or)DSPFFD.
Access path shows how the data is retrieved from the file. Database file members are
subsets of records of a database file.
AGENDA
Some important keywords. (PFILE is record level keyword and REF is file level keyword ,
REFFLD is a field level keyword).
Non join logical files.
Join logical files.
Different ways of displaying contents of a physical file or to query a logical file
1. Runqry *n <physical file>.
2. Strqql
Select * from emp
3. Strdfu.
Option 5 (prompt).
4. Dsppfm (prompt).
5. Shift F8 – To fullscreen.
Keywords
COLHDG- provides column name for the field.
ASSIGNMENT : Create examples with explanation for following fuctions
1.CMP
2.COMP
3.FORMAT
4.RANGE
5.TEXT.
6.VALUES
7.VARLEN.
Differences between char and varchar
In char all the allotted space will be consumed irrespective of the data given whereas in
varchar only the specified memory consumption.
Data type – A-is fixed .Processing is much faster in fixed type over variable data type..
VARLEN is combination of fixed and variable data type in DDS.
Q1. What are the various criteria for using VARLEN? What are the practical advantages and
disadvantages?
Using data structure memory could be optimized and the efficiency could be increased.
Whenever the compiled program has an error enter SP in the compilation box to find the
spool file. Give SHIFT F6 to find the latest corresponding spool file and display it to find the
errors.
FORMAT KEYWORD
The format keyword is used to share the field specifications for a previously defined record
format. The name of the record format you are defining must be the name of the previously
defined record format. Defining any fields when the format keyword is used will result in an
error at file creation time.
TEXT KEYWORD
The text keyword allows upto 50 characters of text description to be included in the format
portion of the file for each field. It is for documentation purpose only.
VARLEN KEYWORD
They are not to be used as important fields.(REFER NOTEBOOK).

VALUES KEYWORD
The set of values that are to be defined when using them in the data updation. For numeric
values no quotes are required whereas for alphanumeric data type values are to be given in
quotes. Provides list of valid values. Values given under quotes are case sensitive . i.e Given
as such in the values function in the Physical file where the program is written……. To turn
off the caps use SET CAPS OFF in the SEU line.
To use two functions in the single field
1. Insert IP.
2.Enter the function beneath it and add on the functions one below the other .
0000.IP ename colhdg(‘’).
Text(‘’).
Values().
MEMBERS
Members of a physical file are subset of records of a physical file. The name of the first
member is by default the name of the file. A physical file can have a maximum of 32,767
members.By default it is multiples of 10,000.
ADDPFM – To add a members to a physical file.
To change the parameter CHGPF to add about members by changing the attributes of the
file. Prompt to get the number of parameters attributes changed.
To find the number of members associated with the file
DSPFD
Output parameter *, *print , *outfile
*- output onto your screen
*print – Output created in the spool file form. WRKSPLF- to work with spool files.
*outfile - Displays the additional parameters to enter the output file and the library to
which it has stored, where the output is stored in the form of the database file.
To get the fields from output database file.
Startsql
Select * from the <target output file>
Prompt f4.
To retrieve data from members
RUNQRY *n <member name>
OVRDBF (override with database file)
File to be overridden <file name>.
Overriding to data base file <file name>.
Library
Overriding member <member name> .
On signing off override information will be deleted.
To check override information associated with a job
DSPJOB (option 15)
To enter the information into the members
….. Similar to that of adding data into the table … Specify the member name to insert data
into that particular field.

You might also like