AUTOSTATUS Protocols

When the protocol in use includes AUTOSTATUS, the precompiler automatically generates a PERFORM IDMS-STATUS statement after each DML command (except IF). For each standard protocol (for example, BATCH or CICS) that is provided at installation time, an AUTOSTATUS protocol (for example, BATCH-AUTOSTATUS or CICS-AUTOSTATUS) is also provided. (The IDMS DC and DC-BATCH protocols already include AUTOSTATUS.) The DBA determines which protocol to use. Specify this protocol in the ENVIRONMENT DIVISION by using the MODE IS statement. (For more information about protocols, see .)
idmscu19
When the protocol in use includes AUTOSTATUS, the precompiler automatically generates a PERFORM IDMS-STATUS statement after each DML command (except IF). For each standard protocol (for example, BATCH or CICS) that is provided at installation time, an AUTOSTATUS protocol (for example, BATCH-AUTOSTATUS or CICS-AUTOSTATUS) is also provided. (The IDMS DC and DC-BATCH protocols already include AUTOSTATUS.) The DBA determines which protocol to use. Specify this protocol in the ENVIRONMENT DIVISION by using the MODE IS statement. (For more information about protocols, see Precompiler-Directive Statements.)
When AUTOSTATUS is in use, the PERFORM IDMS-STATUS statement can still be preceded by a check for a nonzero return code by including an ON clause at the end of the DML command. If the DBMS returns the specified status code to the IDMS communications block, the imperative statement in the ON clause is executed. If the specified status code is not returned, IDMS-STATUS is performed.
Any DML command can include an ON clause. Only one ON clause is allowed per command.
Syntax
►►─── ON 
condition-name imperative-statement
 . ───────────────────────────────►◄
Parameters
  • ON
    Tests whether a nonzero status has been returned as a result of a DML command.
  • condition-name
    Specifies a preassigned nonzero status condition name. Valid condition names include DB-STATUS-OK, DB-END-OF-SET, DB-REC-NOT-FOUND, ANY-ERROR-STATUS, and any condition names that the DBA has defined.
  • imperative-statement
    Specifies the program action to take when the DML command results in the specified
    condition-name.
The following example illustrates the use of the ON clause. A DML source program might contain the following statements:
0800-OBTAIN-REC.   OBTAIN CALC OFFICE ON DB-REC-NOT-FOUND GO TO 0900-NO-REC.          .          .          . 0900-NO-REC.   STORE OFFICE.
The precompiler converts the DML statements to comments, translates the ON clause into an IF statement, and generates the following expanded COBOL source code:
 0800-OBTAIN-REC. *  OBTAIN CALC OFFICE ON DB-REC-NOT-FOUND          MOVE 0001 TO DML-SEQUENCE          CALL 'IDMS' USING SUBSCHEMA-CTRL                   IDBMSCOM (32)                   SR450                   IDBMSCOM (43)          IF NOT DB-REC-NOT-FOUND PERFORM IDMS-STATUS;          ELSE                       GO TO 0900-NO-REC.           .           .           .    0900-NO-REC. *  STORE OFFICE.          MOVE 0002 TO DML-SEQUENCE          CALL 'IDMS' USING SUBSCHEMA-CTRL                   IDBMSCOM (42)                   SR450           PERFORM IDMS-STATUS.
For more information about the expansion of calls to CA IDMS, see CA IDMS Call Formats.