batch file of dreport commands and global variables
Richard Kreiss
rkreiss at gccconsulting.net
Sat Mar 19 12:53:55 PDT 2016
> -----Original Message-----
> From: Filepro-list [mailto:filepro-list-
> bounces+rkreiss=verizon.net at lists.celestial.com] On Behalf Of Richard Veith
> via Filepro-list
> Sent: Friday, March 18, 2016 5:13 PM
> To: filepro-list at lists.celestial.com
> Subject: batch file of dreport commands and global variables
>
> 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.
>
>
>
> Thanks,
>
> Rich
At the start of your batch file(windows)
Set Whatever= your variable.
In processing, use qq=getnenv("Whatever")
Another method would be to run a small filepro program which requests the value for whatever and then do a putenv (whatever, value).
As long as all of the outputs are being run from the same batch file, they should be able to get the value set.
Another way to do this would be to have a 1 record file which holds the value. Get the value, post it to this record and then have all of the outputs lookup the value. Have the last program delete the lookup record at @done.
You might want to also check if the record exists and if so, what the @cd or a stored date is to insure that the current value is being used.
Richard Kreiss
GCC Consulting
More information about the Filepro-list
mailing list