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
Can you please let me know the centre name of INS certification in Kolkata.
What is difference between static and dynamic call in cobol?
What are the pertinent COBOL commands?
Write a program that uses move corresponding.
How can we find that module can be called – whether DYNAMICALLY or STATICALLY?
How do u write test cases?
What is link edit in cobol?
Explain the configuration section of a cobol program with examples of syntax.
How do get the result of your program directly on your pc?
what is search and searchall?what is the diffrence between them?give an best example?
How do you code cobol to access a parameter that has been defined in jcl? And do you code the parm parameter on the exec line in jcl?
How do you reference the following file formats from cobol programs?
) How do u handle errors in BMS macro?
What is Pic 9v99 Indicates in COBOL?
INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?