Bastien
7th February 2003, 18:22
Hi everyone,

I'm trying to launch the "diff" command from a program script.

I'm on BaanV, WinNT.

The diff command is in g:\baan50c\bin, and named in NT "diff.exe".

I tried to run: ret = run.baan.prog("diff","path&file1 path&file2 > path&file3", RP_WAIT).
I also tried ret = run.prog("\baan50c\bin\diff.exe","path&file1 path&file2 > path&file3", RP_WAIT).

Each time, it doesn't work and returns the error code 2.

I really don't know haw to solve this issue. I've tried to read all the threads related to this subject, but I haven't found the answer.

Thank you in advance for your help.

Have a great day!

NPRao
7th February 2003, 21:05
Bastien,

I think you mixed the BaaN operator "&" with the arguments in the function calls and its not clear to debug. Hence the problem.

I tried to run: ret = run.baan.prog("diff","path&file1 path&file2 > path&file3", RP_WAIT).
I also tried ret = run.prog("\baan50c\bin\diff.exe","path&file1 path&file2 > path&file3", RP_WAIT).

You should try to make a clear coding for others to understand.
Try this-

string progname(80)
string args(80)
string output(80)
progname = "diff"
args = path & file1 & " " & path & file2
output = path & file3
ret = run.prog(progname, args & " > " & output, RP_WAIT)

Looking at the help options for the diff -

diff6.2 --help
Usage: diff6.2 [OPTION]... FILE1 FILE2

-O FILE --redir-stdout FILE Redirect stdout to FILE
-E FILE --redir-stderr FILE Redirect stderr to FILE
-i --ignore-case Consider upper- and lower-case to be the same.
-w --ignore-all-space Ignore all white space.
-b --ignore-space-change Ignore changes in the amount of white space.
-B --ignore-blank-lines Ignore changes whose lines are all blank.
-I RE --ignore-matching-lines=RE Ignore changes whose lines all match RE.
-a --text Treat all files as text.

You can also change the code as -
ret = run.prog(progname, args & " -O " & output, RP_WAIT)

Bastien
10th February 2003, 11:44
Thank you very much MPRao,

In fact I didn't precise that the "&" symbol I used in my examples was not the command "&"; I just wanted to show that I had correctly written the file path + the file name.

But your answer gave me the solution: the ">" didn't work but if I use " -O " instead, it works fine!! (I don't know where it comes from, but it works!)

Thank you again.

Have a great day.

NPRao
10th February 2003, 20:38
Bastien,

The $BSE/bin/sort[versioncode:6.2] is a BaaN executable. It might have some different options than the Unix Sort. In Unix ">" is the redirection to a different/output file and "&" is to set a process to execute in Background. In BaaN sort, they have provided the option -O for the output file and "&" for the append/concatenation operator.

Glad it worked out for you.