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
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 |
Answer / sachin14muthu
Yep Shishir, you are correct. i have tried with the program...
Is This Answer Correct ? | 3 Yes | 0 No |
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 |
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 |
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 |
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 |
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?
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
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?
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?
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?
what is edit word and edit code
how can an indexed file be used as arrival sequence in RPG?
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.
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
How do I read records from Subfile? what is the purpose of READC explain with example?
difference between 1:%found and %equal built function in detail with example .
Anyone help me for the below question:- If problem/error occur in *PSSR subroutine,how should I handel it in RPG program.