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
When it is desirable to describe files Internally?
Set on command is used for closed all opened files , initialize var and release resource , return cmd is used for return to calling program but my req. Is dnt close opened files and resource must released while doing transactions , how can i do this...?
How to write record if no field or the field are different in physical file in rpgle ?
Interviewer asked me write down DDS for load all subfile .can anybody write dds
What is file identifier where we can use?
how can I tell when to replace the array?
during execution, an rpg/400 program automatically follows a sequence of operations for each record that is processed. The built-in program cycle includes the following logical steps.
How to handle duplicate error handling in RPG?
how can you display specific subfile page on the screen in unequal subfile?
what is kids-rpg?
explain sflclr, sflend, sfldlt, and sflcsrrrn?
how do you use commitment control in rpg?
What is the purpose of record level identifier?
Please tell me how to read the records from a file with load an array of size with error conditions(The logic answer for this question is ARR is array of 99 elements Z-ADD 0 IDX *LOVAL SETLL FILE READ FILE 99 *IN99 DOWEQ *OFF IDX ANDLT 99 ADD 1 IDX MOVE FIELD ARR,IDX READ FILE 99 ENDDO).So,Please give me the complete of this code.
Program to read marks of 10 students for 4 subjects and compute and display total marks and status of each student in rpg