Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

cobol pgm for indexed files fetching eqal interval of record

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: cobol pgm for indexed files fetching eqal interval of record
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    Post subject: Re: cobol pgm for indexed files fetching eqal interval of re
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    Post subject: Re: cobol pgm for indexed files fetching eqal interval of re
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    Post subject: Answer to my knowledge
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Record Not found in AlX but record re... mukun264 COBOL Programming 0 Fri Mar 24, 2017 9:28 am
No new posts Count the length of the record & ... sreekusr DFSORT/ICETOOL 4 Thu Mar 23, 2017 7:52 pm
No new posts Append data from two files into a sin... Praveen04 DFSORT/ICETOOL 5 Thu Mar 16, 2017 7:29 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm
No new posts SQL query not working in Cobol program. CuriousMainframer COBOL Programming 14 Wed Feb 22, 2017 5:56 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us