Page 1 of 1

SETFILE related question

Posted: Thu Dec 23, 2004 4:21 pm
by him121
hi..
folks

i have searched forum for this keyword ..but not able to get wht i want.
here is my questions..

i am storing my hash files in to the directory...different then the default..
now this directory path is stored in to Environ parameter..

so its also not fixed....means it depends upon customer to customer...
first i want to read the path for hash files from Env. parameter ..
then i want to set VOC pointer to .....this path and then i want to read data from this HASH files..through routine...

now i want to read some data from this hash files through routine...
can any one give me ..some idea to write routine for this....


thanx in advance.

Posted: Thu Dec 23, 2004 5:21 pm
by ray.wurlod
Determine the environment variable's value however you like, for example using

Code: Select all

Call DSExecute("UNIX", "echo $HASHPATH", HashDirPath, Code)
The result is in the variable called HashDirPath.

Build your SETFILE command.

Code: Select all

Command = "SETFILE " : HashDirPath : "/" : HashedFileName : " " : HashedFileName : " OVERWRITING"
Execute your command

Code: Select all

Call DSExecute("UV", Command, Output, Code)
Check that the value of Code is zero, which indicates success.

But...

You don't need SETFILE if you're only reading via the Routine.

Determine the environment variable's value however you like, for example using

Code: Select all

Call DSExecute("UNIX", "echo $HASHPATH", HashDirPath, Code)
The result is in the variable called HashDirPath.

Build the pathname of the hashed file.

Code: Select all

HashFilePath = HashDirPath : "/" : HashedFileName
Open the hashed file using OpenPath.

Code: Select all

OpenPath HashFilePath To filevariable
On Error
   * code to handle fatal error on Open
End
Then
   * code executed if opened OK
   * (including Read statements probably)
   * finishing with
   Close filevariable
End
Else
   * code executed if failed to open
End

Posted: Thu Dec 23, 2004 5:53 pm
by him121
Hi..
Ray i try it for Windows..
but ECHO $hd is not working because command is not present..

can u please tellme for windows DS Server.

thanx...for reply

Posted: Thu Dec 23, 2004 7:25 pm
by ray.wurlod
echo IS a DOS command. However, you will need "DOS" rather than "UNIX" in the DSExecute call.

What is the exact error message returned from DSExecute? (The error message is in the third argument, the exit status is in the fourth argument.)