Re putenv(). getenv

Fairlight fairlite at fairlite.com
Mon Jan 12 20:51:27 PST 2015


You didn't do a great job describing the flow, but if my educated guess is
correct, the first dreport sets the env var, and the second tries to use
it?  If so, that will never work.

Env vars are inherited.  The batch file -never sees- any env var set by
dreport.  Those env var settings only exist from dreport on down through
any children run by system(), -under- the instance where they're run.

You can pass env vars downwards, but never back upwards again, and they'll
never be shared by processes at the same child-level of process if they're
first set by one process at that shared level.  They'd have to pre-exist,
and even then no changes would actually propogate to the other commands
called at the same level.  "Upwards" could be used to describe anything run
at the same level, because you pop down a level inside dreport, and then
back up a level upon its exit.

mark->

On Mon, Jan 12, 2015 at 04:38:45PM +0000, Richard Kreiss thus spoke:
> I have a -v select process which counts the number of records selected.
> 
> When @done executed:
> @done  ? If: '****************************************************************
>        Then: '*
>  88  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then: MSGBOX "Creating RecordCount of"<rs
>  89  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then: putenv "RecordCount",rs
>  90  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>        ? If:
>        Then: MSGBOX "Count is"<getenv("RecordCount")
> 
> 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.
> @Echo off
> Title Test of Sequencing
> Echo Deleting Demand Index 0
> dprodir transaction -I 0
> dreport transaction -f sort_sequence -v sel_sequence -a -y !! -ik -o0 -u
> set RecordCount
> @pause
> @echo About run sequence program
> @pause
> %pfprog%/fp/dreport library -f do_sequence -sr "1" -u -db
> 
> 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?
> 
> Richard Kreiss
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> Subscribe/Unsubscribe/Subscription Changes
> http://mailman.celestial.com/mailman/listinfo/filepro-list

-- 
Audio panton, cogito singularis.


More information about the Filepro-list mailing list