To start a Windows program synchronously, you must use a DOS batch file. The batch file might look like (see also Start an OS/2 program synchronously and StartDOS):
REM *** DOS Batch
REM Usage: DOSSTART.BAT semFile windowsProgram {progParameters}
REM
SET semFile=%1
SET programName=%2
SET parameter=%3
:pLoop
SET parameter=%parameter% %3
SHIFT
IF NOT "%3" == "" GOTO pLoop
%programName% %parameter% >%semFile%
exit
The calling REXX program might look like
/* sample code to start a Windows program synchronously */
/* load the necessary REXXUTIL function(s) */
call rxFuncAdd "SysSleep", "REXXUTIL", "SysSleep"
/* name of the "semaphore" file */
/* Note: Use a routine like for example */
/* Get a name for a temporary file */
/* to get a unique name for the semaphore */
/* file if you want to run this program */
/* in separate sessions at the same time. */
semFile = 'd:\sem'
winProg = 'd:\win\apps\excel4\excel'
'DOSSTART.BAT' semFile winProg
do forever
say 'Waiting for the Windows Session ... '
if stream( semFile, 'c', 'OPEN READ' ) = 'READY:' then
leave
call SysSleep 1
end
/* close and delete the "semaphore" file */
call stream semFile, 'c', 'CLOSE'
'del ' semFile '2>NUL 1>NUL'