batch file of dreport commands and global variables

Kenneth Brody kenbrody at spamcop.net
Sun Mar 20 09:48:17 PDT 2016


On 3/18/2016 5:12 PM, Richard Veith via Filepro-list wrote:
> Hi,
>
>     We run batch files consisting of 10 to 20 commands that begin with
> "dreport " to execute various FilePro programs (processing tables).  A
> number of these programs all need the same variable whose content changes
> monthly.  Is it possible to somehow declare a global variable at the
> beginning of the batch file and be able to use it in subsequent executions
> of the dreport commands?
>
>    I tried declaring the variable Global and defining its content in the
> first program, and then declaring it Extern in later programs, but the later
> programs do not get the variable's value.  It seems to be lost between
> dreport executions.  I also tried CALLing a short program that defined the
> variable and its content (again with the Global declaration) from each of
> the programs that need it (with the Extern declaration), and that worked in
> some cases, but for programs that run against a file of about 20 million
> records, the processing would prematurely end with an out-of-memory error.

Variables only hang around as long as filePro is running.  Once filePro 
exits, all variables are gone.

Is this variable being set by the first processing that runs?  If that's the 
case, I would suggest using PUTENV to set an environment variable, SYSTEM to 
the other programs, and GETENV to read that variable.

(Just like filePro variables, environment variables "go away" once the 
program exits, so you can't set it in the first dreport, exit, and expect it 
to still be set.)

-- 
Kenneth Brody


More information about the Filepro-list mailing list