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 |
Write a program to display prime numbers between 1 to 100 using RPGLE.
can i use unique key in LF
How to update selected fields from pf without using update opcode. How to read all member in Rpg-3,without using any cl command?
Set on command is used for closed all opened files , initialize var and release resource , return cmd is used for return to calling program but my req. Is dnt close opened files and resource must released while doing transactions , how can i do this...?
Anybody can explain the difference between SFLCLR & SFLINZ?
Hi,Please give me complete code with this logic. The question is how to read the records from a file with load an array of size with error condition? (The logic is Z-Add 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN9 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO)please give me complete code with explanation?
thanks mr.Harshad R Suryawaunshi,i'm new to as400 i think you are telling in rpgile i know only rpg400 if possible can you tell in rpg400
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?
In how many ways a session/device error occurs,,, and what is the remedy for it?
How to print output from openquery in as400 ?
1.I have a Physical file with 100 records, No duplicates exists, all are Unique,But while i am running Runqry utility i am getting only 80 records..What could be the reason?
parameters cannot be passed in which one??