View previous topic :: View next topic
|
Author |
Message |
senthilkumarse Warnings : 1 New User
Joined: 16 Sep 2005 Posts: 7
|
|
|
|
hello dear friends,
In one of my interview they asked the following question ,i dont no that anyone can give me some clear ideas with bobol program
"ASSUME THAT WE R HAVING SOME 100 RECORDS(NOT NUMBERS ASSUME WE R HAVING EMPLOYEE DETAILS FROM THAT ) WE WANT TO FETCH THE RECORD WITH EQUAL INTERVALS OF RECORDS FOR EXAMPLE 5TH , 10TH ,15TH, 20TH LIKE THAT" AND TO WRITE IN ANOTHER FILE
CAN ANY ONE HELP ME FOR THIS
THANKS AND REGARDS
SENTHILKUMAR |
|
Back to top |
|
|
nuthan
Active User
Joined: 26 Sep 2005 Posts: 146 Location: Bangalore
|
|
|
|
Hi,
Use count while reading. incriment the count in each read. once it reach 5, 10, 15..... like that write that particular record in output file.
MOVE 1 TO COUNT.
PERFORM READ-PARA UNTIL EOF= 'Y'.
READ-PARA.
READ FILE1 AT END MOVE 'Y' TO EOF GO TO CLOSE-PARA.
IF COUNT = 5
MOVE REC1 TO OUTREC
WRITE OUTREC
MOVE 0 TO COUNT
END-IF.
ADD 1 TO COUNT.
CLOSE PARA.
CLOSE FILE1,OUTFILE.
STOP RUN. |
|
Back to top |
|
|
senthilkumarse Warnings : 1 New User
Joined: 16 Sep 2005 Posts: 7
|
|
|
|
HAI NATHAN ,
I TRYED USING COUNT BUT ITHE PGM IS GOING ON LOOP , I CANT SOLVE THAT PROBLEM CAN U CLEARLY MAIL THE FULL PGM |
|
Back to top |
|
|
srinathangya
New User
Joined: 19 Dec 2005 Posts: 77
|
|
|
|
Hi Senthil..
Let me know if they were talking of Sequential file or Indexed file.. If it is Indexed file, we will be having a Key with which we can directly point to the records and read them and throw them out..
thats it..
Srinath. |
|
Back to top |
|
|
|