Skip to main content
Question

File operation with replacement of environment variable

  • February 24, 2026
  • 3 replies
  • 28 views

Ingo Stiller
Forum|alt.badge.img+3

We do all our exports to CSV by lfieldump and this works for years

Now, however, a customer came up with the idea of using a DOS environment variable to determine the directory instead of fixed directories.
So instead of "Q:\outpute\export1.csv,"
it should now be "%app_export%\export1.csv"
(where app_export is defined differently on each client).
Unfortunately, Uniface cannot handle this; the file system converts it to "?app_export?\export1.csv," and the file system complains.
Is there a simple solution for this, i.e., any letter combinations that can be used at the file system level to resolve "%%app_export%"?

Of course, I can use a few tricks to ask Windows/DOS what the resolution is before each fieldump, and then replace that part. 
But I'm reluctant to check all our programs for this and make changes :-)

A customer 

3 replies

Iain Sharp
Forum|alt.badge.img+5
  • Inspiring
  • February 24, 2026

So an example from my asn files is 

ide_state.zip    \\server\States_%%($USERNAME)\develide_state.zip

Where %%($USERNAME) extrapolates to the environment variable %USERNAME%. 

Not sure where the original pathname you are using is coming from in the code, but if you can global replace with something, you can replace with $logical, and then use the substitution on the asn file. 

This is 10.4, I think it was enabled 10.3…. 

Regards, 

Iain
 


Gianni Sandigliano
Forum|alt.badge.img+3

Hi Ingo,

Your current expectation is that Windows (NON Uniface!) convert %app_export% to the equivalent environment value; unfortunately this variable substitution is NOT system wide but it is explicitly built into cmd.exe, like it was in command.com before, in older Windows versions.

I feel in Uniface you should use $settings() function to collect that environment variable… something like:
“%%$setting ("", "APP_EXPORT", "ENVDATA")%%%\export1.csv”.

Hope it helps…

Regards,
Gianni

 


Juliano Anoar Haoach Garcia
Forum|alt.badge.img+1

Hi Ingo,

Your current expectation is that Windows (NON Uniface!) convert %app_export% to the equivalent environment value; unfortunately this variable substitution is NOT system wide but it is explicitly built into cmd.exe, like it was in command.com before, in older Windows versions.

I feel in Uniface you should use $settings() function to collect that environment variable… something like:
“%%$setting ("", "APP_EXPORT", "ENVDATA")%%%\export1.csv”.

Hope it helps…

Regards,
Gianni

 

That's right