when we are tying to update a table having 100 rows. if the
program abends when updating 51 row . how to start updating
again from the 51 row .what was the logic
Answers were Sorted based on User's Feedback
Answer / abhijit18in2002
when we are tying to update a table having 100 rows.
if the program abends when updating 51 row . how to start
updating again from the 51 row .
what was the logic
Ans: The Possible answer would be..if you had used COMMIT
before 51st ROW .. the Former records
would have been updated in the table .. If No COMMIt was
used.. The whole transaction would have been
ROLLBACKED.
Now If you want to start a fresh Transaction and want to
start Updating directly from 51st Row
Then There are two ways
1> Perform a loop to scroll till u have read 50 rows
Then Point ur cursor as CURRENT to the 51st Row
Start Updating the Records Till end of table.
or
2> Declare a Scrollable cursor & use FETCH ABSOLUTE option
to fetch a particular row directly
EXEC SQL FETCH ABSOLUTE +51 C1
INTO :TEMP1, :TEMP2, :TEMP3;
this statement fetches the 51st row of the Table
Is This Answer Correct ? | 8 Yes | 5 No |
Answer / kamra2010
1) Create two work files, say WORK-1 and WORK-2.
2) Unload the table into file WORK-1.
3) Pass the commit frequency through the JCL to the program.
4) Program logic:
(i) read the input file WORK-1
(ii) update the table
(iii) if the number of records updated in the table is
equal to the commit frequency then apply COMMIT command.
Also, write the last committed record into the output file
WORK-2. (this record will be used for restart logic)
(iv) In Restart process,
a. read the output file record
b. next, the input file will be read untill it
finds the corresponding output file record
c. follow the same step 4(i) to step 4(iii)
Is This Answer Correct ? | 0 Yes | 0 No |
This was related to -811 sqlcode, In a COBOL DB2 program which accesses employee table and selects rows for employee 'A', it should perform a paragraph s001-x if employee 'A' is present. In this case it gets -811 sqlcode, but still it process the paragraph s001-x. What could be wrong in my code.
wht steps we need will coding cobol and db2 pgm ?
Comment whether the cursor is closed during commit or not.
how to u check the query is executing or not ?where will u check for sqlcode ?
Can we use group-by clause in sub-query? If 'yes' means,Will it be executed successfully or else If 'no' means why should we not using that method? Give me your suggestion please....
Is it possible using max on a char column?
What does a deadlock mean in DB2?
What is read-only cursor?
What is host variable?
Compare a subselect to a join?
Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplicate records?
why we create view.