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 |
Hi all friend, Could Any body send me the code (with coding) of this senario because I have tried but I am stucking somewhere so Please reply ASAp with coding. senario:Q: I have to write the flat file(FLAT1) into the three different PFS (PF1,PF2 and PF3) with the respect of H line data, D line data and Z line data of flat file. where I have different data in flat file(FLAT1) which is mentioned below with data. H0929200909282009092820095529420003000073 D2222220006765555webservi001633.9909222009092820090924200951 8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA 224080000USA840840001633.99001633.99851856492689800208001915 511001633.990408490000000.0000000003446048 1,3 110793145 09070700351 372367 Rosner Motors D3333320006774444webservi000271.2409222009092820090924200951 8564380134049ROSNER TOYOTA OF FREDE FREDERICKSBURVA 224080000USA840840000271.24000271.24851856492689800208001835 511000271.240930680000000.0000000003450293 1 110793254 09072100079 373933 Rosner Motors Z0929200900000020001905.25 FLAT1 has the three pf data H line-represents the header pf data,D-Represent Details pf data,Z-Represents the trailer pf data Now I have to write H line data of flat file into Header pf (PF1),D line data of flat into datails pf(PF2) and Z line data of flat file into pf(PF3) with the spefic position(H,D and Z data of flat file into PF1, PF2 and PF3) of flat file.
Anyone help me for the below question:- If problem/error occur in *PSSR subroutine,how should I handel it in RPG program.
which MONMSG will give higher priority in CL program? I know MONMSG are of two types. Program Level Monmsg and Command Monmsg?
I have to change a program. This program is calling a subroutine mor than 100times within it. so will it have any performance issue? if yes than what changes i can make. Thanx for ur valuable answer.
Suppose we have one database file and it is used by 5 programs and in 3 program we have to add some records in datbase file s what is the impact on other program?
How can we know running job is batch or interactive?
How to handle duplicate error handling in RPG?
I know chain keyword retreive records randomly but how chain keyword exactly works internally????
How we will read call stack?
How can a screen field that has changed since the last output operation be detected?
can we use cl programming to update or delete physical files
If the last record of a file has been read, and the next operation on that file is a READ operation, what will be the values of the input fields for that file? A. They will be blank and/or zero. B. They will be null. C. They will equal the values of the first record in the file. D. They will equal the values of the last record read.