How to read alternative records in a pf by using rpg?
Answers were Sorted based on User's Feedback
Answer / uday bagdi
we can create the pre-run time array so that data-base file come in our rpg program then we read that pre-run time array with loop and increment the array indexing by 2
| Is This Answer Correct ? | 7 Yes | 0 No |
Answer / uday bagdai
1st set the pointer on the record(depend on rrn).after increase the rrn value by 2 (rrn=rrn+2).trape their on doweq loop so you can read alternative records.because (your pointer set on alternative records)
| Is This Answer Correct ? | 6 Yes | 2 No |
Answer / abhishek
The first method is not very full proof. Actually it is not
necessary that RRN is always sequential.
Suppose initally there are 100 records in a file and so
does the RRN starts from 1 for first record and 100 for
last record.
If 1 record is deleted from the file RRN remains unchaned
and in that case adding 2 may cause a problem if system
does not get Record at that RRN it will read the next
sequential.
| Is This Answer Correct ? | 4 Yes | 0 No |
Answer / sreedhar reddy
Simple way is just read a PF process 1st record, then for second read ignore it. It is simple like having two read operations, first is at start of the loop and second is at just before end of the loop.
| Is This Answer Correct ? | 1 Yes | 1 No |
Answer / mahalakshmi
All the records in a file is first loaded in to an datastructure and then incrementing the value of datastructure +2 then read the values in the datastructure.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / ramu
how to fetch alternate records from data base(pf) using RPG? (ex. 1st and 3rd and 5th .......etc)
I need Rpg code not theory?
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / krishna
sample code for alternative record in a pf
fsamplepfif e disk
/free
dow not %eof(samplepf);
read samplepf;
If %eof(samplepf);
Leave;
endif;
---------;(doing some actions based on the conditions)
read samplepf;
enddo;
*inlr = *on;
/end-free
| Is This Answer Correct ? | 1 Yes | 6 No |
how do u find whether a record is locked or not??
Hi, Can any body tell me ur experience on this questions? Questions: 1.what is the use of SFLRCDNBR other than subfile page display? 2.Which of the following operation cannot be used in conjuction with a file coded as device type disk?
Suppose we add one field in physical file and this physical file is used by several programs.how do we know which program is using that file? What are the impact analysis.
Assume 2 users are using the same file and first user updates some record in the file. Will the 2nd user will be able to see the updated record or not?
Are all these RPG/400 Interviewed Questions being asked recently? are current?
WHERE DO WE USE COMIT KEYWORD IN AN RPG PROGRAM? YOU MADE SOME CHANGES TO DATABASE BUT YOU DON'T WANT TO SAVE THOSE CHANGES NOW? HOW DO YOU HANDLE THIS ONE?
HOW TO DEBUG A BATCH JOB WHEN IT IS IN MESSAGEWAIT(MSWG) STATUS.I KNOW THE STEPS FOR BATCH DEBUGGING,BUT IM CONFUSING WITH WHEN WE SUBMIT ANY JOB FOR BATCH DEBUG WE PUT IN HELD STATE.SO HERE ALSO DO SAME THING OR ANY OTHER WAY,PLEASE HELP ME....
How can we receive values from a called procedure in CL?
suppose a job is running for 15 minutes after that it goes to message wait? what are the impact analysis
What is the difference between iter and do?
how to find whether a date format is valid or not in RPG400 not in RPGILE.Can you please write the coding for this sir,i'm new to AS400.Please help.
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.