February 08, 2007, 12:19 PM
LushengWhy a dialog statement (-IF &RETCODE ...) executed twice
I have the following code in a user profile:
-DOS STATE D:\Power\Users\lusheng\orgfile.foc
-IF &RETCODE EQ 0 GOTO COPYDONE;
-DOS COPY D:\Power\FileTemplates\Org\orgfile.foc D:\Power\Users\lusheng
-COPYDONE
Because the -IF statement executed twice, the second time &retcode was evaluated as 0, thus skipped the -DOS COPY command, and causing the file not found. Here is from the edaprint.log file in version 7.60 (Win2003 server).
02/08/2007 11:00:26 -DOS STATE D:\Power\Users\lusheng\orgfile.foc
02/08/2007 11:00:26 File doesn't exist
02/08/2007 11:00:26 -IF -1 EQ 0 GOTO COPYDONE;
02/08/2007 11:00:26 -IF 0 EQ 0 GOTO COPYDONE;
02/08/2007 11:00:26 -COPYDONE
02/08/2007 11:00:26 >
02/08/2007 11:00:26 -SET &&USERPATH= D:\Power\Users\lusheng;
This profile has been working since Webfocus version 4.36. Why it does not work now?
February 08, 2007, 12:57 PM
susannahLu
take the - out of your DOS statements
and put a -RUN after them.
DOS STATE D:\Power\Users\lusheng\orgfile.foc
-RUN
-IF &RETCODE EQ 0 GOTO COPYDONE;
DOS COPY D:\Power\FileTemplates\Org\orgfile.foc D:\Power\Users\lusheng /Y
-RUN
-COPYDONE
-* a /Y might be a good idea after your copy statement, forces overwrite if one already exists.
If DOS command doesn't work (doesn't for me), try CMD instead
CMD STATE ...
CMD COPY ...
works for me.
February 08, 2007, 01:24 PM
Alan BLusheng/Susannah
The STATE and COPY commands do not need a DOS or CMD.
Somewhere back in the mists of time there was a doc that had a list of 'DOS' commands that run without any prefix.
February 09, 2007, 10:20 AM
hammo1jstate requires a bit of mucking around to get it to work reliably. I have posted on this before and there is a solution that will always work if you search my posting history.