Find path to a hash file from a routine

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Find path to a hash file from a routine

Post by tonystark622 »

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
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

Code: Select all

Ans = ""
HashFileName = Arg1
open "VOC" to VOC else return
read VocRec from VOC, HashFileName then
   Ans = VocRec<2>
end

Mamu Kim
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

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
tonystark622
Premium Member
Premium Member
Posts: 483
Joined: Thu Jun 12, 2003 4:47 pm
Location: St. Louis, Missouri USA

Post by tonystark622 »

Thanks, Kim!

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",.....)
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:
File Name......

/appl/asc/DataS
tage/Projects/S
CM/Common/hash_
files/ha_hash

1 records listed.
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.

Your way returns just the path without any extraneous @FM characters, no parsing required. Yeah!!!!

Thanks!
Tony
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

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.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply