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

Answer Posted / mobi and remya

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.

Is This Answer Correct ?    16 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the cobol coding sheets?

848


How to find out the closest prime number of an input number? I believe it has something to do with SEARCH and COBOL Linear Array.

3933


What is the local-storage section?

871


1.give the details about WHEN OTHER. 2. how many form are available in evaluate.

1837


Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?

891






how do you reference the fixed unblock file formats from cobol programs

912


Define cobol?

1058


Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?

834


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

817


What rules are followed by the search verb.

813


Why did you choose to work with ibm mainframe cobol programming?

829


What is the Purpose of Pointer in the string?

810


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

894


What are the pertinent COBOL commands?

2816


what happens if parmparameter passes zero bytes to the program

1857