|Statements under OpenVMS|
|Valid:||anywhere in a SAS program|
|WAITFOR <_ANY | _ALL_> taskname <taskname...> <TIMEOUT=seconds>;|
specifies the name of the task(s) that you want to wait for. The task name(s) that you specify must match exactly the task names assigned through the SYSTASK COMMAND statement. You cannot use wildcards to specify task names.
suspends execution of the current SAS session until either one or all of the specified tasks finishes executing. The default setting is _ANY_, which means that as soon as one of the specified task(s) completes executing, the WAITFOR statement will finish executing.
The WAITFOR statement suspends execution of the current SAS session until the specified task(s) finish executing or until the TIMEOUT= interval (if specified) has elapsed. If the specified task was started with the WAIT option, then the WAITFOR statement ignores that task.
systask command "sas myprog1.sas" taskname=sas1; systask command "sas myprog2.sas" taskname=sas2; systask command "sas myprog3.sas" taskname=sas3; waitfor _all_ sas1 sas2 sas3;
The SYSRC macro variable contains the return code for the WAITFOR statement. If a WAITFOR statement cannot execute successfully, the SYSRC macro variable will contain a non-zero value. For example, the WAITFOR statement might contain syntax errors. If the number of seconds specified with the TIMEOUT= option elapses, then the WAITFOR statement finishes executing, and SYSRC is set to a non-zero value if one of the following is true: