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
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts XML Parse for COBOL 5.2 Bhanu Praveen COBOL Programming 1 Sat Jul 08, 2017 8:58 pm
No new posts Dynamic output file creation in cobol... smileheal COBOL Programming 7 Thu Jun 15, 2017 10:53 pm
No new posts Search utility(3.14) using JCl and Cobol RKS3 COBOL Programming 12 Sat Jun 10, 2017 10:24 pm
No new posts Need to write record of PS File in ex... Chandan1993 JCL & VSAM 1 Wed Jun 07, 2017 1:35 am


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