i have a file with the values 10, 20, 30, 40, if am setll with
the value 25 then readp, so what it will return?

Answers were Sorted based on User's Feedback



i have a file with the values 10, 20, 30, 40, if am setll with the value 25 then readp, so what it..

Answer / kumar

The Answer is 20.
This is the code I tried and the answer is 20

 FEmpLF1    if   E           K Disk                   
 c                   move      25            EMPID    
 C     EMPID         SETLL     Emprec                 
 C                   READp     Emprec                 
 C     *IN80         IFEQ      *OFF                   
 C     EMPID         DSPLY                            
 c                   endif                            
 c                   eval      *INLR = *ON            

Is This Answer Correct ?    8 Yes 0 No

i have a file with the values 10, 20, 30, 40, if am setll with the value 25 then readp, so what it..

Answer / sachin14muthu

Yep Shishir, you are correct. i have tried with the program...

Is This Answer Correct ?    3 Yes 0 No

i have a file with the values 10, 20, 30, 40, if am setll with the value 25 then readp, so what it..

Answer / venkat

SETLL always looks for Equal or Greater value.
in the given entries we don't have 25 so it points to the greater to 25 record which was 30.
here we are using READP so the answer is 20

Is This Answer Correct ?    1 Yes 0 No

i have a file with the values 10, 20, 30, 40, if am setll with the value 25 then readp, so what it..

Answer / thakur

Ladies, don't fight.

Answer is simple:-
If you do setll with 25 and then READP ,program will read last record as SETLL sets pointer using RRN and not field value.

For eg:- To retrieve 2nd record , you have to set pointer at 3rd record and then READP.

Is This Answer Correct ?    1 Yes 3 No

i have a file with the values 10, 20, 30, 40, if am setll with the value 25 then readp, so what it..

Answer / shishir

DEAR ITS REALLY SIMPLE U SHOULD TRY IT ON YOUR OWN:
SUPPOSE EMPNO FIELD IS KEY FIELD OF FILE HAVING RECORD :10,20,30,40
SO WAT HAPPEN READP READ PREVIOUS RECORD AND SETLL SEARCHING DATA THROUGH KEYFIELD
SO AFTER READING RECORD 20 IT GOES TO 30 BUT WE ARE SEARCHING FOR 25 WHICH IS NOT PRESENT SO IT WILL RETURN 20 AND OUTPUT
MEANS IF FIELD HAVING DATA LIKE : 10,20,24,30,40
THEN IN THIS TIME OUTPUT WILL ME 24 OK BYE T.C

Is This Answer Correct ?    6 Yes 9 No

i have a file with the values 10, 20, 30, 40, if am setll with the value 25 then readp, so what it..

Answer / ardeep

If the SETLL operation is not successful (no records found condition), the file is positioned to the end of the file.

10 20 30 40

So when 25 is searched the pointer goes to 40.

And now when READP (Read Previous) is issued it fetches
30.

Answer is 30.


Have Fun :) !!

Is This Answer Correct ?    5 Yes 22 No

Post New Answer

More RPG400 Interview Questions

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,


What are the values of NUM1 and NUM2 after executing the following code? CLONO1NO2NO3 Factorl÷÷+OpcdeFactor2+÷+ResultLenDHHiLoEq C MOVE *LOVAL NUM1 50 C MOVE *J-fIVAL NtJM2 52

2 Answers   Fiserv, IBM,


Suppose I have 3 jobs a b and c. I want to submit b after successful completion of a and want to submit c after successful completion of b. Without using job scheduler or job queue, how can I do that through cl program?

1 Answers  


We have a Physical file, after reading 5 records,it has to read LF of that same Physical file,Will it start reading from Ist record or will start reading from 5th record?

5 Answers   Hexaware,


1) How to declare a file? 2) How to define a display file? 3) How to monitor error messages in RPG? 4) How to find the attributes for subfiles? and what is the DDS for subfiles?

2 Answers   TCS,






what is edit word and edit code

0 Answers   Cap Gemini,


how can an indexed file be used as arrival sequence in RPG?

3 Answers   IBM,


if i have three programs progA,progB and progC .now i call progB from progA. but the progB does not exist . now i want to call progC instead of starting dump. how can we achieve this.

10 Answers   Four soft,


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,


How do I read records from Subfile? what is the purpose of READC explain with example?

4 Answers   IBM,


difference between 1:%found and %equal built function in detail with example .

6 Answers   Polaris,


Anyone help me for the below question:- If problem/error occur in *PSSR subroutine,how should I handel it in RPG program.

1 Answers  


Categories