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
How to know whether the module is dynamical or statistical?
IF I mention stop run in CICS what happens?
Explain what you understand by passing by value.
What is inspect in cobol ?
What is the difference between PIC 9.99 and 9v99 in COBOL?
how to move the records from file to array table. give with code example
What is the usage of comp fields in cobol?
Describe the cobol database components?
Discuss about changing dataset name in proc.
Are you comfortable in cobol or jcl?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
Which is the default, TEST BEFORE or TEST AFTER for a PERFORM statement?
if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.
What guidelines should be followed to write a structured cobol prgm?
How can you get the ksds file records into your cobol program?