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 are the different rules for performing sort operation?
What is perform what is varying?
Write a program that uses move corresponding.
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?
System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..
How to get the last record in vsam file in cluster? And how can you get the ksds file records into your cobol program?
What are the different data types in cobol?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
what is the difference between COBOL2 AND COBOL390?
How do you reference the fixed block file formats from cobol programs
how to access the file from prodution from changeman tool and to submit a file to production
I have one ps file in which there are 3 fileds emp_no,emp_name and leave_app.this ps file information give the detail of employee which is going to apply for leave.suppose emp_no=113430,emp_name=ajay,leave_app=1 that means he is going to apply for 1 day leave.and accordingling the table in db2 will be updated means if he has that no of leave in his account then he will get dat leave and updated acc. in table(leave_balance=previous leave present in table-leave_app).Now i want to check whther the updated result is correct or not by comparing the two ps file using IEBCOMPARE or icetool so what is going to be the two ps file and how its is going to be compare.
Program A (Normal COBBAT) calling a B Program (DB2COBOL, COBBATDB which is using a VSAM file. its a dynamic call. How we will handle VSAM file decleration in our from JCL from where we are running A PGM. And should we have PLAN for A pGM also. if possible can some one post a sample JCL. Thanks for help in advance.
What is the difference between external and global variables in COBOL?
What is the difference between goback, stop run and exit program in cobol?