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 to print output from openquery in as400 ?
Job is in MSGW while reading the input file and writing a new record / updating a reacod due to Duplicate data error. What action would you take ( C D I R )...?
If my rpg program has a date field, what extra care I have to take while compiling that rpg program? If the file is keyed and I have declared the file as well as key list properly in my program. Still am getting an error message like "chain/reade operation is not allowed" what may be the case?
How to find d key field of a pf that doesn’t have source physical file?
can any body correct the following code? Following a procedure which returns the maximum of two numbers.Correct the following code. P GETMAX B D GETMAX PI D NUM1 35 0 D NUM2 45 0 C IF NUM1 > NUM2 C RETURN NUM1 C ELSE C RETURN NUM2 C ENDIF P GETMAX E
can I touch the array during treatments?
what is program status data structure?
parameters cannot be passed in which one??
A particular job executing on the iS is not behaving as expected and is operating in an environment in which it can be debugged. What commands would you use to debug and observe the program?
How to sort an array in descending in RPG
What hapens when we use CPYF command to copy a LF? On which PF will it be dependent???
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.