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


Please Help Members By Posting Answers For Below Questions

1.Is it possible to move the data from 99.99 to 99v99? 2.What is the CICS-vsam Compilation process? 3.In My GDG 5 generation will be there GDG3 got an abend what will happen? 4.In my GDG first generation is +1 And I want to add the new generation what will happen previous generation? 5.How can you give the PIC clause below conditions A). s9 (reddy), B). s9 (5) occurs 5 times? 6.How override the proc from a particular step? and what is symbolic and override Procs?

5599


What guidelines should be followed to write a structured cobol prgm?

867


if we display var1 then what will b displayed in below condition. 77 var1 pic s9(2) value -10. 77 var1 pic s9(2) value -11. " " " -12. " " " -13. -14 ... ... -19.

6096


How to know whether the module is dynamical or statistical?

872


For rewrite, why is it mandatory that file needs to be opened?

845


how do you reference the variable unblock file formats from cobol programs

1010


What happens when we move a comp-3 field to an edited (say z (9). Zz-)?

1033


How do get the result of your program directly on your pc?

2076


What do you understand by psb and acb?

846


how can we apply for HSBC exam(Mainframe) in India??? i went to their site and was told to submit my CV ,. etc..( totally confusing...)

2143


what are decleratives in cobol?

2002


In COBOL programming, what is PERFORM? What is VARYING?

874


How you can characterize tables in cobol?

927


how can i see junk values in dclgen or in hostvariable of comp ?

2754


Are you comfortable in cobol or jcl?

807