Program requests

Program requests are requests for batch files or executables. WindowsEnabler uses Windows API's to start the programs. The API's will use the standard Windows search path to look for the program. Therefore, you do not always have to specify complete paths for the programs. The command STRWINPGM CMD(NOTEPAD) will work on most PC's, since NOTEPAD.EXE is usually located in the search path. If your program is properly registered or located in the search path you only have to specify the program name, otherwise you will have to specify a full-qualified path.

Please make sure that you enclose long file names that contain spaces in double quotes. To avoid possible problems you should always enclose file names in double quotes.

Waiting for completion

When you issue a program request you can use the WAIT parameter with a value *YES. When you specify this value WindowsEnabler will wait until the program terminates and send the return value of the program to the AS/400. Please note that the use of this parameter will not always have the desired result. Some applications use a driver program that is used during start-up. This driver program starts another program and then terminates. WindowsEnabler can only wait for the termination of the driver program and not of programs started by such a driver. Microsoft Word is an example of an application that uses this technique. When you issue STRWINPGM CMD(WinWord) WAIT(*YES) you request is completed once Word is started, because at that point the driver program terminates.

Return values

PC programs always yield a numerical return value. When WindowsEnabler waits for the completion of a program it captures this return value and sends it to the AS/400 where your program can read and interpret this value. The meaning of the return value is determined by the PC program. There is a convention among PC programmers that a return value of 0 means success and any other value means failure. A program can use more than 1 value to specify different types of errors. This specification is however a convention and is not enforced. Every PC program can give a different meaning to the return value. You should consult the documentation of your PC programs for more information.