Fresh IBM DB400 Interview Preparation Guide
Download PDF

IBM DB400 frequently Asked Questions by expert members with experience in IBM DB400. So get preparation for the IBM DB400 job interview

26 IBM DB400 Questions and Answers:

Table of Contents:

Fresh  IBM DB400 Job Interview Questions and Answers
Fresh IBM DB400 Job Interview Questions and Answers

1 :: Last statement of any RPG pgm is LR?

Not necessarily. LR is generally set on after all
processing is doen i.e. at the end of the program but there
is no hard and fast rule for that.

2 :: Maximum how many fields we can create under a record format of PF?

We can give max of 8000 fields in rec format of a PF.But it
also depend on the no. of bytes occupied by the record
formate.Because rec. format of PF may occupy atmax 32766 if there is only one field which occupy 32766
bytes then we can't define a new field in record format.
so it depend on the no. of bytes occupied by the field
defined in the record format.
Char field - max value(32766 bytes)
variable length field - max value(32740 bytes)
allow null field - max value(32765)
variable & allownull field - max value(32739)

3 :: How many max. Record format a logical file have?

8000. this can vary,can be lesser if date format,
alphanumeric fields are used.

4 :: Why Journalling is compulsory before Commitment Control?

Commitment ctrl is use to save /rollback the group of
chages and Journalling is use to save the changed records
in Jorunal reciver.

5 :: Why we create the Physical File Member?

A member is like an Individual file.It is possible to Have
32767 such members within the same PF.Each member added to
the file will exactly get the same record format(
fields,types and KWDS) on the file.This facility is
provided to meet the requirement when many files are needed
to be created with same structure.Here just Create file
once with MAXMBRS(as many reqd) and ADDPFM will do it.Easy
to create and maintain as a single object.Each member is
identified by unique name within file.
Examples : A School has attendance register per class. Each
Class has 4 sections and in all10 classes. Instead of
Creating and maintaining 40 files and scaterred in a
library, one can create a PF and add 40 members in one
Secondly All Physical files created need not necessarily
have members. Some files are created to store field
definitons only and are called field refrence files. They
need not have members.

6 :: Is Constent can be define as a key field?

Firstly a Constant cannot be a part of a File field list.
There is no meaning in having a Constant in the Key field.

7 :: Is it possible to create a logical file whose Physical file is not in same library?

Yes, Just put the user library in which you want to create
on top and followed by other library in which physical file
is located.

provided the first library should not have physical file.

Then try to create the logical.

8 :: How to add a field to a PF and compile it without loss of data?

First Add the fields whatever you want

then use CHGPF command

Physical file . . . . . . . . . > MyPf
Library . . . . . . . . . . . MyLib
System . . . . . . . . . . . . . *LCL
Source file . . . . . . . . . . MYSourceFile
Library . . . . . . . . . . . MyLib

Update the Physical file.No need to compile again.

9 :: How to find the list of source physical files in a library?
Is there any way to get a list?


10 :: Suppose i have a PF,it contains 5 members,how to access particular member data from logical file ?and what is the use of member in PF?

A1. Reading member 5 of myfilepf

A2.For accounting purpose each month data can be stored as
12 different members.
So that we can easily access one month data or 12 months
Easy to maintain 12 members in one PF file instead of 12 PF

11 :: How to read a PF in reverse(from last rec to first) using CL?





12 :: How to retrieve a physical file after deleting that? What is keyword used for that?

In the DD statement's DISP parameter write DISP=KEEP.And to
access the file with disposition KEEP we need to supply the
volume srail number as vol=ser=xxxx.

13 :: When we create a PF and did not fill up Maint parameter, then by default which access path will the system take & why?

Access Path Maint parameter use *IMMED.
Access path is updated each time a record is
changed, added, or deleted from a member.

14 :: I have Physical file with 100 records,there is no any duplicate records in this pf.Based on this pf one Logical file i have used.But this lf is viewing only 80 records only of that pf?What is the reason for this?

If there is any selection criteria in LF then it may be
displaying accordingly. If there is no "Select" or "Omit"
it should display 100 records. Have a look at LF once again.

15 :: How to know the particular record in pf with out reading?

you'll come to know
whether the record is found. that's all.
but not what(value) is in the record.

16 :: How to know logical file belongs to which physical file without source?

if you do a DSPDBR on a
logical file it wont show you the name of the physical file
that it is based on. Rather you need to use DSPFD on the
logical file. DSPDBR on a physical file will show the names
of all the LF files based on that PF.

17 :: What is open data path? and what is the diff b/w access path and open data path?

An access path describes the order in which the rows are
retrieved from a database file. If the rows in the file are
accessed in a physical sequence, that is known as an
arrival sequence access path. If the rows need to be
processed in an ordered manner, then a keyed access path is
needed to sort the data in the specified order. With DB2
for iSeries, keyed access paths are supplied to DB2 by
creating a keyed logical file, keyed physical file, or SQL

An access path and an open data path are used together to
process the rows in a database file.

The open data path (ODP) is the path through which all
input and output operations are performed on a database
file. The ODP is used to connect the requesting program
with the data in the file. As data is retrieved from or
inserted into the file, the ODP will use an access path to
navigate to a row within in the file. If the rows need to
be processed in a sorted owner, then someone will need to
supply a keyed access path by creating a keyed physical
file, keyed logical file or SQL index.

An ODP is created and used each time that a file is opened
or when an SQL statement is executed. There are ways to
have an ODP shared or reused instead of creating the ODP
each time.

18 :: How to update physical file using logical file with example?

Declare the logical file in update mode in the RPG program.

Chain at the record needed to be updated and afer changing
the field value use UPDATE opcode with the record format
name of the LF.The record gets updated

19 :: How to update physical files using normal logical file?

To Update physical file in RPG use opcode UPDATE.
key1 Setll LF1

Note: Logical file should be simeple logical file. We can't
update physical file with help of Join logical file.

20 :: One physical file can have how many max of logical files? what is the primary file?

one physical file can have more than one logical files.
priamary file is used in rpg program cycle to automatically
read records in a cycle

21 :: what is the interactive job? what is the batch job? How to change the batch job to interactive job?

When you sign-on an AS/400 system, you are interacting with
interactive jobs(e.g.QINTER). The System-jobs which are
presubmitted are called batch jobs(e.g.QBATCH, QSPL, QCMN etc.,)

If u want to know whether a job is in Interactive or Batch,
u can use RTVJOBA command with attribute JOB-TYPE on that job.
if it has a value '1' = Interative; '0' = Batch.

you can change a Batch-job to Interactive-job as long as it
is in JOBQ(by changing the environment on CHGJOB(opt-2)
command to QINTER or QPGMR); once it's active we cannot
change the type.

22 :: What is the purpose of the chain and setll and setgt?

CHAIN is used for random retrieval from a File. In other
words, whatever value used by programmer in Factor 1/Key
against CHAIN opcode will be used as search/find criteria in
can be well understand, in case of using composite keys.

But in case of SETLL and SETGT, program will return some
value, if any value present in the database/physical file.

CHAIN = Sets pointer on exact value

SETLL = Sets pointer on Lower Limit of the value

SETGT = Sets pointer on Greater Limit of the value


It is recommended, use CHAIN only, if record exist in
database file, instead of SETLL and SETGT, which can be used

23 :: A pf containing 100 records... my query is how to display from 11th record in the pf?

We can positioned to nth record in file in CL with the help of OVRDBF command.


This will positioned file on 11th record so RCVF command will read 11th record in file.

If you want to read with key conditioned then we can specify *KEY,*KEYA,KEYAE etc to positioned with key specified in command.

24 :: I had created one physical file tell me command to enter data in to?

by the use of the cmd UPDDTA Pfname use can enter the data
into the physical file. Note: dn't compile the pf after
entering the data into the pf.

25 :: Can we concatenate fields in physical file? If yes how can we do?

No, we cannot concat fields in Physical File. However, in
logical file, we can concat 2 or more fields together into 1
field. format is..

name concat(fname mname lname)
IBM DB400 Interview Questions and Answers
26 IBM DB400 Interview Questions and Answers