1. I have2 records in a PF.
READ PF
DO
DSPLY EMPNO
RETRN
DSPLY EMPNO
ENDDO
What was the output
2. SETON LR vs RETURN
3. Primary File
4. How to delete a deleted spaces
5. How to read a PF in reverse order in CL
6. I have a object in Lib A, B and C. But it shows in D
Lib..Why?
7.

Answers were Sorted based on User's Feedback



1. I have2 records in a PF. READ PF DO DSPLY EMPNO RETRN DSPLY EMPNO ENDDO What ..

Answer / venkatesh p

1A: system will display the first record data and will exit
the program and when ever you recall that program 2nd time
from the same session then system will display the second
record data and subsequent calls from the same screen will
display the second record data only.

2A: SETONLR will close the files and then close the program
and exit the program but RETURN will remain open the opened
file and exit the program with out closing the files.

3A: Once if you define the file as primary file then system
will seuqnetial read the all the recods in that program and
then only it will exit the program, if you use the primary
file alone ina program you need to use the SETONLR because
system it self will close the file once it reaches the EOF.

4A: deleting the deleted space in the sense we are trying
reuse the space of deleted records for that we can it using
the command called "Reorganize Physical File Mbr (RGZPFM)".

5A: we can use the OVRDBF & POSDBF commands in CL

Is This Answer Correct ?    8 Yes 0 No

1. I have2 records in a PF. READ PF DO DSPLY EMPNO RETRN DSPLY EMPNO ENDDO What ..

Answer / venkatesh p

Once RETURN excute then system exit the program, second
DSPLY will never excute, in first DSPLY EMPNO system will
show the first record value.

Is This Answer Correct ?    1 Yes 0 No

1. I have2 records in a PF. READ PF DO DSPLY EMPNO RETRN DSPLY EMPNO ENDDO What ..

Answer / jai

thanks Venkatesh.But one thing in 1 ques..

1. What was the output on both DSPLY EMPNO.
2. Whether after RETRN the DSPLY statement will execute or Not?
3. If its execute after RETRN, What was the Output on 2nd
DSPLY EMPNO

Is This Answer Correct ?    0 Yes 0 No

1. I have2 records in a PF. READ PF DO DSPLY EMPNO RETRN DSPLY EMPNO ENDDO What ..

Answer / srikanth

After executing RETURN statement, any statements next to RETURN will also be executed. In the above code program will display two records. When you call same program again from same session next two records will be displayed. If program is coded with LR indicator, next call of same program will also display same first two records.

Is This Answer Correct ?    0 Yes 4 No

Post New Answer

More RPG400 Interview Questions

I have 1000 records in a file. I would like to generate 10 identical reports from this record with same format (structure of records) how do I do this?

1 Answers   IBM,


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

1 Answers   IBM, NTT Data,


how can we can we the data decimal error?how can we open such file in support

1 Answers  


1.What is referential Integrity? 2.What is Foreign Key? 3.What is Transfer Control? 4.What is Free format?

3 Answers  


HI, 1: WHAT IS THE FUNCTION OF %KDS?WITH PROGRAMMING CODES EXAMPLE 2: WHAT IS THE FUNCTION OF Z-ADD AND Z-SUB ? WITH PROGRAMMING CODES EXAMPLE

1 Answers   IBM,






what is post opcode do

1 Answers   CTS,


One of the job in subsystem is in Running status,expected time to complete this job is 2 minutes. But from last 5 -10 minutes this job is still in running status....What are the possible reasons...and What are the actions i need to perform to check this...?

4 Answers  


if there is pf in two libraries and there is a logical file based on the PF, how to find the pf on which the pf is based.

2 Answers   TCS,


Difference between RESET and CLEAR

1 Answers   TCS,


In RPG program one file using as a PRIMARY file while running program some of the records reading twice any body know why its happening

2 Answers  


what is use of sflnxtchg and use of MDT(modify data tag).both r same r not and can we use these on dspf and subfile.

2 Answers  


we are sending data of physical file to screen design and it is showing no record why?

1 Answers   NTT Data,


Categories