How can read PF in reverse order (end to start) in CL pgm..
Answers were Sorted based on User's Feedback
Answer / shyam
Use OVRDBF Share(*yes)
Use the Openqry file by specified the values on opnqry file
Key field . . . . . . . . . . *NONE
Key field order . . . . . . . *DESCEND
now read file using RCVF command.
| Is This Answer Correct ? | 26 Yes | 11 No |
Answer / kavitha
POSDBF (*END) points to last record, wont the RCVF command sets on EOF indicator?
| Is This Answer Correct ? | 11 Yes | 7 No |
Answer / 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 |
Answer / sumit gupta
We can not read a pf in reverse order in CL/CLLE. As POSDBF
only set the pointer to *START or *END and once you set it
to *END and then do the read operation, end of file will
reach and there is not such condition(MONMSG) through which
you can read the pf in reverse order.
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.
| Is This Answer Correct ? | 9 Yes | 7 No |
Answer / suresh
Since the requirement is to Read from end to start, the
parameter *END should be provided to Position.
The statement should look like:
POSDBF OPNID(file name) position(*END)
| Is This Answer Correct ? | 16 Yes | 15 No |
Answer / amit
See Opnqryf is the right answer. Use the keyfield as told
by others. But it is not necessary to overide the file.
| Is This Answer Correct ? | 0 Yes | 0 No |
How to select highest score of each subject or how to select highest income of every month?
in which journalling which attributes are necessary??/
how we create binder member for updating service program and where we type this code on command line or in program ? strpgmexp pgmlvl(*current) export symbol (xyz0 endpgmexp. plz explain me this step by step .
what is importance of 'MAPFLD' IN OPNQRYF FILE ?
What is the purpose of PUTOVR keyword?
Have a join logical file with more than one members with different record formats. So how can we read the different members from this file and also how we can read the different record format from the join logical?
what is an online rpg?
how we retrieve records without using key field (ex:name) from Physical File through RPG in as/400?
How can you delete records form a file in rpg without using "Delete" OPCODE?
Hi,This is raju.Can any body give me the real experience answer for this question? 1.What is the significance of *MAP and *DROP in the CPY command?
What is I90(Insure 90)?
how does the rpg element work?