View previous topic :: View next topic |
Author |
Message |
kappurajesh Beginner
Joined: 29 Mar 2004 Posts: 19 Topics: 13 Location: India
|
Posted: Mon Apr 26, 2004 9:49 am Post subject: Total Number of records in Files |
|
|
How to get the total number of records in Cobol Files (Sequential or relative or indexed) |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
|
Back to top |
|
 |
slade Intermediate
Joined: 07 Feb 2003 Posts: 266 Topics: 1 Location: Edison, NJ USA
|
Posted: Tue Apr 27, 2004 11:23 am Post subject: |
|
|
Hi Kolusu,
Looks like he answered your ques in the 1st thread you cited. Or don't you believe him?
Regards, Jack. |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12382 Topics: 75 Location: San Jose
|
Posted: Tue Apr 27, 2004 3:02 pm Post subject: |
|
|
Slade,
Quote: |
Looks like he answered your ques in the 1st thread you cited. Or don't you believe him?
|
I did not visit this topic today . It is not that I don't beleive him , it is just that I lost interest in answering the questions after that incident. well I will take stab at this question.
Rajesh,
I want to make it clear that there is no command in cobol where you can get the total no: of records in a file. However there are many ways to get the total no: of records.
But If you want to get it via a cobol program , then the simplest way is to read all the records incrementing the counter till the end of file.
Code: |
01 TOTAL-INPUT-RECS PIC +9(09) VALUE ZEROES.
01 S-EOF-IN1 PIC X(01) VALUE 'N'.
PROCEDURE DIVISION.
OPEN INPUT IN1-FILE
PERFORM READ-IN1-FILE UNTIL S-EOF-IN1 = 'Y'
CLOSE IN1-FILE
DISPLAY 'THE TOTAL NO: OF RECORDS IN THE FILE: ' TOTAL-INPUT-RECS
GOBACK
.
READ-IN1-FILE.
*************************************************************
*THIS PARAGRAPH READS THE IN1-FILE *
*************************************************************
READ IN1-FILE
NOT AT END
ADD +1 TO TOTAL-INPUT-RECS
AT END
MOVE 'Y' TO S-EOF-IN1
END-READ
.
|
Hope this helps....
Cheers
Kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Maton_Man Beginner

Joined: 30 Jan 2004 Posts: 123 Topics: 0
|
Posted: Tue Apr 27, 2004 6:27 pm Post subject: |
|
|
I don't see why we should be helping people get jobs and sit exams that they clearly don't have the knowledge to get or sit themselves!!! Answering other people's interview/exam questions is effectively helping them to cheat. You may be giving an inferior person a chance at landing a job or qualification over better qualified people.
I thought these forums were for us to help our mainframe peers solve problems which aren't already documented somewhere (either in manuals or in the forums), not just answer simple technical questions from students and opportunistic job seekers that are readily answered in technical manuals. _________________ My opinions are exactly that. |
|
Back to top |
|
 |
|
|