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 meant by record lock.how records are locked.what is the purpose of record lock.if records are locked what happens.how to find out which record is locked.
Anyone help me for the below question:- If problem/error occur in *PSSR subroutine,how should I handel it in RPG program.
can anybody explain significance of *loval setll with example code????
Can somebody tell me that, Is it possible to read all the member of PF without OVRDBF?
How can you delete a record from a file in RPG without using DELETE oppcode?
How can we read a particular record from the database file which is not having DDS (Flat File). For example, there are 100 records in the flat file. How can we retrive 15th record in RPG/400 program (Without using CL)
wat is scan and check ? give me real time scenarios where we used these keywords in ur projects?
How can we override a file during runtime in RPG? Without using OVRDBF or calling a CL program
Hi, I am getting the error in RPG (All Record Formats for externally-described file ABCD ignored or dropped due to error; file ignored.) Please suggest any
How do you proceed in case your active AS400 session has got disconnected suddenly, how can you get back to your session ? Is it possible??
check existence of one record without using chain or read?
1.Where we declare Variables in RPG/400,RPGIV,RPGILE.? 2.When do we use D-spec and I-spec in real time ?.what is difference between them?