Powerbuilder does not wait for the process called by Run() . The return values โโof Run() are based solely on whether it successfully called the external process, and not on what the next external process did.
This means that pdftk most likely completed correctly, but you tried to get the exit too quickly. You will need to find some kind of development method when it is complete. Perhaps call it from a batch file that creates another file before it is completed, and then in Powerbuilder will check for the presence of this file.
Alternatively, you can use another method to call an external process. This is an example of invoking an external process using the Windows Scripting Host:
OleObject wsh CONSTANT integer MAXIMIZED = 3 CONSTANT integer MINIMIZED = 2 CONSTANT integer NORMAL = 1 CONSTANT integer HIDE = 0 CONSTANT boolean WAIT = TRUE CONSTANT boolean NOWAIT = FALSE wsh = CREATE OleObject li_rc = wsh.ConnectToNewObject( "WScript.Shell" ) li_rc = wsh.Run(ls_runinput, HIDE, TRUE)
(sample code cut from Stuart Dalby's website ).
If you still can't get it to work, your best bit is to break it down and make sure you can first make FileOpen in a pre-existing file, and then check externally that the output of the process called Run() is correct ( ultimately).
Just for reference symbol | It is not a special character and does not need to be escaped in a string.
source share