Dropping columns in a hashed file

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
jzijl
Participant
Posts: 23
Joined: Thu Jul 20, 2006 6:09 am

Dropping columns in a hashed file

Post by jzijl »

Hello,

In a DS- Job I have created a hashed file, containing 26 columns. I want to use this hashed file in several DS-Jobs.
In one of these jobs I need only 4 columns of this hashed file. What I did is I loaded the definition of the hashed file, deleted the columns I did not need in this job. When I viewed the data in the hashed file I see the 4 columns I do need but the contents of the columns is besides the key columns not correct. The non-key columns are filled with the value of the first non-key columns.

My conclusion is that when you have created a hashed file and you want to use this hashed file in different jobs you need to use the complete layout of this hashed file. Dropping columns is not recommendable. Hashed files are not 'column driven'. Is that correct?

Kind regards,

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

Post by ray.wurlod »

Hashed files are not column driven (unless accessed via a UV stage).

But you can be selective about which columns you select.

Navigation within hashed files is by ordinal position of that field within the data record. There is a Position column in the Columns grid that shows where each field is; this corresponds with the location recorded in the hashed file's dictionary.

The metadata must cover all fields in the hashed file's records. Select only those that you require from these.

If you want to delete the columns permanently, build the new hashed file (with fewer columns) over the top of the old, with Create File option checked and delete before create option also checked.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
loveojha2
Participant
Posts: 362
Joined: Thu May 26, 2005 12:59 am

Post by loveojha2 »

My conclusion is that when you have created a hashed file and you want to use this hashed file in different jobs you need to use the complete layout of this hashed file.
Not Always
Dropping columns is not recommendable. Hashed files are not 'column driven'. Is that correct?
There is no such restriction

From the Manual
By default other columns are ordered according to their position
in the file. You can also use the hashed file stage to
reorder columns as they are read in. Do this by specifying the
order you want the columns to be in the Position field. The
columns will then be written to the output link in that order,
although they retain the same column names. If you use this
feature you should identify the key column or columns by
setting their Position field to 0.
Success consists of getting up just one more time than you fall.
jzijl
Participant
Posts: 23
Joined: Thu Jul 20, 2006 6:09 am

Post by jzijl »

Hello,

Thanks for the information.

Kind regards,

Jan
Post Reply