Untar Command Not Recognised By DataStage??

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
Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Untar Command Not Recognised By DataStage??

Post by Christina Lim »

Hallo all,

I tried to execute the below command from unix and it works fine.
/usr/bin/tar -xvf /dwh/ftp/TWN/TWN_MthlyFiles_MI.tar
I need to use job control to execute this because "TWN_MthlyFiles_MI.tar" and "dwh" is a parameterized value. DSEE v7.1 doesn't support usage of parameter in Execute Command stage. And I was not allowed to create user defined environment variable.

Below is my control job file that execute any unix command.

Code: Select all

      Command = "/usr/bin/" : szUnixCmd 
      Parameter = szParameter
      UnixCmd = Command: " " : Parameter 

      Call DSExecute("UNIX", UnixCmd, Output, SystemReturnCode)
      If SystemReturnCode <> 0 Then
         Call DSLogFatal("Unix Execution Failed : " : UnixCmd,"Notice1")
      End

      Call DSLogInfo("Unix Execution Successful : " : UnixCmd,"Notice1")
Works Fine : Command = "gzip"
Parameter = "-d /":pEnv:"/ftp/TWN/":szGzipFile:".tar.gz"
Environment = pEnv

Aborted : Command = "tar"
Parameter = "-xvf /":pEnv:"/ftp/TWN/":szGzipFile:".tar"
Environment = pEnv

I am able to execute gzip command but not tar command. I suspect datastage cannot recognise "tar". Please help... I am totally lost of ideas..
:cry:
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

And by 'aborted' you mean... what? An actual error message would help track down the problem.
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Change your code to include whatever is coming back in the Output variable when it logs the results.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Post by Christina Lim »

Hallo...

The error message from the job run as below:
TWN_Exec_Unix_Command.untarFTPFiles.JobControl (fatal error from Notice1): Unix Execution Failed : /usr/bin/tar -xvf /dwh/ftp/TWN/TWN_MthlyFiles_MI.tar
Attempting to Cleanup after ABORT raised in stage TWN_Exec_Unix_Command.untarFTPFiles.JobControl
The error I got :
TWN_Exec_Unix_Command.untarftp.JobControl (fatal error from tar: 0511-188 Cannot create mieuabm.txt: The file access permissions do not allow the specified action.): tar: 0511-188 Cannot create milcaam.txt: The file access permissions do not allow the specified action.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You got the first two because of your code - the first is your message and the second is a direct cause of calling DSLogFatal. But I'm sure you knew that. :wink:

The third message tells you the problem. You do realize that your tar command will untar the archive into your current working directory, yes? When you execute the command by hand, that would be the directory which you issued the command from. When you run it in a DataStage job, that is the Project directory. At least two problems with that:

a) You probably don't want to put them there
b) You don't have permissions to put them there
-craig

"You can never have too many knives" -- Logan Nine Fingers
Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Post by Christina Lim »

I use the same command to execute from unix and it works.
Untar file permission as below
-rw-rw-r-- 1 dsadm dstage 488700 Aug 02 14:01 miaa01m.txt

the folder that contains this file :
drwxrwxrwx 6 dsadm dstage 4096 Aug 22 21:37 TWN

the file to untar :
-rw-r----- 1 lsting dstage 19036160 Aug 22 20:04 TWN_MthlyFiles_MI.tar


please advice why I got create file permissison error when executed from datastage alone not thru unix telnet.

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

Post by kduke »

I think what Craig is saying when you tested it you changed directory to where the file was and then ran tar but when you run it from a job then it extracts the tar file into the project folder. Not the same.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Christina, please check this post for an explanation.

In your case it's not exactly the same, but your working directory for you is not the same as the working directory for a DataStage process.

To make this really clear to you, set up a before-job or before-stage or after-stage or after-job subroutine to execute the pwd command using ExecSH, so you can learn where the process is executing. (Anyone on Windows can use the CD command with no command line arguments through ExecDOS). The log entry will contain the pathname of your DataStage process's current working directory. This is where you are likely to be having the permissions issue.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bmadhav
Charter Member
Charter Member
Posts: 50
Joined: Wed May 12, 2004 1:16 pm

Post by bmadhav »

Christina,

DataStage 7.1 does not support parameterized Execute Command stage.
We ran into this problem too and we were forced to clone our sequencer jobs and pass hardcoded paramaters.
But, the good news is, in DataStage verion 7.5 and above it works fine!!
We have successfully implemented it in our production jobs using v7.5.1A

Thanks
BM
Christina Lim
Participant
Posts: 74
Joined: Tue Sep 30, 2003 4:25 am
Location: Malaysia

Post by Christina Lim »

Thank you for all the input.

I run pwd command to get the working directory as Ray suggested.

it's in "/u01/app/Ascential/DataStage/Projects/STLIM"

Code: Select all

      Command = "/usr/bin/" : szUnixCmd 
      Parameter = szParameter
      UnixCmd = Command: " " : Parameter 

      Call DSExecute("UNIX","cd /":pEnv:"/ftp/TWN; " : UnixCmd, Output, SystemReturnCode)
      If SystemReturnCode <> 0 Then
         Call DSLogFatal("Unix Execution Failed : " : UnixCmd,Output)
      End

      Call DSLogInfo("Unix Execution Successful : " : UnixCmd,Output)
Therefore, to solve my problem, I added "cd /":pEnv:"/ftp/TWN; " : UnixCmd in the DSExecute command parameter. That way works fine for me.

Thank you very much. I heard about job parameter usage in Command Stage as well as Email Stage in DSEE7.5. I envy ... Hoping the management would upgrade our production server version too.. :roll:

:D I appreciate all response.. Thank you so so much
kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

In older versions switch Command Stage to a Routine Stage and use ExecSH. Parameters should work fine.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Make the point to management that upgrading to 7.5.1 costs no money (assuming you have maintenance/support), and delivers quite a few technical benefits.
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