IBM RPG400 Interview Preparation Guide

IBM RPG400 frequently Asked Questions by expert members with experience in IBM RPG400. So get preparation for the IBM RPG400 job interview
Tweet Share WhatsApp

20 IBM RPG400 Questions and Answers:

1 :: What is importance of MAPFLD IN OPNQRYF FILE?

Specifies the definition of query fields that are
mapped or derived from other fields. MAPFLD is generally
not needed if the field names specified on other parameters
are simple field names that exist in only one of the file,
member, and record format elements specified for the File
specifications (FILE) parameter.

Up to 50 mapped field definitions can be specified.
Download IBM RPG400 PDF Read All 20 IBM RPG400 Questions

2 :: How can we know running job is batch or interactive?

From a CL program you can do a RTVJOBA command, if the job
type value is 0 then batch job, if 1 then interactive job.
Can take a WRKSMBJOB and see the value in TYPe field. If
*INT then it is interactive, If *BCH,then batch job.

3 :: Need a sql query: retrieve all duplicate records in table?

let us assume we have some duplicate records in sample table
and we can identify duplicates with eid.

The the query looks like this.

Select * from sample
where eid=any
(select eid from sample having count(eid)>1 group by eid);

Note: This should be used SQl .. but i never tried in as400
when ever it is necessary means i use following sql
statement in as400 .......

select * from sample where eid=111

it displays all duplicate records related to 111

4 :: WHAT IS MENT BY RECORD LEVEL IDENTIFIER?
WHAT IS THE PURPOSE OF THIS?

Record level Identifier gives the information about the
specific record format in the file. This can be used to
make sure that the record format of the file is same at
present as it was when the program was compiled.This will
protect the program from going into error due to changes
made to the record format after the compilation of the
program.The system tells the program, when it tries to open
the file, that a significant change occurred to the
definition of the file since the last time the program was
compiled.

7 :: Assume my file has 100 records and I want to see only first 10 records. Is this possible through LF?

Based on RRN number we can retrieve the first 10 records
or otherwise copy the first 10 records using CPYF command
and you can use RUNQRY for new created file

9 :: What is difference between Bind by copy and bind by reference?

bind by copy: here module will static
bind by reference: here module will be dynamic.