unzip in unix
Moderators: chulett, rschirm, roy
unzip in unix
Hi,
I have written a Before/After Subroutine as below. And it is errored out.
SUBROUTINE unzip(InputArg,ErrorCode)
Command = 'unzip /TESTZIP/xyz.zip'
Call DSExecute("UNIX",Command,Output,SystemReturnCode)
If SystemReturnCode <> 0
Then
Message = "Error when executing command: " : Command
Call DSLogWarn(Message, "unzip()")
End
Else
Message = "Executed command: " : Command
Call DSLogWarn(Message, "unzip()")
End
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
anyone can throw some light on this please.
Thnaks in advance.
I have written a Before/After Subroutine as below. And it is errored out.
SUBROUTINE unzip(InputArg,ErrorCode)
Command = 'unzip /TESTZIP/xyz.zip'
Call DSExecute("UNIX",Command,Output,SystemReturnCode)
If SystemReturnCode <> 0
Then
Message = "Error when executing command: " : Command
Call DSLogWarn(Message, "unzip()")
End
Else
Message = "Executed command: " : Command
Call DSLogWarn(Message, "unzip()")
End
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
anyone can throw some light on this please.
Thnaks in advance.
It would be very helpful if you could actually tell us what the error is. You should also include the contents of the variable Output in your error message.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
ArndW wrote:It would be very helpful if you could actually tell us what the error is. You should also include the contents of the variable Output in your error message. ...
It doesn't say anything. But it always logs it as warning with the message
Error when executing command: unzip /TESTZIP/xyz.zip.
why it is not unziiping the zip file.?.
Thanks
Re: unzip in unix
Hi,
Can you check with ".In your code I do not see InputArg. I am not sure the error is because of this or for something.Post the error.
Can you check with "
Code: Select all
SUBROUTINE unzip(InputArg,ErrorCode)"
Code: Select all
SUBROUTINE unzip(InputArg,ErrorCode)
Command = 'unzip /TESTZIP/xyz.zip'
Call DSExecute("UNIX",Command,Output,SystemReturnCode)
If SystemReturnCode <> 0
Then
Message = "Error when executing command: " : Command
Call DSLogWarn(Message, "unzip()")
End
Else
Message = "Executed command: " : Command
Call DSLogWarn(Message, "unzip()")
End
ErrorCode = 0 ;* set this to non-zero to stop the stage/job
Re: unzip in unix
meena wrote:Hi,
Can you check with ".In your code I do not see InputArg. I am not sure the error is because of this or for something.Post the error.Code: Select all
SUBROUTINE unzip(InputArg,ErrorCode)"
Code: Select all
SUBROUTINE unzip(InputArg,ErrorCode) Command = 'unzip /TESTZIP/xyz.zip' Call DSExecute("UNIX",Command,Output,SystemReturnCode) If SystemReturnCode <> 0 Then Message = "Error when executing command: " : Command Call DSLogWarn(Message, "unzip()") End Else Message = "Executed command: " : Command Call DSLogWarn(Message, "unzip()") End ErrorCode = 0 ;* set this to non-zero to stop the stage/job
do we need to have InputArg in the code.?
Thanks,
As Arnd suggested, add the Output variable to your error message like this and then see what exactly is causing the error. It will be easier to debug that way.
Code: Select all
Message = "Error when executing command: " : Command : Output
Kris
Where's the "Any" key?-Homer Simpson
Where's the "Any" key?-Homer Simpson
Hi.kris007 wrote:As Arnd suggested, add the Output variable to your error message like thisand then see what exactly is causing the error. It will be easier to debug that way.Code: Select all
Message = "Error when executing command: " : Command : Output
when i use the option 'o' it ran ok.
unzip -o /TESTZIP/xyz.zip
But i cant see the file in the folder.
the Output variable has the value
Archive: /TESTZIP/xyz.zip
inflating: xyz.txt
any clues about this.
Thanks in advance.
DataStage jobs shell out with a current attach point / working directory of the project that the job runs in. Check there for the output file.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
DataStage jobs shell out with a current attach point / working directory of the project that the job runs in. Check there for the output file.
<a href=http://www.worldcommunitygrid.org/team/ ... TZ9H4CGVP1 target="WCGWin">
</a>
</a>
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Is there another option for unzip to specify the target location?
If not, change the command to
If not, change the command to
Code: Select all
cd pathname && unzip -o /TESTZIP/xyz.zip
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yes. I have other location to store the unzipped files.How can i do that?.ray.wurlod wrote:Is there another option for unzip to specify the target location?
If not, change the command to...Code: Select all
cd pathname && unzip -o /TESTZIP/xyz.zip
How can i give morethan one parameter to Before/After subroutine?.
Because my InputArg contains the Complete path including zip file name.
Thnaks in advance.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You can have as much as you like in InputArg. Put some kind of delimiter between each piece, and use the Field() function in your subroutine to parse them out.
For example, the Input Values field might contain #SourcePath#|#TargetPath#
For example, the Input Values field might contain #SourcePath#|#TargetPath#
Code: Select all
SourcePath = Field(InputArg, "|", 1, 1)
TargetPath = Field(InputArg, "|", 2, 1)
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.