Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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 How to select record x+7 or x+2 based... JoAnn Kulcyk SYNCSORT 6 Tue Jan 16, 2018 10:49 pm
No new posts Compare two PS files using ICE TOOL f... SENTHIL MURUGAAN DFSORT/ICETOOL 5 Sun Dec 24, 2017 1:26 pm
No new posts KSDS and Index file in cobol deepak14450 COBOL Programming 9 Fri Dec 22, 2017 9:36 am
No new posts query to fetch record which has only ... maxsubrat DB2 12 Mon Dec 11, 2017 5:03 pm
No new posts Extract record for change in combinat... Trinadh DFSORT/ICETOOL 6 Thu Nov 23, 2017 3:32 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us