Page 1 of 1

count on hash file

Posted: Mon Nov 29, 2004 11:05 am
by bobby
hi,
i have 2 columns in my hash file aa1 aa2, i want count of rows on cloumn aa1 in hash file
on column aa1,
i tried wc -w hashfile
it dont gave me count,
plz advice.
Thanks
Bobby

Posted: Mon Nov 29, 2004 11:20 am
by KeithM
I think your problem might that you are trying to use a Unix command in Windows.

Posted: Mon Nov 29, 2004 11:22 am
by kcbland
Dynamic hash files are binary data structures, you cannot simply do text file commands against them.

If you want to run SQL against a hash file, then search the forum for the ways to do that. If your hash file exists within a project (not fully qualified path), then use the DS Admin client and you can run SQL statements against the hash file. If the hash file is externally pathed, then you must use SETFILE to register the hash file for SQL commands first.

It's all been covered on the forum...

Posted: Mon Nov 29, 2004 11:22 am
by bobby
hi
server is in unix

Posted: Mon Nov 29, 2004 12:21 pm
by coolkhan08
Try this

Code: Select all

SETFILE HashFilePath HashFileName OVERWRITING

Code: Select all

Count HashFileName
U have to execute it on the command line interface in Admin else u can telnet into the server and in the uv shell execute this commands.
[/code]

Posted: Mon Nov 29, 2004 1:25 pm
by bobby
Hi
i am getting this error

$ SETFILE datastage01/NIN/NIN_hash updatecdatecoded OVERWRITING
ksh: SETFILE: not found
plz advice
Thanks
Bobby

Posted: Mon Nov 29, 2004 2:28 pm
by dsrules
R u in uvsh? Did you the try the Admin Client on your Windows.?

Posted: Mon Nov 29, 2004 3:14 pm
by ray.wurlod
Use your Administrator client Command window.

The SETFILE command, if entered correctly, will work from there. It reports that a pointer has been established or that an error has occurred. If the latter you must not proceed until your SETFILE has been successful.

A hashed file is a database table, so you can use regular SQL queries on it. Beware, however, that it is case sensitive. That is, table names and column names must be entered with correct casing.

The number of rows should be the same for each column; I am not sure what you mean by "i want count of rows on cloumn aa1". You can count them with the COUNT command as shown by an earlier poster, or using SQL, for example

Code: Select all

SELECT COUNT(*) FROM updatecdatecoded;
SELECT aa1, COUNT(*) FROM updatecdatecoded GROUP BY aa1;
SELECT EVAL "If IsNull(aa1) Then 'NULL' Else aa1", COUNT(*) FROM updatecdatecoded GROUP BY aa1;