There are a number of techniques you can use to start a child program. Key factors to take into your decision making include do you want the parent program to wait for the child program to finish? what information needs to be passed from the parent program to the child ? what environment will the child program launch in, are you in a desktop or web environment ? and are you using Genero Application Server ?
Read more at https://4js.com/ask-reuben/ig-242/
Hello Reuben,
as an alternative to RUN I'm using the following code:
define l_result integer,
l_error boolean = false,
l_channel base.channel
if ((l_channel := base.channel.create()) is not null)
then
try
call l_channel.openpipe("ls; echo $?", "r") # $? contains the return value of the previous command
if not l_channel.read([l_result])
then let l_error = true
else let l_error = (l_result <> 0) # if return value <> 0, an error occured
end if
catch
error "exception caught"
end try
call l_channel.close()
end if
The main advantage is that I can check whether the command was executed successfully because I evaluate the return value. By using RUN this can become tricky (see https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_programs_RUN.html#c_fgl_programs_RUN__CATCH_EXECUTION_STATUS (https://4js.com/online_documentation/fjs-fgl-manual-html/#fgl-topics/c_fgl_programs_RUN.html#c_fgl_programs_RUN__CATCH_EXECUTION_STATUS)).
Kind regards
Roland