Doubt with ExecCommand Activity in sequence

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Doubt with ExecCommand Activity in sequence

Post by somu_june »

Hi,

I want to remove file in AIX . Iam using a ExecCommand Activity in Sequencer in that ExecCommand tab and in command area I gave command as /DataStage/751A/Ascential/rm *.blp . But it is not taking so I gave in command space rm *.blp and in parameter space I gave a path /DataStage/751A/Ascential. Whil this activity take the parameter and execute the command


Please correct me if Iam wrong .




Thanks,
SomaRaju
somaraju
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Try this..

In Command: rm
In Parameters: /DataStage/751A/Ascential/*.blp

Cheers!
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Re: Doubt with ExecCommand Activity in sequence

Post by chulett »

somu_june wrote:I gave command as /DataStage/751A/Ascential/rm *.blp
That didn't work because it's not a valid UNIX command. What would happen if you typed "/DataStage/751A/Ascential/rm *.blp" from the command line? Unless you have copied the 'rm' command such that it lives in that Ascential directory, you're going to get an error.

I'm suprised the other way worked at all. All it does it put the two parts together with a space between them and try to execute the command. That should mean you ended up with:

Code: Select all

rm *.blp /DataStage/751A/Ascential
Ah... ok. So it deleted all *.blp files from the current working directory (aka, the Project) and then probably threw in an extra error that it couldn't remove the second file because it's a directory. All that should be in the log.

I would think to be sure you know where exactly you are deleting these files from, you specifically change to the directory in question first. So, put this all in the Command box or split it up, doesn't really matter:

Code: Select all

cd /DataStage/751A/Ascential; rm *.blp
Probably closer to what you actually meant to do. If not, let us know.

:lol: Or what Koolnitz just posted is another way. Probably safer, actually.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

use && in place of ; in Craig's code. This way the second command will only be executed if the first one is successful

Code: Select all

 
cd /DataStage/751A/Ascential && rm *.blp 
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Thanks, always forget that little tidbit. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
somu_june
Premium Member
Premium Member
Posts: 439
Joined: Wed Sep 14, 2005 9:28 am
Location: 36p,reading road

Post by somu_june »

Hi,


Thanks guys for you help




Thanks,
SomaRaju
somaraju
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Code: Select all

In Command: rm 
In Parameters: /DataStage/751A/Ascential/*.blp


The plus point with the above logic is you can even use job parameter if you want to change the directory runtime.

In Command: rm
In Parameters: #prmDirName#/*.blp

>> prmDirName is a job parameter
>> prmDirName can be set to /DataStage/751A/Ascential
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As long as your version of DataStage actually supports using job parameters in the Parameters field. :wink:

There is a well know and often mentioned bug in some of the early 7.x versions where job parameters are translated in the log but are actually sent raw (untranslated) to the command itself. Seems to no longer be an issue in 7.5.x but be aware of the possibility of it in earlier versions.
-craig

"You can never have too many knives" -- Logan Nine Fingers
koolnitz
Participant
Posts: 138
Joined: Wed Sep 07, 2005 5:39 am

Post by koolnitz »

Craig, it does work in v7.5.1 8)
Nitin Jain | India

If everything seems to be going well, you have obviously overlooked something.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As I noted. :wink:

It's also good to note that it seems to be a platform specific issue, not a version specific one. Some platforms on the troublesome versions worked and some didn't. Best to check carefully beyond what it shows in the log as it always looks good there.
-craig

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