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 is amode(24), amode(31), rmode(24) and rmode(any)?
1.give the details about WHEN OTHER. 2. how many form are available in evaluate.
) how do u code after getting data?
What happens when we move a comp-3 field to an edited (say z (9). Zz-)?
What are the rules of the move verb?
What is the difference between perform … with test after and perform … with test before?
how do you reference the variable unblock file formats from cobol programs
What is rmode(any) ?
Can we redefine the field of x(200) to less than 200?
What are all the divisions of a COBOL program?
How to read the 2nd last record of a VSAM file? (The file size is huge and we don't know the key)
Have you used comp and comp-3 in your project? And how?
Explain how to differentiate call by context by comparing it to other calls?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
What is the utilization of copybook in cobol? Could we utilize a similar copybook?