Setnames

Top  Previous  Next

Establishes or redefines three control variables so they contain the drive subdirectory, filename and extension of a file named with full path.

 

$setnames filename v1 v2 v3

 

where filename is any file name

v1is the name of a control variable that will contain the name of the subdirectory where the file is located
v2is the name of a control variable that will contain the root name of the file
v3is the name of a control variable that will contain the extension of the file

 

Thus (condcomp.gms)

 

$setnames d:\gams\xxx.txt filepath filename fileextension

 

separates the filename d:\gams\xxx.txt  into its three components placing d:\gams\ into filepath, xxx into filename and .txt into fileextension.

The three items may be recombined back into the original filename string by using %v1%%v2%%v3% in a command like (condcomp.gms).

 

$setglobal name %filepath%%filename%%fileextension%