IBM DB400

  Home  Mainframes  IBM DB400


“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

2⟩ How to know total no of records in pf with out using sql?

By using dspfd command you can find out total on record.

dspfd (libname/filename)

here u can find out total no of records.

1. Through the RPG program, Open Feedback Information of

File Information data structure (INFSR) will give the count

of records in the physical file.

2. Through CL command, Retrieve Member Description (RTVMBRD)

will give the no.of non-deleted records through NBRCURRCD

variable.

 165 views

3⟩ 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.

Synatax:

OVRDBF FILE(file-name) POSITION(*RRN 11)

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.

 190 views

9⟩ 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

index.

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.

 192 views

11⟩ 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

object.

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.

 165 views

15⟩ 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.

 171 views

17⟩ 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

database file. NO VALUE RETRIEVED IN NO CRITERIA MATCH. It

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

otherwise.

 167 views

20⟩ 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.

 184 views