Previous Topic: DC/UCF Status CodesNext Topic: Data Manipulation Language Statements


Testing for DC/UCF Return Codes

Testing for the return code in register 15 is usually not necessary because most DML commands have options that take action based on the return code value.

Specifying Conditions

The COND (condition) parameter provides a conditional return to the issuing program should a specified error or special condition occur during processing. This return of control can be directed to one of the following locations:

The options of a COND parameter consist of statement-specific conditions that can occur during the execution of a DML statement. Any number of conditions can be specified. For example, the following COND parameter requests a return of control in the event of an I/O error or deadlock condition:

COND=(IOER,DEAD)

If a condition associated with a specified parameter arises, control will be returned to the issuing program. If a condition occurs for which no COND parameter is coded, a default action will be taken. Typically, the default action either aborts the task or waits for the condition to change.

Specifying COND with an Exit Routine

When more than one conditional parameter is permitted, you can code the value ALL to indicate that all of the permitted COND parameters apply. If a condition corresponding to an available parameter occurs and ALL is specified, control will be returned to the issuing program.

Most DC/UCF DML statements provide the facility to associate an exit routine with each special condition. To return control to a specific exit when a condition occurs, you include both the appropriate condition (COND parameter) and the name of its associated exit routine.

For example, a DML statement may include a COND parameter of IOER and the IOERXIT parameter, which names the routine to which control will be returned in the event of an I/O error that occurs during execution of the DML command; for example:

COND=(IOER),IOERXIT=IOERROR

Specifying COND Without an Exit Routine

Specifying only the COND parameter without an exit routine causes a return of control to the next sequential instruction in the program that issues the DML statement. In this case, you can examine the contents of register 15 to determine which condition code was set as a result of the operation.

Specifying a General Exit Routine

You can specify a general exit routine by using the ERROR parameter. The system passes control to this routine when a condition occurs for which no specific exit routine was coded.

Note: If a condition occurs for which an associated exit routine and the ERROR parameter are specified, control will be returned to the routine named by the specific exit. If you have multiple exit routines containing the same logic, you should specify only the ERROR parameter to avoid redundant coding.

Syntax

The following syntax lists the COND parameter and exit routines found in the #LOAD statement. The NOSTXIT exit is associated with the NOST condition, the IOERXIT exit is associated with the IOER condition, and so forth.

►►─┬───────────────────────────────┬─────────────────────────────────────────►
   └─ ,COND= ─┬── NO ◄ ───────────┬┘
              ├── ALL ────────────┤
              │   ┌───── , ───┐   │
              └─(─▼─┬─ NOST ─┬┴─)─┘
                    ├─ IOER ─┤
                    ├─ SNGL ─┤
                    ├─ LDCF ─┤
                    ├─ PGNF ─┤
                    └─ DEAD ─┘
 ►─┬──────────────────────────────────────┬───────────────────────────────────►
   └─ NOSTXIT=insufficient-storage-label ─┘

 ►─┬────────────────────────────┬─────────────────────────────────────────────►
   └─ ,IOERXIT=i/o-error-label ─┘

 ►─┬───────────────────────────────────────┬──────────────────────────────────►
   └─ ,SNGLXIT=single-thread-in-use-label ─┘
 ►─┬────────────────────────────────────────────┬─────────────────────────────►
   └─ ,LDCFXIT=storage-location-conflict-label ─┘

 ►─┬────────────────────────────────────┬─────────────────────────────────────►
   └─ ,PGNFXIT=program-not-found-label ─┘

 ►─┬───────────────────────────┬──────────────────────────────────────────────►
   └─ ,DEADXIT=deadlock-label ─┘

 ►─┬──────────────────────┬───────────────────────────────────────────────────►◄
   └─ ,ERROR=error-label ─┘

Some DML statements have only a single condition, as the following excerpt from the #LINK statement illustrates.

Syntax

 ►─┬─────────────────────┬────────────────────────────────────────────────────►
   └─ ,COND= ─┬─ NO ◄ ──┬┘
              └─ PGNA ──┘

 ►─┬────────────────────────────────────────┬─────────────────────────────────►
   └─ ,PGNAXIT=program-not-available-label ─┘

 ►─┬──────────────────────┬───────────────────────────────────────────────────►
   └─ ,ERROR=error-label ─┘

In this case, the general ERROR parameter functions identically to the specific PGNAXIT parameter. It supplies the name of a routine to which the program will branch when a program-not-available error occurs.

Note: The COND parameter list is enclosed in parentheses. If multiple parameters are specified, each parameter is separated from the previous one by a comma.

Example of COND in #LOAD

The following example of the #LOAD statement attempts to load the program JOBMAP1 into the program pool. The COND parameter is set to PGNF, which will return control to the issuing program only if the requested program cannot be dynamically loaded or is marked as out of service. The return code for this condition is X'14'.

In this example, if the return code matches the PGNF condition, the system returns control to the issuing program at label ERRMSG, indicated by the ERROR parameter. If the system returns a code of X'00' the program JOBMAP1 will have been successfully loaded into the program pool. Return codes other then X'00' or X'14' will result in an abend and control will be returned to either a higher-level program or the system.

LOAD1    #LOAD PGM=JOBMAP1,COND=PGNF,ERROR=ERRMSG
         .
         .
         .
ERRMSG   EQU   *
         .
         .
        

Testing for DML Statements that Request DC/UCF Services

In addition to the COND parameter, you can test for the return code value in register 15 for each DML statement that requests DC/UCF services. Your program can compare the register 15 value to a literal or a defined constant, then execute a conditional branch.

In the following example, if the value in register 15 equals the numeric value 0000, the program branches to the label CONTINU. Any value other than zero causes a branch to the program label RCCOND.

         .
         .
         C     15,=F'0'
         BE    CONTINU
         B     RCCOND
         .
         .
CONTINU  EQU   *
         .
         .
         .
RCCOND   EQU   *
         .
         .