I have file with data as follows
data
1
2
3
4
5
I need to read 1 and 5 ,then 2 and 4 then like..
upto end of file, can any one help on this
Answer Posted / vj
1. Find the greatest RRN of the file
2. Have 2 numeric counters.
3. Initialize counter1 to 1
4. Initialize counter2 to the max RRN
5. Chain with counter1 and read the record
6. Chain with Counter2 and read the record
7. Increment counter1
8. Decrement Counter2
9. Repeat Steps 5 to 8 in loop unitl counter 1 = Counter 2
(when counter 1=counter 2) we would have reached the middle of the file
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
what is kids-rpg?
How many program bind in one module....
What is the purpose of record level identifier?
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?
if there is a module object , how to find the program object for this module object.Assume the module object name and program object name is not same.
What is a record lock error?
What is difference between bind by copy and bind by reference?
When it is desirable to describe files Internally?
are there any useful c runtime apis that I can call from rpg iv?
what is the procedure and explain about real time scenario.
what are the key words you must use when using a subfile?
1. What is bound-by-call and bound-by-reference? 2. Where and why is *Nomain used? 3. What are the difficulties faced by programmers when using service programs? 4. Explain the different ways of parsing and compiling XML in iSeries.
what is the rpg system?
What is the difference between copybooks and subprocedures in as400?
can I touch the array during treatments?