FETCH ANY

The EXEC CICS FETCH ANY command is used by a parent task to inquire on the status of any child task, and returns the status of any completed child task which has not yet been fetched.

FETCH ANY

Read syntax diagramSkip visual syntax diagramFETCHANY( data-area)CHANNEL( data-area)COMPSTATUS( cvda)ABCODE( data-area)NOSUSPENDTIMEOUT( data-value)

Conditions: INVREQ, NOTFND, NOTFINISHED

This command is threadsafe.

Description

EXEC CICS FETCH ANY is used by a parent task to inquire on the status of any child task. FETCH ANY will return when any eligible child task has completed, or when there are no unfetched children remaining.

Options

ABCODE(data-area)
Returns, if the child task terminated abnormally, the 4-character abend code. If an abend has not occurred, the variable is set to blanks.
ANY(data-area)
Specifies a 16-character binary data area, into which CICS® will place the fetched child token. This will match the token returned by the EXEC CICS RUN TRANSID command.

CICS® will only return the token of a child task which has not yet been fetched.

CHANNEL(data-area)
Returns the 16-character name of the reply channel of the child task identified by CHILD. The name is generated by CICS® and is unique within the scope of the current link level. If the child task does not have a channel to return the response, then this field will contain blanks.

A child channel can only be fetched once, and the fetched channel remains in scope until the link level changes. For more information about channel scope, see The scope of a channel.

COMPSTATUS(cvda)
Returns a CVDA value indicating the completion status of the child task. CVDA values are:
ABEND
The child task abended.
NORMAL
The child task completed normally.
SECERROR
The child task failed to attach due to a security error. ABCODE is blank.
NOSUSPEND
Specifies that the command will return immediately without waiting for any remaining child tasks to complete. If at least one of the unfetched children is completed, the command will return with a normal response.
TIMEOUT(data-value)
Specifies a fullword binary data-value which is the maximum time in milliseconds that the command will wait for any remaining child tasks to complete before the command returns. The maximum value is 40800000 milliseconds. If TIMEOUT is not specified, or the specified value is zero, the command is not timed out.

Conditions

113 NOTFINISHED
RESP2 values:
52
NOSUSPEND was specified, but there were no completed children to fetch when the command was run.
53
No children have completed within the interval specified by the TIMEOUT option.
13 NOTFND
RESP2 values:
1
No unfetched children were found.
16 INVREQ
RESP2 values:
52
The parent has no children.
241
TIMEOUT value is not valid.