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 define Dymanic array in cobol how do u define single demensional arry and multidymensional arry in ur cobol.

4 Answers   Cap Gemini,


how to code in cobol while using variable block file?

1 Answers  


How can i load all the data from a file to Table (array) in cobol.How i manage the occurs clause with out reading the file.Any options avilable ? Please can any one help me it is urgent?

0 Answers   HeadStrong,


how many subpgms we can use in a main pgm ? how do u link sub pgm to main pgm ? how can i use the parameters declared in main pgm to sub pgm ?

2 Answers   TCS,


how do you reference the esds vsam file formats from cobol programs

0 Answers  






Explain about Redefines cluse?

3 Answers   iGate,


Hi................... I have records like this aaaa cccc bbbb And i want output like this bbbb cccc aaaa How can it possible ?. Note:Please make sure records are in unsorted order. somebody plzzz help me.

1 Answers  


I have one column say 'X' defined as VARCHAR Can anyone tell me What are the different ways to update this column thru COBOL-DB2 program?

5 Answers  


Explain the difference between an internal and an external sort, the pros and cons, internal sort syntax etc.

3 Answers  


Size of a column has been changed in DB2 table (Suppose it was of 5 characters and later changed to 4 characters) and forgot to change the DCLGEN in COBOL program, what will happen during the execution of code? If the program Abends then what will be the error? If it doesn't abend then hpw the error can be catched?

5 Answers   IBM,


How will 128 be saved in s9 (3) comp-3 How will 12 be saved in s9 (2) comp

3 Answers   CTS,


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

0 Answers  


Categories