if i am reading a file with some 50000 records and moving to
a DB2 table and suddenly the program abends in between, is
there anyway i could restart from the exact record at which
the job failed once the program restarts.

Answers were Sorted based on User's Feedback



if i am reading a file with some 50000 records and moving to a DB2 table and suddenly the program a..

Answer / raja

Yes . we can restart the job by using the restart. if it
abends in the middle, we can find the record by looking
into the SQLERROD3.

Is This Answer Correct ?    7 Yes 1 No

if i am reading a file with some 50000 records and moving to a DB2 table and suddenly the program a..

Answer / jai ho

You can use CHECK POINT-RESTART logic.That is nothing but increasing commit frequency .
LOGIC IS LIKE THIS
CHECKPOINT/RESTART Implementation:


STEP1: Create the CHECKPOINT-COMMIT record in the working storage section, to store the data, which is needed for the next unit of recovery.
STEP2: In the procedure division MAIN para: First check the restart status flag i.e. RESTART-IND of CHECKPOINT_RESTART table. If RESTART-IND = ?N? then if any output file existsopen output file in OUTPUT mode start the normal process end If RESTART-IND = ?Y? then Move the SAVE-AREA information to CHECKPOINT-COMMIT record if any output file exists do the FILE REPOSITION: Open the output file in INPUT mode. Repeatedly Read the output record and INSERT it into GLOBAL temp table FILE_POSITION_GTT Until the last unit of recovery write count. Close the output file. Open the output file in OUTPUT mode. open a cursor for a table FILE_POSITION_GTT repeatedly fetch a cursor and write the record information into the output file until end of cursor close a cursor end If input for the program is from cursor then skip the rows until COMMIT-KEY. If input for the program is from file then skip the records until COMMIT-KEY. End. Note: For more than one output files, delete GTT after repositioning each output file.
STEP3: Make a count for each Insert?s/Update?s/Deletes in RECORDS-PROCESSED-UOR variable.
STEP4: Go thro? the logic and find out the appropriate place where COMMIT WORK can be hosted. There check the frequency of COMMITS: IF RECORDS-PROCESSED-UOR > COMMIT-FREQ KEY (input) value of the programTO COMMIT-KEY MOVE checkpoint-commit record lengthTO SAVE-AREA-LEN MOVE checkpoint-commit recordTO SAVE-AREA-TEXT Update the CHECKPOINT_RESTART table with this information END-COMMIT
STEP5: Before STOP RUN statement; reset the RESTART flag of the CHECKPOINT_RESTART table. i.e. MOVE ?N? TO RESTART-IND Update the CHECKPOINT_RESTART table with the above information.

Is This Answer Correct ?    1 Yes 0 No

Post New Answer

More COBOL Interview Questions

. How do we cast a variable in COBOL

1 Answers   HSBC,


How we copy a program from production region to development region.What is the process & syntax ?

3 Answers   CTS,


In a file if a column account number conatain value 0001234.. how can we move the value to another variable without zero. value may contain any type such as 00123405. we need the value 1234 or 12305. how can we do that in cobol. Please help.

1 Answers   CSC,


TO abend the data sholud open in which mode? 1.new 2.old 3.mod 4.shr

1 Answers   MNC,


can we read in input the file with a variable length ? please , how ..could you help me ?

3 Answers   EDS,






What will happen if we generate GDG +2 version instead of +1 version?

2 Answers   T systems,


wht is the difference between goto and perform stmts

7 Answers   DELL,


i have two file one is ksds another one is esds i want store matching records in flat file how to you matching.

2 Answers   Wipro,


What is normalisation?

2 Answers   IBM,


What is a scope terminator give example?

0 Answers  


Hi Guys, I have faced one interview question if I have requirement to add 5 new columns to existing table what are prerequisite do i need to take.

1 Answers  


What was removed from COBOL in the COBOL II implementation?

0 Answers  


Categories