Runnig a Task


I want to perform a task that would execute each interval I set up in online (cics).
Can I doit using adabas?


As far as I know: only by running a natural program in a loop to watch the time as set it off. Very inefficient.

Many sites nowadays have some scheduling kind of tool outside of Adabas and CICS such as Control-M. That would be more practical and efficient.

Hi Hezi,
Many customers use the SYSEXT module USR2027N to create their own scheduling
This module will just pause your natural session for the specified time.
If you put this “wait” in a repeat-loop and store the scheduled tasks in a DB, then you only need a little logic to check what tasks should (or has been) run.

we are using vse so no scheduler :frowning:

How can I scheduled a task in a Db (Adabas???)?

create your own application that stores the task information in an Adabas file. Start an application job (e.g. batch Natural or CICS background task) that uses CMROLL to create a polling loop: check the Adabas file for new entries or entries that are due to start in this time period, start them (CMTASK or NATRJE), then call CMWAIT or CMROLL to wait some period of time (60 seconds, 300 seconds…) before checking the Adabas file again.

See Natural library SYSEXTP for examples of calling CMTASK (see ASYN* modules), NATRJE (SUBMIT) and CMROLL (SUSPEND). USR2027N in library SYSEXT is another alias for CMWAIT.

Adabas does not have an application task scheduler function.

Well, I looked in sysext/tp, but I did not fully understood “cmtask”.
Can you send an example of using it?
Can you tell more about the API’s that are built in (ex:cmroll etc)?

Thank you

Doesn’t IBM provide NetView on VSE? If you have that it provides task scheduling. I work on MVS, but pretty much every console automation product I know of includes this kind of functionality. (The one we use is called ODDS.)

CMTASK is Natural’s abstraction for forking off or attaching a parallel task. It takes three parameters: the name of the transaction to execute (A8), the length of the parameter string to pass to the new transaction (B2), and the actual parameter string (An). The Natural will look something like:

1 SDATA (A80)


Is there a problem running ‘cmtask’ under batch, I am getting rc=1c?

Since I don’t know VSE return codes from the Attach SVC, I can only guess. Check your console log for error messages (module not found? insufficient memory? module not reentrant?).

You have to have your Natural nucleus configured to be re-entrant - this requires an ADALNKR (with the correct SVC number if you are not using the default) that is used in place of ADAUSER in the NATI060 job stream. Make sure the linkedit (or the VSE equivalent) marks the nucleus as reentrant.

The first parameter to CMTASK is the name of the nucleus to be loaded - the same name as the module used to start the main task. The subsequent parameters are a length followed by the data of that length. The example Curtis gives is not strictly correct - “SDATA” should not be passed as it must be physically adjacent to SLENGTH in memory. (Additional parameters can be passed by including additional length/data pointers = eg “CALL ‘CMTASK’ USING STRANSID SLEN1 SLEN2” where SLEN1 and SLEN2 are a B2 length followed by bytes of data at least that length. Use CMUPARM to get the data in the subtask).

I guess that’s what I get for copying code out of a 15-year-old program without verifying whether it still works or not.


Another way getting a solution is using Entire Operations. Beside executing a repeatable task it can do many more in terms of