Previous Topic: CONNECTNext Topic: DELETE QUEUE (DC/UCF)


DC RETURN (DC/UCF)

The DC RETURN statement returns control to a program at the next higher level within a task. Additionally, you can use the DC RETURN statement to specify:

Control Returns to the Program or System

Following a DC RETURN request, control returns to the program at the next higher level within the task. If the issuing program is the highest level program, control returns to the system. Any DC RETURN statement can include a NEXT TASK CODE option to specify the next task to be initiated by the system. However, the position of the issuing program within the task governs whether the specified task will, in fact, receive control.

When the system receives control from the highest level program that issued a DC RETURN NEXT TASK CODE request, the specified task is executed immediately if the specified task code has been assigned the NOINPUT attribute during system generation; if the task code was assigned the INPUT attribute, the task executes only when the terminal operator presses an attention identifier (AID) key. Typical AID keys include all PA and PF keys, ENTER, and CLEAR.

Syntax
►►─── DC RETURN ─┬───────────────────────────────────┬────────────────────────►
                 └─ NEXT TASK CODE (next-task-code) ─┘

 ►─┬─────────────────────────────────────────────────┬─ ; ────────────────────►◄
   │           ┌───────────────────────────────────┐ │
   └─ TIMEOUT ─▼─┬─ INTERVAL (timeout-interval) ─┬─┴─┘
                 └─ PROGRAM (timeout-program) ───┘
Parameters
NEXT TASK CODE (next-task-code)

Specifies the 1- to 8-character code associated with a task to be initiated on the same terminal. Next-task-code is either the symbolic name of a user-defined field that contains the task code or the task code itself enclosed in single quotation marks. The specified task code must be defined to the system under which the task is running, either during system generation or at runtime, by using a DCMT VARY DYNAMIC TASK command.

Note: For more information about DCMT VARY DYNAMIC TASK, see the CA IDMS System Tasks and Operator Commands Guide.

TIMEOUT

Specifies the action the system is to take if the terminal operator fails to enter data required to initiate a task. This parameter overrides resource timeout interval and program specifications established during system generation.

INTERVAL (timeout-interval)

Specifies the time, in seconds, that can elapse before the system releases the resources held by the terminal on which the task is executing. Timeout-interval is either the symbolic name for a user-defined FIXED BINARY(31) field that contains the timeout interval or the interval itself expressed as a numeric constant.

PROGRAM (timeout-program)

Specifies the 1- to 8-character name of the program to be invoked when the specified timeout interval has been reached. This program handles and releases resources held by the terminal on which the task was executing. Timeout-program is either the symbolic name of a user-defined field that contains the program name or the name itself enclosed in single quotation marks. The specified program must be defined to the system either during system generation or at runtime by using a DCMT VARY DYNAMIC PROGRAM command.

Note: For more information about DCMT VARY DYNAMIC PROGRAM, see the CA IDMS System Tasks and Operator Commands Guide.

Example

The following statement illustrates the use of DC RETURN. The task code associated with MENU_TASK_CODE, if defined with the INPUT parameter, will be invoked the next time the terminal operator presses an attention identifier (AID) key; if MENU_TASK_CODE is defined with the NOINPUT parameter, it will be invoked immediately.

DC RETURN
  NEXT TASK CODE (MENU_TASK_CODE);

The following figure illustrates how the system executes a task when DC RETURN statements within three programs specify the NEXT TASK CODE option.

In DC RETURN Processing Task A invokes program A. Program A links to program B, which in turn links to program C. Program C issues a DC RETURN NEXT TASK CODE ('Z') request; control returns to program B. Program B contains a DC RETURN NEXT TASK CODE ('Y') request, which takes precedence over program C's DC RETURN specification. Control returns to program A, which issues a DC RETURN NEXT TASK CODE ('X') request. Because program A is at the highest level in the task, task X will be invoked.

                                 DC/UCF SYSTEM
─────────────────────────────────────────────────────────────────────────────
                                                TASK X
        TASK A         ┌ - - - - - - - - - - - - - ┐
───────────┬───────────▲───────────────────────────┼─────────────────────────
           │           │                           │
           │           │                    ┌──────▼──────┐
           │           │                    │             │
  ┌────────▼────────┐  │                    │  PROGRAM X  │
  │    PROGRAM A    │  │                    │             │
  │        .        │  │                    └─────────────┘
  │        .        │  │        (RETURN)
┌─┤        .        ◄-─┼ - - - - - - - - - - - ──┐
│ │   DC RETURN     │  │
│ │ NEXT TASK CODE  │  │                         │
│ │        X        │  │
│ └────────┬────────┘  │                         │
│          └───────────┘
│                                                │
│
│                                                │
│
│                                                │
│          (LINK B)         ┌─────────────────┐
└───────────────────────────►    PROGRAM B    │  │
                            │        .        │
                            │        .        │  │
                          ┌─┤        .        │            (RETURN)
                          │ │   DC RETURN     ◄-─┼─ - - - - - - - - - - - - ─┐
                          │ │ NEXT TASK CODE  │
                          │ │        Y        │  │                           │
                          │ └────────┬────────┘
                          │          └  - - - - ─┘                           │
                          │
                          │                                                  │
                          │         (LINK C)            ┌─────────────────┐
                          └─────────────────────────────►    PROGRAM C    │  │
                                                        │        .        │
                                                        │        .        │  │
                                                        │        .        │
                                                        │   DC RETURN     │  │
                                                        │ NEXT TASK CODE  │
                                                        │        Z        │  │
                                                        └────────┬────────┘
                                                                 └ - - - - - ┘
Status Codes

Because control is returned to the next-higher level, there is no need to check the ERROR_STATUS field.