All Forums General
S_Banerjee 15 posts Joined 02/09
04 Jun 2012
File export from BTEQ

How to creat a new fresh export file after running the bteq script. Don't want to manually delete the existing file and not willing to append the new record to the existing one.

.EXPORT report File = directory_path/XYZ.txt

this will append output record every time the script will run...I don't want this.

 

Thanks,

Banerjee

CarlosAL 512 posts Joined 04/08
04 Jun 2012

HI.

 

.OS rm -f directory_path/XYZ.txt;

.EXPORT report File = directory_path/XYZ.txt;

...

 

HTH.

Cheers.

Carlos.

S_Banerjee 15 posts Joined 02/09
04 Jun 2012

Thanks man..this will work..but my requirement was not to delete the entire file and just empty the file content.

I think this will be more appropriate..since I dont know whether the .EXPORT command with some option can handle this or not.

cat /dev/null > directory_path/XYZ.txt

Thanks,

Banerjee

asadali.khan 11 posts Joined 10/10
17 Sep 2012

Much appropriate way of doing this is to check the file if it exists. 
 
-- If condition to check if the files exists; If it does then remove it.
.OS IF [ -f directlry_Path/XYX.txt]; then
.OS rm -f directory_path/XYZ.txt; 
fi;
 
NOTE: BTEQ doesn't support multi line OS commands. This is how you would use it in bteq
 
.OS IF [ -f directlry_Path/XYX.txt];  then rm -f directory_path/XYZ.txt; fi;
 
 
 
 

Asad Ali Khan

miajones 1 post Joined 09/12
17 Sep 2012

Wow!! superb, this may help me alot, thanks for it.

You must sign in to leave a comment.