How to Clear a Hashed File Outside of Datastage Job?

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

olgc
Participant
Posts: 145
Joined: Tue Nov 18, 2003 9:00 am

How to Clear a Hashed File Outside of Datastage Job?

Post by olgc »

Hi there,

Before run a job, how can a hashed file be cleared which is created in a previous run? If it is not cleared, the looking up from the hashed file will be wrong.

Thanks,
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

There is a check box to clear the file. If the hash file is local to the project the ExecTCL("CLEARFILE MyHashFile"). This routine can be in a before job or called in a sequence. It is included in the SDK.
Mamu Kim
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi,
You can check the option - Clear File before writing in Update Action window in Hashed File Input tab.


Ketfos
olgc
Participant
Posts: 145
Joined: Tue Nov 18, 2003 9:00 am

Post by olgc »

It's too late to do so because the lookup looks the hashed file first and finds an entry. But that's not right. At the beginning, the hashed file should be empty in order to guarantee the correct result.

Thanks,
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

I told you wrong it is "CLEAR.FILE MyHashFileName". This will work in a before job routine.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

CLEAR.FILE will work via ExecTCL only if the hashed file was created in an account.

If the hashed file was created in a directory you need the operating system variant (clear.file) with the pathname of the hashed file.

Code: Select all

$DSHOME/bin/clear.file pathname
executed via ExecSH (for UNIX) or ExecDOS (for Windows).
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
olgc
Participant
Posts: 145
Joined: Tue Nov 18, 2003 9:00 am

Post by olgc »

Thanks, It works.
leomauer
Premium Member
Premium Member
Posts: 100
Joined: Mon Nov 03, 2003 1:33 pm

Post by leomauer »

ray.wurlod wrote:CLEAR.FILE will work via ExecTCL only if the hashed file was created in an account.

If the hashed file was created in a directory you need the operating system variant (clear.file) with the pathname of the hashed file.

Code: Select all

$DSHOME/bin/clear.file pathname
executed via ExecSH (for UNIX) or ExecDOS (for Windows).
I tryed it at UNIX prompt it did not work:
$ clear.file /mount/test/sa/hash/CST010_hash
Unable to open VOC file.
*** Processing cannot continue
. ***

What do you think gone wrong?
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I negelected to mention that this command must be executed while attached to a DataStage project directory (an "account"). Mea culpa. :oops:
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
ketfos
Participant
Posts: 562
Joined: Mon May 03, 2004 8:58 pm
Location: san francisco
Contact:

Post by ketfos »

Hi Ray,
---------------------------
CLEAR.FILE will work via ExecTCL only if the hashed file was created in an account.

If the hashed file was created in a directory you need the operating system variant (clear.file) with the pathname of the hashed file.
Code:
$DSHOME/bin/clear.file pathname
executed via ExecSH (for UNIX) or ExecDOS (for Windows).
------------------------------------

You had mentioned correctly in your last but one reply that
Clear.file works for hashed file created throught he account.

Leomauer - Can you see the hash file iname listed n the Unix Directory path you are using in clear.file command?

Ketfos

I think the file path might be incorrect. That is why it dosenot clear the file.
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Sorry for not piping up earlier, the method you need to use sounds a little hokey, but it works. What you do is create the hash file, then copy the contents of the empty hash file subdirectory into a parking space. Whenever you need to clear the hash file, simply recopy the empty DATA.30 and OVER.30 files back into the hash file subdirectory from your parking spot.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
leomauer
Premium Member
Premium Member
Posts: 100
Joined: Mon Nov 03, 2003 1:33 pm

Post by leomauer »

ketfos wrote:Hi Ray,
---------------------------
CLEAR.FILE will work via ExecTCL only if the hashed file was created in an account.

If the hashed file was created in a directory you need the operating system variant (clear.file) with the pathname of the hashed file.
Code:
$DSHOME/bin/clear.file pathname
executed via ExecSH (for UNIX) or ExecDOS (for Windows).
------------------------------------

You had mentioned correctly in your last but one reply that
Clear.file works for hashed file created throught he account.

Leomauer - Can you see the hash file iname listed n the Unix Directory path you are using in clear.file command?

Ketfos

I think the file path might be incorrect. That is why it dosenot clear the file.
I usually do not type the file name, but copy/paste it from the screen. Therefore the path/name is correct. When I simply recall the command and replace clear.file with ls -l i see the file.
I would like to make it work. It is a usefull feature. Our people are creating special DS jobs to load empty file into hash. I do not like it.
Ray. What does "attached to a DataStage project directory" means in layman terms?
Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

In layman's terms it should mean that it would work as long as it is issued from inside a 'job', not directly from the command line. So, a piece of job control code or a routine (before job, let's say) could use DSExecute to issue the command and then it would work.

Only way I can see accomplish what Ray is saying. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
leomauer
Premium Member
Premium Member
Posts: 100
Joined: Mon Nov 03, 2003 1:33 pm

Post by leomauer »

Code: Select all

sys="UNIX"
Command="/dsadm/Ascential/DataStage/DSEngine/bin/clear.file ":fullHashFilepathname
*Command = "ls -l ":fullHashFilepathname

Call DSLogInfo("System: ":sys, "")
Call DSLogInfo("Command: ":Command, "")

Call DSExecute(sys, Command, ScreenOutput, SystemReturnCode)

Call DSLogInfo("Return Code: ":SystemReturnCode, "")
Call DSLogInfo("UNIX output: ":ScreenOutput, "")
Above is my code in job control.
It works when I execute:
Command = "ls -l ":fullHashFilepathname

But when
Command="/dsadm/Ascential/DataStage/DSEngine/bin/clear.file ":fullHashFilepathname
it aborts
Yet
$ ls -l /dsadm/Ascential/DataStage/DSEngine/bin/clear.file
-rwxr-x--x 1 dsadm datastg 1562767 Dec 08 2003 /dsadm/Ascential/DataStage/DSEngine/bin/clear.file

When aborting it does not even go as far as executing last two DSLogInfo (no problem when Command is ls)

Any idea?
Thanks.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

So, you have no idea what the error message is? :? Have you tried Resetting the job via the Director? Sometimes that will get you some additional information labelled as "From previous run".
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply