Page 1 of 1

Cobol interview question.

Posted: Tue Jun 10, 2014 2:18 pm
by Barbie Girl
Hi

Interviewer said, suppose there is a sequential file with millions of records, used as i/p. When a job uses this file and due to some data problem the job abends. How can you find out which particular record is the culprit?

My answer was:

I would first look at the abend description then from the compile listing of the program,I will search for the particular verb that has caused problem. Will basically get offset of the instruction. Based on the result of the above I would view the file with its copy book for the location of the particular field using filel-aid, for example the location of the field is 45: Field-Name 45 EQ ' '

Which would get the records that match the value.With an assumption that the field value should not be space.

Please help if it's correct or there are better ways of doing it.

Re: Cobol interview question.

Posted: Tue Jun 10, 2014 3:01 pm
by William Collins
You're answering a different question to the one asked.

Make yourself a little program, which reads a file. Set up the program so it abends on the 10th read (or any number of your choice). Look at the formatted dump to see where you can find it telling you that 10 records were read.

Re: Cobol interview question.

Posted: Thu Jan 01, 2015 1:18 pm
by Barbie Girl
Thanks William. I cold not come back. But I don't find myself intelligent enough that I can read the dump the way you tell. Is this the only way to solve it?

Re: Cobol interview question.

Posted: Thu Jan 01, 2015 9:58 pm
by Robert Sample
If there is a dump produced with the ABEND, a section of the dump will list the open files as well as the current record for each.

Also, if the program counts the records read, the dump will include the WORKING-STORAGE and hence you can find the record count in the program data.