![]() | Programming Guide | ![]() |
Waits for service calls to return before processing resumes
wait [serviceCalls] [ TIMEOUTtimeout]
serviceCalls- Specifies which service calls must return before processing resumes. If no service calls are specified, processing is suspended until the current service call returns. Use one of these keywords and its options:
FOR[callid]- Processing resumes when service call
callidreturns.FOR_ALL[callSpec]- Processing resumes when all the specified services return. If you omit
callSpec, all outstanding service calls must return in order to resume processing.callSpeccan have one of these formats:
- (
callid[,callid]... )—A comma-delimited list of service call IDs, enclosed in parentheses, that specifies the service calls that must return before processing resumes.
TRANSACTION—Processing resumes when all services associated with the current transaction return.FOR_ANY[callSpec]- Processing resumes when one of the specified services return. If you omit
callSpec, processing resumes when any outstanding service call returns.callSpeccan have one of these formats:
- (
callid, [callid]...)—A comma-delimited list of service call IDs, enclosed in parentheses. Processing resumes when any of these calls returns.
TRANSACTION—Processing resumes when any service associated with the current transaction returns.TIMEOUTtimeout- Resume processing if the specified service calls do not return before
timeoutelapses.timeoutis a quoted string or variable whose format can specify a relative time (time elapsed after the wait command is issued) or an absolute time. If notimeoutis specified, all specified service calls must return before processing resumes.A relative
timeoutcan be specified in this format:"[ +dayshours::minutes::]seconds"Seconds are required; minutes, hours, or days (space delimiter between days and hours) can also be specified. If more than seconds is specified, the + symbol and the quotation marks are mandatory. If only seconds are specified, both are optional.
Note: JPL's colon preprocessor expands colon-prefixed variables. To prevent expansion of variables that contain colons, you must prefix literal colons with another colon (
::) or a backslash (\:).An absolute
timeoutcan be specified in one of these ways:
JetNet, Oracle Tuxedo
Client, Server
The
waitcommand suspends processing of its caller pending completion of the specified service calls or elapse of the specifiedtimeout. If no service calls are specified, processing is suspended until the current service call returns. Processing can resume whether or not the specified calls return with the requested service. Whenwaitreturns, it sets thetp_returnproperty to the number of service calls that returned while processing was suspended.The
waitcommand activates theexception,unloadandpost_requesthandlers associated with any call that returns while the wait command executes.In the following example, the client code issues two service calls,
WITHDRAWALandBAL_INFO, both asynchronous. Thewaitcommand includes theFOR_ALLoption, which prevents the same client from engaging in any other activity until both service calls return:vars err_msg
service_call service "WITHDRAWAL"( \
acct_id, \
{err_msg, transact_id, post_date}) ASYNCservice_call service "BAL_INFO"( \
acct_id, \
{message, cur_bal, avail_bal, cur_date}) ASYNCwait FOR_ALL
...
waitcan generate these exceptions: