Page 1 of 1

First column in Hashed file should be a keyfield

Posted: Mon Jan 22, 2007 2:41 am
by jzijl
Hello,

I have read that the first column of a hashed file should be a keyfield. In the application I work on I have seen that this is not always the case although the job does what it has to do.

Can you tell me what the consequences are when the first column in a hashed file is not a keyfield and what if multiple key columns in a hashed file are not adjacent.

Kind regards,

Jan

Posted: Mon Jan 22, 2007 4:13 am
by ray.wurlod
Hashed files are not navigated by field name or even by position in the grid, but by position in the data record. In the Columns grid on a hashed file stage you will find a column called Position; any field (column) with Position 0 is a key, while non-key fields are numbered 1, 2, 3 and so on.

Provided the table definition was imported from the hashed file itself, and not edited, then the order in the Hashed File stage is not particularly relevant.

Physically, however, the key is stored ahead of the non-key fields in a hashed file, so nominating the field positions in the correct order leads to more efficient I/O.