The Database Managers, Inc.

Contact The Database Managers, Inc.


Use an RSS enabled news reader to read these articles.Use an RSS enabled news reader to read these articles.

DataFlex Decompiler

Compiling DataFlex Programs

by Curtis Krauskopf

This 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 Problem

The 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

dfcomp prog.src

the DataFlex compiler reports

DataFlex Compiler, V3.1d
Copyright 1981-1998 Data Access Corporation Miami FL, USA - All Rights Reserved

Compiling Program: prog.src
  showlnx i // should be showln
ERROR: 164 COMMAND NOT FOUND: SHOWLNX ON LINE: 7 (7) OF FILE: prog.src

Do you want to abort the compiler (Y or N) _

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:

dfcomp *.src

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 Solution

On 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 Tips

Copyright 2003-2010 The Database Managers, Inc.

 

DataFlex: Tips | Freeware | WebApp Server | Books | Links
Services | Programming | Contact Us | Recent Updates

Send feedback to: