You can include logic in your program that is invoked if your run unit is terminated because of a db-key deadlock. This enables your program to maintain the terminal session and save any data that was previously entered on the screen.
At that point, your program can do one of the following:
What Happens When a Deadlock Occurs
When a run unit is terminated because its request would cause a deadlock condition, the DBMS:
TASK: task-code PROG: program-name SUBS: subschema-name SSCSTAT: subschema-status RUN-UNIT run-unit-id ROLLED OUT.'
What To Do
You can continue a terminal session in the event of a deadlock by having your program resubmit a transaction in response to a minor status code of nn29. How you do this is largely a site-specific decision. Typically, you resubmit a transaction in one of two ways:
Automatically Restarting the Run Unit
If your program automatically restarts the run unit and retries the transaction, it must:
If You Don't Check for the Minor Code
If your program fails to check for a minor code of nn29, you can expect the following results:
If your program does not contain any generic error-checking logic (such as the IDMS-STATUS routine) and, after receiving a minor code of nn29, continues to issue database requests without reestablishing a run unit, the DBMS returns a database status of nn77 (run unit not bound).
'COBOL'. COBOL programs must redefine the ERROR-STATUS field of the IDMS communications block to access the minor code value.
Example of Resubmitting the Transaction
The program excerpt below informs the user of a database minor code of nn29 and requests that the transaction be resubmitted:
WORKING-STORAGE SECTION.
01 SUBSCHEMA-CTRL. 03 PROGRAM-NAME PIC X(8) VALUE SPACES. 03 ERROR-STATUS PIC X(4) VALUE '1400'. . . 03 SUBSCHEMA-CTRL-END PIC X(4). 01 SSC-REDEF REDEFINES SUBSCHEMA-CTRL. 03 FILLER PIC X(8) VALUE SPACES. 03 ERRSTAT-REDEF. 05 ERRSTAT-MAJ PIC XX. 05 ERRSTAT-MIN PIC XX. 88 DEADLOCK VALUE '29'. 03 FILLER PIC X(292). * 01 MESSAGES. 05 DBKEY-DEADLOCK-MESSAGE PIC X(80) VALUE 'REQUESTED RECORD IN USE. PLEASE RESUBMIT TRANSACTION'. . . . PROCEDURE DIVISION. . . . IDMS-ABORT. IF DEADLOCK THEN MODIFY MAP TSKMAP01 TEMPORARY FOR ALL FIELDS NOMDT MAP OUT USING TSKMAP01 MESSAGE IS DBKEY-DEADLOCK-MESSAGE LENGTH 80 DC RETURN NEXT TASK CODE 'UPDATASK'. IDMS-ABORT-EXIT. EXIT. COPY IDMS IDMS-STATUS. ****************************************************************** IDMS-STATUS SECTION. ********************* IDMS-STATUS FOR IDMS-DC ******************** IF DB-STATUS-OK GO TO ISABEX. PERFORM IDMS-ABORT. MOVE ERROR-STATUS TO SSC-ERRSTAT-SAVE MOVE DML-SEQUENCE TO SSC-DMLSEQ-SAVE SNAP FROM SUBSCHEMA-CTRL TO SUBSCHEMA-CTRL-END ON ANY-STATUS NEXT SENTENCE. ABEND CODE SSC-ERRSTAT-SAVE ON ANY-STATUS NEXT SENTENCE. ISABEX. EXIT. DMCL-DC-GEN-GOBACK SECTION. GOBACK.
Copyright © 2013 CA.
All rights reserved.
|
|