Re putenv(). getenv
Kenneth Brody
kenbrody at spamcop.net
Mon Jan 12 08:54:43 PST 2015
On 1/12/2015 11:38 AM, Richard Kreiss wrote:
> I have a -v select process which counts the number of records selected.
>
> When @done executed:
[...]
> Then: putenv "RecordCount",rs
[...]
> The first message box shows the records count/
> The next msgbox reads back the environmental variable created and shows the same amount.
>
> I need to pass the parameter to another process which is running from the batch file.
[...]
> dreport transaction -f sort_sequence -v sel_sequence -a -y !! -ik -o0 -u
> set RecordCount
[...]
> As Ken has often stated, the environmental variable can only be passed
> if it is with the same working environment. i.e. filePro's variables set in
> startup file.
>
> When the sel_sequence ends and returns to the batch file which then
> executes set RecordCount, I get the error message:
> C:\DATABASES\CCP>set RecordCount
> Environment variable RecordCount not defined
> Press any key to continue . . .
>
> Why if prior to exiting, RecordCount exists as a variable which is set,
> should it disappear as a set variable at the command line?
The key words are "prior to exiting".
I believe you misunderstood what I have said about environment variables.
You can only affect the current process, and it's *children* (and only those
children created after the change is made), not "the same working environment".
When you run dreport, any changes it makes to its environment are *not*
passed back up to its parent process. When dreport exits, its environment
is discarded along with any other resources it was using.
Think of this in terms of genetics. Suppose you undergo some gene therapy
which makes you hair purple -- PUTENV("HAIRCOLOR","purple"). Your parents'
hair is not affected. Nor is the hair of any existing children. Only your
hair, and the hair of children conceived after the change was made, will be
affected.
--
Kenneth Brody
More information about the Filepro-list
mailing list