Test for empty 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
itcconsulting
Premium Member
Premium Member
Posts: 26
Joined: Tue May 24, 2005 6:20 am
Location: Tallahassee

Test for empty hashed file

Post by itcconsulting »

Within my server job, I would like to perform certain logic if a hashed file is empty. What is the best way for me to test this condition?
Byron
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

You can SELECT COUNT(*) FROM MyHashFile; in a UV stage. You can COUNT MyHashFIle in a ExecTCL command.
Mamu Kim
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As long as the hash file is in an 'Account' or you've established your own VOC record for it. For an unadulterated Pathed Hash you can't count it like that.

I'd be curious to learn what the 'certain logic' is you'd need to do if the hash file is empty. I've never had a need to worry about this in all of my dealings with this tool and wonder if there might be a different (or simpler) approach that could be taken?
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You can create a routine to perform either of the commands Kim suggested, and use the routine's return value to drive - perhaps - a nested condition activity in a job sequence. It really is difficult to answer such a vague specification.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
itcconsulting
Premium Member
Premium Member
Posts: 26
Joined: Tue May 24, 2005 6:20 am
Location: Tallahassee

Post by itcconsulting »

Basicall what I'd like to do is populate the current date into a field if the hashed file is empty. I will try what Kim suggested and give an update.
Byron
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Put a UV stage on the end of a stream input link. The link has one column, an integer. Derive the column as COUNT(*) (or COUNT(@ID)) and specify the hashed file name as the table name.
In the Transformer stage fed by this stream input link, detect whether the value of this column is 0 (in an output link constraint expression); if it is, generate the current date in your desired format, et voila!
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply