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 / mailid
1.Read the file sequentially
2.For every successful read, move the key field to temp variable
3.when EOF is reached, A separate section should be performed in which Key field should not be moved to temp variable, Now, the temp variable will have key of the previously read record.
Using this, we can do a keyed read on the file to fetch the last but one record.
| Is This Answer Correct ? | 5 Yes | 6 No |
Post New Answer View All Answers
How do we get current date from system with century in COBOL?
how do you reference the esds vsam file formats from cobol programs
I have program P1 which calls file F1 which has 100 records and following structure 001 .................. 002 .................. 003 .................. 098 .................... 099 ................... 100 .................... Now I want to read these files and write these records in file F2 in following manner. 001 ...... 051 ..... 002 ...... 052 ..... 003 ...... 053 ..... .......... ....... .......... ....... .......... ....... 048 ........ 098 ...... 049 .......... 099 ....... 050 .... 100 ......
What are the different open modes available in cobol?
What kind of error is trapped by on size error option?
Can we change the password using ALTER? anyone tried and changed?
Explain what you understand by passing by value.
Why would you use find and get rather than to obtain?
Is it possible that the redefines clause has different picture clauses compared to the one it redefined?
Why occurs cannot be used in 01 level in COBOL?
State the various causes of s0c1, s0c5 and s0c7.
What is the difference between Call and a Link?
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
i want a program using by if, evaluate , string, unstring, perform, occurs?
What the difference is between continue and next sentence?