How can read PF in reverse order (end to start) in CL pgm..
Answer Posted / harkesh
you can read a physical file in DESENDING ORDER. You can
first sort the physical file in decending order through
OPNQRYF using KEYFLD. This will sort your PF in decending
order based on your key field and then do the RCVF on this
file.
But for this you first need to do OVRDBF on the file.
THIS IS ONLY THE WAY ON THE WE CAN READ PF IN REVERSE ORDER
BUT FOR THIS FILE SHOULD BE KEYED FILE.
ANOTHER WAY FOR THIS ON THE BASIS OF RRN. FIRST FIND OUT
TOTAL NO OF RECORD USING RTVMBRDSC COMMMAND IN CL PROGRAM.
THEN MOVE TOTAL NO TO RRN. THEN BY USING OVRDBF COMMAND SET
POINTER ON THE BASIS OF RRN. AND IN LOOP ON THE BASIS OF
RRN. LIKE
LOOP: OVERDBF FILENAME POINTER = &RRN
IF RRN NOT = 0
RCVF RCDFMTNAME.
RRN= RRN-1.
ELSE
ENDPGM
END-IF.
Is This Answer Correct ? | 5 Yes | 2 No |
Post New Answer View All Answers
When we have a file with Duplicate records and I want to read the unique record from the file. For example a file containing Emp Name as 'Ram' and there are 3 entries of it. So how to read a unique record from File?
What is the purpose of record level identifier?
Explain mdt?
what was the robotech rpg?
How to declare the pull button in AS/400..
what is the rpg system?
How to write record if no field or the field are different in physical file in rpgle ?
how do I declare a table or array in rpg iv?
how do I preserve and clean the array?
Hi Viewers can any body explain me how to update and ahange the already existed data in physical file using subfile ? please explain me with the code if possible?
What is the diff bw PF/LF Name and their Record format name? what is restriction in record format then file name?
what is file information data structure?
What is a record lock error?
Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.
How do u design a physical file, when you have 2 Unique fields like for eg in A student file student ID and student examination no both are unique