tsched() — Schedule MTF subtask

Standards

Standards / Extensions C or C++ Dependencies
Language Environment C only  

Format

#include <mtf.h>

int tsched(int task_id, const char *func_name, …);

General description

Restriction: This function is not supported in AMODE 64.

The tsched() built-in library function is used to schedule parallel functions under MVS.

The tsched() library function schedules a parallel function (func_name) to be executed in a subtask that has been attached and initialized by tinit(). The first argument task_id can be used to specify the task where the parallel function is to be executed. The task_id can be set to MTF_ANY to indicate that the parallel function can be run in any task or, task_id can be set to a specific task number between 1 and the number of subtasks specified on tinit().

The tsched() function allocates approximately 2K of space as a work area. This work area is not freed. However, a call to the tsyncro() function will make work areas previously allocated by tsched() available for reuse by tsched(). Because tsched() does not free the work area storage, it is possible the tsched() will cause an application Short on Storage condition to occur if enough calls are made to the tsched() function.

You can call tsched() from your main C task as often as necessary to schedule parallel functions for execution. If all of the subtasks are busy running previously scheduled functions, each call in excess of the number of subtasks will cause func_name to be run after previously scheduled functions in the first qualifying subtask that becomes available.

All scheduled functions must be computationally independent. A function cannot use variables that are modified by another scheduled function or the scheduling function. To determine if all other scheduled functions have completed, use the tsyncro() library function (see tsyncro() — Wait for MTF subtask termination).

The name of the parallel function, func_name, must not be longer than 8 characters. If it is, the name will be truncated to the first 8 characters with no warning.

Usually tsched() returns to the calling main task program before the scheduled parallel function has completed execution. Therefore, you must call tsyncro() to ensure that your parallel functions have completed execution.

If tinit() has not been successfully called before tsched(), tsched() indicates that MTF is inactive.

If tinit() is called by a program running under IMS, CICS, or DB2, the request will not be processed and the returned value will indicate that MTF calls are not supported under these systems.

Note: This function is not supported under the z/OS® UNIX with the POSIX(ON) runtime option.

Returned value

If successful, scheduling the parallel function for execution in a subtask, tsched() returns MTF_OK.

If unsuccessful, tsched() returns one of the following values:
Error Code
Description
EBADLNKG
tsched() has been invoked using an invalid linkage. The header file mtf.h may have been missing from the source at compile.
EENTRY
The parallel function was not found in the parallel module.
EINACTIVE
MTF is inactive.
ENOMEM
There was insufficient storage for MTF-internal areas.
ETASKABND
One or more subtasks have terminated abnormally.
ETASKID
The task_id specified is not valid.
Note: These values are macros. They can be found in the mtf.h header file.

Related information