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 are declaratives and what are their uses in cobol?

1133


i have 10 names in an array and my name is one of them also array is not in sorted order i need to display my name using index how will i do this

1467


I have to write to a outfile where the number of records in that file should be the header of that file using IMS.. can anyone help me in this issue

2485


What is the compute verb? How is it used?

1076


What the difference is between continue and next sentence?

1104


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

7441


How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that

3172


1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?

5760


How can we find that module can be called – whether DYNAMICALLY or STATICALLY?

1167


how we sort two input files based on a common column and giving one o/p file please send me the coding logic?

2077


Write the code to count the sum of n natural numbers.

1143


input= ,,,, mainframe training ,,, hyderabad .... location.... output1=$ mainframe training in hyderabad location$ output2=**** mainframe training in hyderabad location ****. In this pgn when we give input considering the spaces the output is displayed in this format.Like in the place of ,,,, $ should be displayed likewise.So please helpmeout.

2159


What are literals?

1074


What is the problem of ordered sequential files access?

1109


Can you please let me know the centre name of INS certification in Kolkata.

2181