IDMS COBOL GUIDELINES

IDMS Cobol Guidelines -- Version 1.0
09/03/97


Table of Contents

1. Program Size
2. DML Commands
3. Work Areas
4. Bind Command
5. Ready Command
6. DBKEY Usage
7. Data Base Sweeps
8. Find/Obtain Command
9. Store Command
10. Disconnect Command
11. Erase Command
12. Walking A Set
13. Ascertaining Set Membership
14. Processing Via Record
15. Loading Sorted Sets
16. Commit Command
17. Status Code Check
18. Run Mode
19. Subroutines
20. Record Lock-Unlock Facility
21. Keep Longterm
22. Scratch Records
23. Queue Records
24. DeadLock-RollBack

 IDMS Cobol Standard


1. PROGRAM SIZE

DC programs should be limited to 20K. Programs larger than this should be reduced in size by limiting working storage.


2. DML COMMANDS

Use only DML commands for all IDMS calls. Allow the DML preprocessor to translate commands into correctly formatted call statements.


3. WORK AREAS

IDMS-DC: Programmers must initialize "copied in" work areas (maps and records) which are copied in from the IDD.


4. BIND COMMAND

IDMS record BIND statements and area READY statements should be processed after it has been determined that accessing the database is necessary. Whenever possible, housekeeping and editing should be performed first.


5. READY COMMAND
6. DBKEY USAGE
7. DATA BASE SWEEPS
8. FIND/OBTAIN COMMAND
9. STORE COMMAND

All key values and currencies for automatic sets should be defined and established immediately before issuing a "STORE" command.


10. DISCONNECT COMMAND

Usually only CALC records can be DISCONNECTed without immediately re-CONNECTing to another owner. VIA records should be re-CONNECTed immediately to another owner to prevent orphan VIA records.


11. ERASE COMMAND

Use the unqualified ERASE very carefully. Review all record and set relationships closely before using the command, especially if using the ERASE ALL option.


12. WALKING A SET

When walking a set, on an END-OF-SET condition (0307), if it is necessary to access the information in the owner record always make sure an "OBTAIN" command has been issued for the owner record. On an END-OF-SET condition, currency is established for the owner record (current of run-unit) but the contents of the record occurrence are not moved into program storage (i.e. it operates as a "FIND" DML command).


13. ASCERTAINING SET MEMBERSHIP

When a record is an optional or manual member of a set, the program must issue an "IF set-name MEMBER" DML command prior to an "OBTAIN OWNER" DML command. If the member record occurrence does not participate in a set occurrence and an "OBTAIN OWNER" command is issued, IDMS will return the owner of the current set.


14. PROCESSING VIA RECORD

Process VIA records in a via set (if necessary), immediately after the owner has been obtained or found. Since the entire page on which the owner and (hopefully) many of the members are stored is brought into the buffer, I/O will be reduced.


15. LOADING SORTED SETS

IDMS-DB: When adding multiple member occurrences to an occurrence of a sorted set, pre-sort the records in sort key sequence to decrease I/O.


16. COMMIT COMMAND
17. STATUS CODE CHECK

Checking multiple non-zero return codes can be cumbersome under "AUTOSTATUS". An example for handling this is:

STORE SIRE012-SITC3V              
  ON ANY-STATUS                 
    NEXT SENTENCE.            
IF DB-STATUS-OK                   
  ADD 1 TO T3V-WRITTEN          
ELSE                              
  IF ERROR-STATUS = '1205'      
    NEXT SENTENCE             
  ELSE                          
    PERFORM IDMS-STATUS.

18. RUN MODE

IDMS DB:


19. SUBROUTINES

IDMS-DC: Stable, closed procedural sub-routines (i.e., a date routine) should be invoked by using a "CALL" statement instead of a DC LINK. The DC overhead involved with handling a LINK can be avoided.


20. RECORD LOCK-UNLOCK FACILITY

IDMS record locks are of two types: SHARED (select) and EXCLUSIVE (update). Shared locks prevent the update of the record occurrence by other run-units, while allowing all run-units to retrieve the record. Exclusive locks prevent any other run units from retrieving or updating the record occurrence. Under central version, record locks can be set in two ways, either implicitly or explicitly.

Implicit locks are set automatically by IDMS central version as follows:

Explicit locks, of both the SHARED and EXCLUSIVE variety, are placed on record occurrences by execution of the KEEP verb and the FIND/OBTAIN verb with the KEEP option.

LOCK Release:


21. KEEP LONGTERM

IDMS-DC: This option may be used for heavily accessed information. Storage can be allocated for the short term or long term and can be released explicitly through program request. This option should be considered for only relatively small amounts of information since storage is obtained from the storage pool. Kept storage is maintained across tasks running on the same logical terminal. Data "KEPT" in the storage pool is not recoverable from a system shutdown or failure. Data in the storage pool is not preserved from one execution of IDMS-DC to another.


22. SCRATCH RECORDS

IDMS-DC: These records are a good option for large amounts of information maintained across tasks. Scratch records are accessible on the same logical terminal, are not deleted until DC shutdown, and are not maintained across system failure.


23. QUEUE RECORDS

These records are a good option when a large amount of information must be kept across tasks. Queue records are accessible by all terminals, tasks, and batch applications. They are kept through a DC shutdown or failure.


24. DEADLOCK-ROLLBACK

Return to: Systems Development Home Page
Return to: UMS Home Page
This content was last updated on July 3, 2002
This page was last updated on September 3, 2004