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

1.How you will find the program is batch or online in cl pgm? 2.How you will end the batch pgm when the job runs? write an logic? 3.In wich command the option *drop is used?

2 Answers   TCS,


what will happen two jobs have same name are submitted

5 Answers   CTS,


CAN WE READ RECORDS WITHOUT USING SETLL,READ,CHAIN IN RPG?

6 Answers   Satyam,


what is file identifier wher we can use

1 Answers   IBM,


How to read a record from file where there is multiple record occurrence is available?

1 Answers  






write an RPG program to calculate the marks of 5 students (A,B, C, D, E)in 3 different subjects (eng, math, sci) an display on the screen

0 Answers  


what is the difference between SETON RT & RETURN?

5 Answers  


What is the difference between ITER and DO ? I know both are used to execute set of statements repeatedly, but what is the main difference?

2 Answers   CGI, Wipro,


I have a Physical File name 'File1', which is present in two libraries named 'LIB1' & 'LIB2'. These 2 libraries are listed in the library list. Would like to access data from this file from these two libraries using RPG program. How to do this, any idea?

4 Answers  


If there are 1000 member(PGM type) in a SRC file. How can we compile in a CL program? ( It need to be done in a loop)?

1 Answers  


How to identify the object has compiled with the debug view as *source without using STRDBG?

6 Answers  


Hi guys, anybody know How RPG/400 code can be converted to RPG IV code with a single command?

1 Answers  


Categories