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

i want a program using by if, evaluate , string, unstring, perform, occurs?

4067


) How do u handle errors in BMS macro?

1431


Explain how you can characterize tables in cobol?

644


Have you used the sort in your project?for this type of questions any working on real time project give the eg. with real time scenario.

2062


i was faced one question- i have value -00001234.56 Suppress the zeroes and the output should be -1234.56 But Not - 1234.56 spaces should not be available after suppressing the zeroes. logic in jcl and cobol?

897






Write down the divisions of cobol program?

673


What is the LINKAGE SECTION used in COBOL?

895


Give some examples of command terminators?

761


How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?

650


how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)

1933


Define static linking and dynamic linking.

669


Difference between cobol and cobol-ii?

715


How do u write test cases?

1642


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

631


how do you reference the ksds vsam file formats from cobol programs

669