IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

cobol pgm for indexed files fetching eqal interval of record


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
senthilkumarse
Warnings : 1

New User


Joined: 16 Sep 2005
Posts: 7

PostPosted: Mon Feb 06, 2006 5:40 pm
Reply with quote

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
View user's profile Send private message
nuthan

Active User


Joined: 26 Sep 2005
Posts: 146
Location: Bangalore

PostPosted: Mon Feb 06, 2006 6:19 pm
Reply with quote

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
View user's profile Send private message
senthilkumarse
Warnings : 1

New User


Joined: 16 Sep 2005
Posts: 7

PostPosted: Tue Feb 07, 2006 3:58 pm
Reply with quote

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
View user's profile Send private message
srinathangya

New User


Joined: 19 Dec 2005
Posts: 77

PostPosted: Wed Feb 08, 2006 5:54 pm
Reply with quote

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
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts How to split large record length file... DFSORT/ICETOOL 10
No new posts Replace each space in cobol string wi... COBOL Programming 3
No new posts COBOL -Linkage Section-Case Sensitive COBOL Programming 1
No new posts SFTP Issue - destination file record ... All Other Mainframe Topics 2
No new posts Write line by line from two files DFSORT/ICETOOL 7
Search our Forums:

Back to Top