Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing the path as a variable in Fast Export

Status
Not open for further replies.

rkumar28

MIS
Jan 30, 2005
15
US
Hello,

I am working on Fast Export scripts to generate files in WINDOWS environment. I am hardcoding the full directory path where the output file needs to be generated.
Problem is, I have more than 30 fast export scripts and when we migrate into QA environment from DEV in WINDOWS we have to manually change the directory path which is tedious.

Can anyone guide me in how to use relative path in windows. I tried creating a variable in windows system properties that contains the path and tried calling it inside my Fast Export. But I error out, when I run my Fast Export script.

Thanks
Raj
 
Hi Raj

As the command shell (cmd.exe) does not 'process' your fastexport script, it has no opportunity to substitute your variable. So, something like "...file=%mypath%.fexpfile.dat" will be presented to fexp.exe exactly as you typed it.

You will need to edit your script in line as part of your regular processing. To do this, you will need a basic command-line editor with global search and replace functions that you can call from a batch (.BAT) file or VBScript (.VBS) file. Look up "SED for DOS" on the net for an example of the sort of program I am referring to.

The principle (though not the code) looks like this (assume batchedit.exe is the name of a Windows batch editor and that
fastexport.script contains a "file=%mypath%" line like that shown above)

/* start */

/* Globally replace all %path% by the real pathname */

batchedit.exe {command to replace %mypath% with the real path} <fastexport.script {input file} >fastexport.script.tmp {output file}

/* Run the fastexport using the edited script */

fexp.exe <fastexport.script.tmp >output.log

del fastexport.script.tmp

/* end */

Note that you pass the edited file, fastexport.script.tmp, into fastexport.

This is a very rough guide, but I believe the principle is sound.

BRgds
JG
 
Hi Raj,

1. create a environment variable in windows:
SET FEXPPATH = c:\dev\data\

2. Within your FastExport:

.ACCEPT path FROM ENV VAR FEXPPATH;

...

.EXPORT OUTFILE &path.myfile.dat

FExp will replace "&path." with "c:\dev\data\"

Dieter
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top