Re putenv(). getenv

Richard Kreiss rkreiss at gccconsulting.net
Mon Jan 12 08:38:45 PST 2015


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


More information about the Filepro-list mailing list