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 fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
Difference between cobol and cobol-ii?
How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that
What is length is cobol?
How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?
Explain how you can characterize tables in cobol?
What kind of error is trapped by on size error option?
How to remove 2 duplicate records and copy only one using job control language?
) how do u code after getting data?
Differentiate between structured cobol programming and object-oriented cobol programming.
How are the next sentence and continue different from each other?
What is amode(31)
what is the difference between COBOL2 AND COBOL390?
A table has two indexes defined. Which one will be used by the SEARCH?
What are INPUT PROCEDURE and OUTPUT PROCEDURE?