Compiling DataFlex Programs
by Curtis Krauskopf
Emilio Moura sent an email that gave his
solution for compiling multiple DataFlex programs. His
solution uses the ERRORLEVEL
setting. DFCOMP sets this
to 1 when there is a compile-time error. I verified
backward compatibility by testing this on an old DataFlex
2.3 development license.
The error reporting in Emilio's solution
is also improved by logging the file names of programs
with compile-time errors into a text file. When compilation
is finished, his batch file checks if the error log
file exists -- if so, he simply has it typed to the
screen. I like this solution much better than the "File
Not Found means there were no compile-time errors"
message in my earlier version.
I have merged the best features of Emilio's
solution with the dfc.bat
batch file. This is the result:
REM Created by Curtis Krauskopf
REM October 9, 2003
REM The Database Managers, Inc.
REM Permission to use this batch file is granted
REM provided this banner stays in the file.
REM June 23, 2006: Portions improved by Emilio.
if x%1==x goto instructions
REM Eliminate all .ERR files. Create one .ERR file
REM so that the del command doesn't complain that
REM no files were deleted.
echo x > 1.err
del /q *.err
if exist error.txt del error.txt
REM Compile the %1 parameter
for %%s in (%1) do call _dfc.bat %1
if x%1 NEQ x goto compileAgain
if exist error.txt more error.txt
echo You need to provide a filename (with optional
echo wildcards) that is used to compile the programs.
echo Example: %0 AP*.src menu.src GL*.src
REM This is a helper batch file for dfc.bat
dfcomp %1 -v1fskw
if errorlevel 1 goto errorfound
echo %1 >>error.txt
Emilio's solution uses two batch files.
In this implementation, I've named them dfc.bat
and _dfc.bat. The second
batch file, _dfc.bat,
is a helper batch file for the main dfc.bat
batch file. The reason we need a second batch file is
because the for-do command
can only take one parameter but we need to do multiple
things (compile the file, check the error level and
append to a text file).
The example command line is still the
Copyright 2003-2010 The Database Managers, Inc.
dfc AP*.src menu.src