how to fetch the record before the last record in a cobol
file( its a huge file and if the key field is not known)
Answer Posted / lakshmi
1) iN WORKING STORAGE SECTION, Declare 2 variables HOLD-REC
and PRV-REC Equal to length of file and initialize them to
spaces
2) In Procedure divison, use the below logic and at the end
of the file read, PRV-REC contains the record before the
last record
READ <INFILE>
NOT AT END
MOVE HOLD-REC TO PRV-REC
MOVE INREC TO HOLD-REC
AT END
MOVE 'Y' TO EOF
END-READ
Is This Answer Correct ? | 8 Yes | 1 No |
Post New Answer View All Answers
Write the code implementing the perform … varying.
What is static and dynamic call in cobol?
EXPLAIN MAIN FRAME TESTING PROCESS...HOW TO FIX THE MAINFRAME BUGS?
How do you define a variable of comp-1 and comp-2?
How to fetch 1000 error records from VSAM file(Eg: 1000000 records present) while getting SOC7 abend ?
Difference between cobol and cobol-ii?
What are declaratives and what are their uses in cobol?
What are the different types of condition in cobol and write their forms.
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.
What are different data types in cobol?
What is perform what is varying?
System Testing for Mainframe Developers What is System Testing? integration testing ? what's the procedure ..
How do define dynamic array in cobol.
What is the difference between external and global variables in COBOL?
What is the compute verb? How is it used?