Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to read the last 100 records from a COBOL file. The file
contains N number of records.

Answer Posted / bibhuti swain

PROCEDURE DIVISION.
PARA.
OPEN INPUT STUDFILE.
PERFORM PARA1 UNTIL EOF = 1.
DISPLAY 'TOTAL NO:OF RECORDS ' A.
COMPUTE B = A - 100.
MOVE 0 TO EOF.
CLOSE STUDFILE.
OPEN INPUT STUDFILE.
PERFORM PARA2 UNTIL EOF = 1.
CLOSE STUDFILE.
STOP RUN.
PARA1.
READ STUDFILE AT END MOVE 1 TO EOF.
COMPUTE A = A + 1.
PARA2.
READ STUDFILE AT END MOVE 1 TO EOF.
COMPUTE C = C + 1.
IF C >= B AND EOF NOT = 1
DISPLAY STUD-REC.
If anybody doesn't understand this logic i can explain..
In PARA2 the file is read from the beginning and the moment
the value of C reaches the value of B i.e value of C = B
and then it will satisfy the condition IF C >= B and from
there it will start displaying the records till end.

Is This Answer Correct ?    14 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is rmode(any) ?

1262


How did the release of cobol/370 version 1.3 improve the performance of release 1.1?

1083


how to refer the data field?

2270


What is redefines clause in COBOL?

1293


How do get the result of your program directly on your pc?

2340


HOw can I get the negative sign while deduct high value from low value

2255


What is an in line perform? When would you use it? Anything else you wish to say about it.

1074


What is the difference between binary search and sequential search?

1089


how to access the file from prodution from changeman tool and to submit a file to production

7547


what are decleratives in cobol?

2259


How do we get current date from system with century in COBOL?

1375


What do you understand by psb and acb?

1121


what is s000 u4087 error? please give the all error codes in cobol,jcl.

17879


i want a program using by if, evaluate , string, unstring, perform, occurs?

4722


There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.

1433