Can anyone tell me how to find out what directory where a hash file lives from within a Routine? This is for hash files with a VOC record. I'm sure that there's a way to get the info from the VOC, but I don't know enough to know how to do this.
Thanks very much,
Tony
Find path to a hash file from a routine
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
Code: Select all
Ans = ""
HashFileName = Arg1
open "VOC" to VOC else return
read VocRec from VOC, HashFileName then
Ans = VocRec<2>
end
Mamu Kim
The second field in the VOC record has the path to the data side of a hash file. The third field is the path to the dictionary side of a hash file. Field one should have an "F". You should probably do error checking around all these little details but this is good enough. You should be able to finish it.
Mamu Kim
-
- Premium Member
- Posts: 483
- Joined: Thu Jun 12, 2003 4:47 pm
- Location: St. Louis, Missouri USA
Thanks, Kim!
Before I saw your reply, I had it down to
The output It seemed to put @FM throughout the return string whenever it wanted to wrap the data so it would fit within it's definition of a column. Like this:
Your way returns just the path without any extraneous @FM characters, no parsing required. Yeah!!!!
Thanks!
Tony
Before I saw your reply, I had it down to
Code: Select all
SELECT FILE.NAME FROM VOC WHERE TYPE = 'F' AND NAME = 'hash_name';
I called this from DSExecute("TCL",.....)
So, the return string had 8 @FM values in it and 4 of them were within the actual path itself . I was trying to figure out how to parse out the path when I saw your reply.File Name......
/appl/asc/DataS
tage/Projects/S
CM/Common/hash_
files/ha_hash
1 records listed.
Your way returns just the path without any extraneous @FM characters, no parsing required. Yeah!!!!
Thanks!
Tony
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
A more general solution, that handles weird things that people might do (like use Q pointers or distributed files) is to use the FileInfo() function. This is able to return lots of different information about an open file, including its pathname.
Read all about it in the DataStage BASIC manual.
Read all about it in the DataStage BASIC manual.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.