Focal Point
Why a dialog statement (-IF &RETCODE ...) executed twice

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/4861071212

February 08, 2007, 12:19 PM
Lusheng
Why 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
susannah
Lu
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.




In Focus since 1979///7706m/5 ;wintel 2008/64;OAM security; Oracle db, ///MRE/BID
February 08, 2007, 01:24 PM
Alan B
Lusheng/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.


Alan.
WF 7.705/8.007
February 09, 2007, 10:20 AM
hammo1j
state 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.



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo