Hashed file key separation

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
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Hashed file key separation

Post by snassimr »

I need to get hashed value with rotine and I dont knoe exactly how keys in hashed value separated .

I try HashKey=Key1:@TM:Key2

and i isnt work .

Any ideas ?
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

The separator that DataStage uses with composite hashed file keys is the @TM (text mark). So if in a DataStage job you have a composite key for Country and City and you wish to read this record from a BASIC program, you would use a key value such as 'London':@TM:'England' to get a record.
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

I get error :
Result = Program "TSTGetHashValue.B": Line 5, Variable "ANS" previously undefined. Empty string used.

What does it mean ?
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

Ok > I understand it . It was my mistake.

But still @TM not working . I tried all combination of @TM , Key1 or Key2

Any ideas ?
snassimr
Premium Member
Premium Member
Posts: 281
Joined: Tue May 17, 2005 5:27 am

Post by snassimr »

Sorry It was my mistake

Key1:@TM:Key2 Working
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Variable names are case sensitive.

You have assigned a value to ANS, but the routine wants to return Ans.

You must use Ans throughout (because you can not change the RETURN(Ans) function).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

ray.wurlod wrote:Variable names are case sensitive.

You have assigned a value to ANS, but the routine wants to return Ans.

You must use Ans throughout (because you can not change the RETURN(Ans) function).
Hi,
Sorry Ray but I beg to differ regarding the must use Ans part.
There is no limit on using your own RETURN(ANS) as long as the ANS variable was assigned a value (or using any other variable/constant in a RETURN(x) command).

I do agree that this was not what the writer intended and should have used Ans.

For clarity,readability and maintainability I recomend using the standard Ans variable for returned value from routines.

As Ray said DS Basic is case sensitive.
It also demands that any use of variables not being assigned must be previously declared or assigned a value.
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you rely on the generated RETURN(Ans) function, which lives in a little greyed-out area at the bottom of the Routine, you can't change it.

Roy is correct in that you can make it redundant by preceding it with your own. However, the problem as originally posted was that ANS was not being assigned a value. It was based on this error message that I posted my solution.
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