Page 1 of 1

restart logic for a COBOL program doing some file operations?

Posted: Fri Nov 10, 2017 9:19 am
by Binamra
Hi,

Could someone explain me the program/job restart logic for a COBOL program doing some file operations?

Note: This is not COBOL-DB2 restart logic. It's COBOL restart logic which does not involve DB2. Say for ex: a COBOL program reading input file, dropping few records, writing records to 2 output files based on some condition. If input file has 1 million records, if job fails just before last record, it's waste of MIPS. How to handle this in COBOL?

I was asked this question in an interview.

[ Post made via Android ] Image

Re: restart logic for a COBOL program doing some file operations?

Posted: Fri Nov 10, 2017 5:57 pm
by Robert Sample
This organization has some serious issues and you do NOT want to work for it.

If a COBOL program has an ABEND, you find and fix the cause of the ABEND, restore the data sets to their previous state, and rerun the job from the beginning. It is EXTREMELY unlikely that the program is going to ABEND on the next to last record of a million record data set (about 999,999 to 1 odds), but even if it does -- so what? You restore the data sets and rerun the job after fixing the ABEND cause -- the required solution does not depend upon where in the input that the ABEND occurred. I have never yet had an occasion to create a COBOL restart process -- but then, I have only been coding in COBOL for 42 years.

Re: restart logic for a COBOL program doing some file operations?

Posted: Sat Nov 18, 2017 6:18 pm
by Binamra
Hi,

Thanks for the replies. I could not answer this question. I think he was asking that can we do it in COBOL program or not without using any database? What could be the answer, could you please help me with that.

Re: restart logic for a COBOL program doing some file operations?

Posted: Sat Nov 18, 2017 8:18 pm
by Akatsukami
The answer is "yes". As both Dr. Sorichetti and Mr. Sample have said, however, it's a stupid and wasteful thing to do.