Counting records in a hash 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
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Well, from what I recall - from the Administrator you can connect to the project and then execute a "SELECT COUNT(*) FROM HASH_FILE_NAME" query. You can do the same thing inside a job, but I think you have to do it via a Universe stage.

-craig
nigel
Premium Member
Premium Member
Posts: 35
Joined: Tue May 07, 2002 2:48 am
Location: South Africa/UK
Contact:

Post by nigel »

You could also log into DS administrator and at the command area issue the following command: "COUNT hashfilename".
This is using the native DS/UniVerse retrieve commands

Regards

Nigel

Nigel
DSGuru
Participant
Posts: 16
Joined: Fri Feb 15, 2002 4:46 pm

Post by DSGuru »

I believe these count methods just work for INTERNAL hash file and NOT EXTERNAL hash file. So how do we count EXTERNAL hash file?

Thanks for your time in advance.


Leon
cmueller
Participant
Posts: 46
Joined: Wed Oct 23, 2002 7:10 am

Post by cmueller »

The normal command for accessing hashed files require that they have a pointer in the project VOC file. Below, is a routine that takes the path of the hashed file as argument, then creates a temporary entry in the VOC, counts the hashed file and then deletes the pointer. I tried using the openpath statement in DataStage basic but there was not way to get the count unless I looped through all the records. -Hope this helps.

* OPEN PROJECT VOC AND WRITE A POINTER TO THE HASHED FILE 01:F 02:HASHED FILE PATH 03:D_VOC
OPEN "VOC" TO FV THEN
VOC_POINTER = "TMPPOINTER":DATE()
VOC_ENTRY = "F":@FM:Arg1:@FM:"D_VOC"
WRITE VOC_ENTRY ON FV,VOC_POINTER THEN
EXECUTE "COUNT ":VOC_POINTER RETURNING Ans
DELETE FV,VOC_POINTER
CLOSE FV
END ELSE
* COULD NOT WRITE TO VOC
Ans ="Cannot write to VOC"
END
END ELSE
* COULD NOT OPEN VOC
Ans = "Cannot open VOC"
END
Post Reply