i have 1000 records in pf.what are all the ways to read a
particular name records in rpg?? ie.. in pf i have a name
called demo appeared around 52 times hw will we read this
particular records in rpg/400?.

Answers were Sorted based on User's Feedback



i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / deepak daswani

You can use READE opcode in dow while loop to read aal the
records of PF which is 'demo'.
Because everytime cursor reads the next value in the file.

Is This Answer Correct ?    13 Yes 1 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / bhalchandra

What u can do is u can create a non join LF over the PF and
give the Select clause for that field like this:
S FLD1 COMP(EQ 'demo')

And now u can use this LF in your program.

Is This Answer Correct ?    11 Yes 1 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / swetha p rao

If the particular field value is demo , then you can do
onething to avoid reading the file unnecesarily

1. Declare a temporary file in user open mode and specify
as external mbr in F spec.

2. In CPYF there is an option to include records (INCREL )
based on selection, just copy all the records where the
field value is 'demo' in a temporary file with a create
file option. (using QCMDEXC)

3.Now the temporary file will have only demo records.Open
the file and read the records.

(or)

Using SQLRPGLE, write a query to select the records which
has field value 'demo'


Correct me if iam wrong

Is This Answer Correct ?    4 Yes 0 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / sudhir

to escape from creating a new object of LF(if its not a
permanent requirement) you can use OPNQRYF to select
whichever records you want like:

OPNQRYF FILE((FILENAME)) QRYSLT('(FIELDNAME *EQ "demo")')

hope you got your answer

Is This Answer Correct ?    5 Yes 2 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / swetha

that wud again create an object, What if the requirement
changes evrytume.then the LF wud not be useful

Is This Answer Correct ?    1 Yes 1 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / prasanna

In the RPG code, Move the value demo to the field and do a
reade on the file

Is This Answer Correct ?    2 Yes 2 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / jeganath

Go for ReadE i.e Read Equals,

give 'Demo' in Factor 1

'Demo' ReadE

it will fetch records equals 'Demo' string in the file, and
also it avoid unnecessary reading of other records, very
effective,


Note: it works only when that field is declared as key in
PF file

Is This Answer Correct ?    0 Yes 0 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / deepika

setll keyfld pf1
reade keyfld pfl1
dou %eof

Is This Answer Correct ?    1 Yes 2 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / rajgoaj

Can it be done by using group function on a SQLRPG?

Is This Answer Correct ?    0 Yes 2 No

i have 1000 records in pf.what are all the ways to read a particular name records in rpg?? ie.. in ..

Answer / rajkalyanam

Say Physical file name is PF001 and Field name is NAME
and i want to select all records having their name as DEMO
then i will use SQLRPG,please correct me if i'm wrong

Select * from PF001 where name = 'DEMO'

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More RPG400 Interview Questions

I have a PF(ABC)with no key fields. PF(ABC)have 2 fields (cusno and cusname). Please let me know how can i read the cusno = 1150 directly from PF in CL and RPG program(Without creating the LF and without reading the complete file and then compare 1150)

3 Answers   Opus,


What is use of IMPORT and EXPORT in RPGLE ? What is activation Group ? What is Service Program ???? How to call another program in RPGLE ?

1 Answers  


1.I have a Physical file with 100 records, No duplicates exists, all are Unique,But while i am running Runqry utility i am getting only 80 records..What could be the reason?

3 Answers   Cap Gemini,


Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.

0 Answers  


How can i check the object existance in RPG program without using QCMDEXC command.

7 Answers   IBM, JDA,






there is any limit to display the members in rpg400?

3 Answers  


3 members in a databasefile .how to read records from all the members?????????

4 Answers   CTS,


How to create a login screen using a command instead of display file.... intention is to get a password field on a command..... how do you achieve this...

0 Answers  


How to write record if no field or the field are different in physical file in rpgle ?

0 Answers  


How can we receive values from a called procedure in CL?

1 Answers   IBM, NTT Data,


Hi, Can anybody give me real sinario for SFLRCDNBR?with example?

2 Answers  


i want code and what are used key words are ...like wrkmbrpdm screen (q) i have a file with 3 fields empno,empname,empaddr... here you give the empno it displays from that number to remaining empno's how? sub file screen: employee details pos to:empno then enter empno empname empaddr so file have 100 records from 1 to 100 so the above pos you give the 55 empno...it displays the from 55 to remaining... ...... please share this answel

2 Answers   IBM,


Categories