Re putenv(). getenv
Richard Kreiss
rkreiss at verizon.net
Mon Jan 12 09:32:38 PST 2015
> -----Original Message-----
> From: Filepro-list [mailto:filepro-list-
> bounces+rkreiss=verizon.net at lists.celestial.com] On Behalf Of Kenneth
> Brody
> Sent: Monday, January 12, 2015 11:55 AM
> To: Richard Kreiss; filepro-list at lists.celestial.com
> Subject: Re: Re putenv(). getenv
>
> 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.
I needed to add a control file for use in another process which would use
the records involved.
I added fields to this fiel to handle the values Involved.
My original programming had the -v and output process together. The output
processing got very complicated so I moved it to a library function reading
the records from the demand index created by the processing using the -v
process. This made it much simpler to handle each record.
I probably would have had similar results if I had used @wsbrk but I didn't
and my programming is working properly.
Thanks for clearing that up.
Richard
More information about the Filepro-list
mailing list