Can SSELECT command be used in the "Hashed File" S

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

dsrules
Premium Member
Premium Member
Posts: 76
Joined: Sun Nov 28, 2004 8:56 pm

Post by dsrules »

Well, I had a externally pathed hash file. I created a VOC and used the in account selected when reading the hash file. In the selection tab I used @ID BY @ID, I got sorted hash file on the key.
olgc
Participant
Posts: 145
Joined: Tue Nov 18, 2003 9:00 am

Post by olgc »

Hi there,

When I have a chance to reexamine the result, it seems sorted orderly, but in a different way. The key's type is SQL Integer, but it is sorted as string. The result is as the following. How can hashed file be sorted as Integer (coresponding to its key data type, not as string)?

Result:

1
10
100
10000
10001
...
10009
1001
10010
..
10019
1002
10020
..

The order I want is:

1
10
100
1001
1002
10000
10001
...

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

Post by kduke »

I would use a UV stage and a SQL SELECT. You can either fix the dictionary item or add one or use an EVAL.

Code: Select all

SELECT * FROM MyHashFile ORDER BY EVAL '"@ID" FMT '3R';
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can do this with a Hashed File stage. The sort phrase is augmented with the FMT field qualifier. You don't need EVAL if using a Hashed File stage.

Code: Select all

BY @ID FMT "10R"
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
olgc
Participant
Posts: 145
Joined: Tue Nov 18, 2003 9:00 am

Post by olgc »

I try Ray's method, and it works very well.

Thanks all your guys!
Post Reply