DELAY

Delay the processing of a task.

DELAY

Read syntax diagramSkip visual syntax diagramDELAYINTERVAL( 0)INTERVAL( hhmmss)TIME( hhmmss)FORHOURS( data-value)MINUTES( data-value)SECONDS( data-value)MILLISECS( data-value)UNTILHOURS( data-value)MINUTES( data-value)SECONDS( data-value)REQID( name)

Conditions: EXPIRED, INVREQ

This command is threadsafe only when the interval is 0.

Note for dynamic transaction routing:  Using DELAY with REQID if later CANCELed could create inter-transaction affinities that adversely affect the use of dynamic transaction routing. See Affinity for more information about transaction affinities.

Description

DELAY suspends the processing of the issuing task for a specified interval of time or until a specified time of day. It supersedes any previously initiated POST command for the task.

It is possible to specify intervals in milliseconds (ms) however CICS checks for delay expiry every 250 ms so the actual interval might vary depending on where in the scan cycle your request is made.

The default is INTERVAL(0), but for C the default is FOR HOURS(0) MINUTES(0) SECONDS(0).

Options

FOR
specifies the duration of the delay.
HOURS(data-value)
a fullword binary value in the range 0–99.
INTERVAL(hhmmss)
specifies, in packed decimal format, the interval of time that is to elapse from the time when the DELAY command is issued. The mm and ss are in the range 0–59. The time specified is added to the current clock time by CICS when the command is executed to calculate the expiration time.

When using the C language, you are recommended to use the FOR/UNTIL HOURS, MINUTES, and SECONDS options as C does not provide a packed decimal data type. You may use INTERVAL, but if the value specified is not an integer constant, the application is responsible for ensuring that the value passed to CICS is in packed decimal format.

Start of changeMILLISECS(data-value)End of change
Start of changespecifies a fullword binary value in the range 0–999, when HOURS, MINUTES or SECONDS are also specified, or 0-359999999 when MILLISECS is the only option specified.End of change
MINUTES(data-value)
specifies a fullword binary value in the range 0–59, when HOURS, SECONDS or MILLISECS are also specified, or 0–5999 when MINUTES is the only option specified.
REQID(name)
specifies a name (1–8 characters), which should be unique, to identify the DELAY request. Using this option to specify an application-defined name enables another transaction to cancel the DELAY request.

To enable other tasks to cancel unexpired DELAY requests, you must make the request identifier dynamically available. For example, storing it in a TS queue, whose name is known to other applications that may want to cancel the DELAY request, is one way you can pass a request identifier to other transactions.

SECONDS(data-value)
specifies a fullword binary value in the range 0–59, when HOURS, MINUTES or MILLISECS are also specified, or 0–359 999 when SECONDS is the only option specified.
TIME(hhmmss)
specifies, in packed decimal format, the time when the task should resume processing.

When using the C language, you are recommended to use the FOR/UNTIL HOURS, MINUTES, and SECONDS options as C does not provide a packed decimal data type. You may use TIME, but if the value specified is not an integer constant, the application is responsible for ensuring that the value passed to CICS is in packed decimal format. See the section about expiration times in Interval control.

UNTIL
specifies the time at the end of the delay and when the task should resume processing.

Conditions

31 EXPIRED
occurs if the time specified has already expired when the command is issued. If you specify very short intervals of less than 250 ms it is likely the time will have lapsed before the command is issued. You will need to use exception handling if short delay intervals are requested.

Default action: ignore the condition.

16 INVREQ
RESP2 values:
4
Hours are out of range.
5
Minutes are out of range.
6
Seconds are out of range.
22
Milliseconds are out of range.

also occurs (RESP2 not set) if the DELAY command is not valid for processing by CICS.

Default action: terminate the task abnormally.

Examples

The following example shows you how to suspend the processing of a task for five minutes:
EXEC CICS DELAY
     INTERVAL(500)
     REQID('GXLBZQMR')
EXEC CICS DELAY FOR MINUTES(5)
The following example shows you how, at 09:00, to suspend the processing of a task until 12:45:
EXEC CICS DELAY
     TIME(124500)
     REQID('UNIQCODE')
There are two ways to enter the time under UNTIL.
  • A combination of at least two of HOURS(0–99), MINUTES(0–59) and SECONDS(0–59). HOURS(1) SECONDS(3) would mean one hour and three seconds (the minutes default to zero).
  • Any one of HOURS(0–99), MINUTES(0–5999), or SECONDS(0–359 999). HOURS(1) means one hour. MINUTES(62) means one hour and two minutes. SECONDS(3723) means one hour, two minutes, and three seconds.

Under FOR you can enter the time in both ways that apply to UNTIL and additionally you can specify a delay to include milliseconds or specify the delay completely in milliseconds. To specify fractions of a second on a delay, code the MILLISECS parameter in the range 0-999 in addition to other time units. To specify the delay purely in milliseconds, code the MILLISECS parameter in the range 0-359999999. The following example shows you how to suspend the processing of a task for 15000 milliseconds:

EXEC CICS DELAY
     FOR MILLISECS(15000)
     REQID('UNIQCODE')