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
i want a program using by if, evaluate , string, unstring, perform, occurs?
) How do u handle errors in BMS macro?
Explain how you can characterize tables in cobol?
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.
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?
Write down the divisions of cobol program?
What is the LINKAGE SECTION used in COBOL?
Give some examples of command terminators?
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
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...)
Define static linking and dynamic linking.
Difference between cobol and cobol-ii?
How do u write test cases?
Why did you choose to work with ibm mainframe cobol programming?
how do you reference the ksds vsam file formats from cobol programs