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
Whats the difference between search & search ALL?
What are the different rules of SORT operation?
what is difference between cobol and cobol/400
How to change size of Initial number of records to *NOMAX for ALL PF files from perticular library, how can I do that
What guidelines should be followed to write a structured cobol prgm?
what is amode(24), amode(31), rmode(24) and rmode(any)?
What is the difference between external and global variables in COBOL?
Explain the configuration section of a cobol program with examples of syntax.
input 1 input2 ouput1 output2 output 3 1 re 300 1 re 200 1 re 300 3 rc 500 1 re 200 2 rr 400 1 re 300 2 rr 400 1 rc 400 3 rc 500 1 rc 400 2 rr 700 2 rr 700 5 tt 900 5 tt 900 2 inputs r in flat file and output 1 is matched records,ouptput2 is unmatched of input1,output3 is unmatched of input2! how vl u get the output files using sequential order and to check with each and every records! let me know the procedure division ?
What is the difference between PIC 9.99 and PIC9v99?
Write some characteristics of cobol as means of business language.
Write a cobol program making use of the redefine clause.
What is static and dynamic call in cobol?
How do you reference the following file formats from cobol programs?
What are the various section in data division and briefly explain them.