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

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,


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  


There is a excel sheet having details of Old account number and new account number. I need to update these details in my AS400 files. i.e. all the records having old account number should be replaced with new account number. There can be 100 or 200 or 300 PFs...no fix files known. how can we do this?Solution should be performance oriented

3 Answers   Cap Gemini, IBM,


wat is scan and check ? give me real time scenarios where we used these keywords in ur projects?

2 Answers   Four soft,


1.what are the ARITHMETIC EXPRESSIONS IN CL PGM? 2.How to PASSING PARAMETER TO CL PGM?

1 Answers   NetCracker,


How do you find out whether a record is present in the physical file without reading the file? for Example Employee No: 100 in an Employee master.How do we find out whther 100 is present in Employee master without reading the file?

11 Answers   Bank Of America, CSC, IBM,


How many program bind in one module....

0 Answers  


what is kids-rpg?

0 Answers   IBM,


is this a rpg channel?

0 Answers   IBM,


What is the length of Signature?

3 Answers   UST,


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

1 Answers   NTT Data,


What is the difference Return and InLr?

3 Answers  


Categories