| Compiling 
                                DataFlex Programsby Curtis KrauskopfThis 
                          article provides a way to conveniently compile arbitrary 
                          groups of DataFlex source files on a single command 
                          line. The filenames on the command line can contain 
                          wildcards. The ProblemThe 
                          DataFlex compiler, dfcomp, 
                          normally displays compile-time errors directly on the 
                          screen. For example, when the program being compiled 
                          is
                         
                           
                            | // prog.src:
// This program has 3 compile-time errors.
integer i
for i from 1 to 10
  showlnx i    // should be showln
loop
string akey 1
inkey ackey    // should be akey
 |  and the compiler is executed as  
                          
                         the DataFlex compiler reports on the screen. For single programs, this 
                          is acceptable because the compiler immediately tells 
                          you when it encountered a problem. Sometimes, however, an entire project 
                          needs to be completely recompiled. Unfortunately, the 
                          DataFlex dfcomp compiler doesn't allow us to use:  
                          
                         Even if it were possible, it would be 
                          inconvenient to have to baby-sit the compilation. Each 
                          error encountered during compilation will stop the dfcomp 
                          compiler and it will wait for the programmer to acknowledge 
                          the error message. A SolutionOn Windows, the FOR 
                          command can be used to process a group of files. The 
                          syntax to use on the command line is  
                          
                             
                              | for %s in (*.src) do dfcomp 
                                  %s |  If the above command is put into a batch 
                          file, then each of the % signs needs to be doubled, 
                          like this: 
                           
                            | 
dfc.bat:
for %%s in (*.src) do dfcomp %%s
 |  This is a convenient batch file but it's 
                          restricted (hard-coded) to a specific set of source 
                          files (*.SRC). For example, 
                          let's say my Accounts Payable programs start with AP* 
                          and my General Ledger programs start with GL*. 
                          I could have two batch files that compile each group: 
                          DFC_AP.BAT would compile 
                          all of my AP*.SRC files 
                          and DFC_GL.BAT would compile 
                          the General Ledger files. The DFC_AP.BAT 
                          file would look something like:  
                          
                             
                              | for %%s in (AP*.src) do 
                                  dfcomp %%s |  and the DFC_GL.BAT 
                          file would look something like:   
                          
                             
                              | for %%s in (GL*.src) do 
                                  dfcomp %%s |  Next: 
                          User-Specified Parameters Jump 
                          Directly To...User-Specified 
                          Parameters
 Don't 
                          Stop on Errors
 Improvements
 Summary
 Go 
                          to DataFlex TipsCopyright 2003-2010 The Database Managers, Inc.
   |