HashFileLookup

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
nibble
Premium Member
Premium Member
Posts: 10
Joined: Mon Feb 06, 2006 7:49 am

HashFileLookup

Post by nibble »

The UtilityHashLookup function only works on the VOC file.
If I Change the code to access one of my own HashFiles (Openpath instead of Open). I get an Improper Data Type error message, no matter what!!

The sections that fails is:
Read RecFrom FileHandlers(POS), KeyField Then
Ans = Rec<1>

Is there some magic to this ?
The error message is there even if I input NULL values on key column and column number...

Any ideas anyone ?
Chris
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, you copied the routine and the only change was from Open to OpenPath, yes? If that's the case, then the problem would not be with the routine itself but how you are calling it.

Can you provide an example of your calling syntax, please?
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

How did you change that code. Make sure you only changed 'Open' to 'OpenPath'.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Re: HashFileLookup

Post by ArndW »

nibble wrote:...I get an Improper Data Type error message, no matter what!!...
This error message occurs when the file unit ("FileHandlers(POS)") is invalid - this occurs when your OPEN or OPENPATH has failed. Can you post that statement? You cannot just add the "path" to the the statement, as the syntax of both calls are different.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

ArndW wrote:You cannot just add the "path" to the the statement, as the syntax of both calls are different.
Actually, you can as that's exactly what I've done here and it works just peachy. As noted, the syntax to call the routine is slightly different - you need to pass in the full path to the hashed file rather than just the VOC name. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

I am so used to using the OPEN '','FILENAME' syntax that I didn't check to make sure that the first parameter is actually optional until I went to check after reading Craig's statement. I stand corrected, the syntax of both statements is identical.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

It's a problem that you're remembering the old days (Prime), when the "" in the OPEN statement was necessary. If my memory serves it was made optional in about version 6 of Prime INFORMATION.

Waiting for nibble to respond with code and call before chasing any red herrings.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
nibble
Premium Member
Premium Member
Posts: 10
Joined: Mon Feb 06, 2006 7:49 am

Changes to the code

Post by nibble »

I changed the value of the HastTable variable to contain path and filename:
HashTable = 'hasfilepath' : Arg1

When I do this change, the function manages to locate the file, if I don't, the function failes to locate the file.

The second change was change of Open statement to Openpath.

That's it !

The hasfile has one key column...

Chris.
chulett wrote:So, you copied the routine and the only change was from Open to OpenPath, yes? If that's the case, then the problem would not be with the routine itself but how you are calling it.

Can you provide an example of your calling syntax, please?
Chris
nibble
Premium Member
Premium Member
Posts: 10
Joined: Mon Feb 06, 2006 7:49 am

Calling the function

Post by nibble »

I haven't used the function in the ETL job yet, I only use the Test Function functionality.

Christer.
chulett wrote:So, you copied the routine and the only change was from Open to OpenPath, yes? If that's the case, then the problem would not be with the routine itself but how you are calling it.

Can you provide an example of your calling syntax, please?
Chris
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

What does your function do for the ELSE part of the OPENPATH?
nibble
Premium Member
Premium Member
Posts: 10
Joined: Mon Feb 06, 2006 7:49 am

Else statement

Post by nibble »

That's the DSRMessage function call.

Chris.
ArndW wrote:What does your function do for the ELSE part of the OPENPATH?
Chris
nibble
Premium Member
Premium Member
Posts: 10
Joined: Mon Feb 06, 2006 7:49 am

Error located

Post by nibble »

Seems that the problem is when the file is in cache.

If the file is in cache, in other words if this command returns true:
Locate HashTable in FilesOpened Setting POS Then

Then this section fails:
Read Rec From FileHandles(POS), Keyfield Then

With the error:
Improper data type

Why ?

Chris.
ArndW wrote:What does your function do for the ELSE part of the OPENPATH?
Chris
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

Print out the value when you get the error - that might give you a clue as to what is happening. It won't print if it is a proper file pointer, but the error message you are getting already tells us that it isn't correct.
Post Reply