Ask the Experts - 46
Thanks for posting your question!
Exec is a cross-platform function that executes an external program on either UNIX or Windows.
This function has two parameter conventions in order to maintain upward compatibility with existing programs.
The function can make either a synchronous or asynchronous call. Synchronous execution acts as a “modal” function, suspending the PeopleSoft application until the called executable completes. This is appropriate if you want to force the user (or the PeopleCode program) to wait for the function to complete its work before continuing processing. Asynchronous processing, which is the default, launches the executable and immediately returns control to the calling PeopleSoft application.
If Exec is unable to execute the external program, the PeopleCode program terminates with a fatal error. You may want to try to catch these exceptions by enclosing such statements in a try-catch statement (from the Exception Class).
&ExitCode = Exec(“touch test.txt”, %Exec_Synchronous + %FilePath_Absolute);
Please refer to PeopleBooks for further details.