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
What is the difference between binary search and sequential search?
how do you reference the rrds file formats from cobol programs
How do we get current date from system with century in COBOL?
i made it to stage 3 of an interview process wednessday they will quiz my knowledge again face to face for an analyst role recruiter said it will be based on Business requirements system is cobol and good ideas what they might ask etc
What are literals?
What is perform what is varying?
Explain what you understand by passing by value.
When is inspect verb is used in cobol?
Differentiate cobol and cobol-ii. (Most of our programs are written in cobolii, so, it is good to know, how, this is different from cobol)?
What is the difference between Call and a Link?
) How do u handle errors in BMS macro
There are 5 fields and 1000 records in a file. Unload it into an array. Write the syntax for declaration and how will you unload it.
How do you reference the following file formats from cobol programs?
How do you reference the fixed block file formats from cobol programs
If you are current on the owner of a set, what is the difference between an obtain next and obtain first? Actually in which topic will we use dis???Plz explain it clearly