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
What are the cobol coding sheets?
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.
What is the local-storage section?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?
how do you reference the fixed unblock file formats from cobol programs
Define cobol?
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)?
What is an in line perform? When would you use it? Anything else you wish to say about it.
What rules are followed by the search verb.
Why did you choose to work with ibm mainframe cobol programming?
What is the Purpose of Pointer in the string?
What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?
What are the pertinent COBOL commands?
what happens if parmparameter passes zero bytes to the program