ExecDOS Command

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
bob7027
Participant
Posts: 22
Joined: Wed Oct 03, 2012 2:49 pm
Location: United States

ExecDOS Command

Post by bob7027 »

Hello All, I need your suggestion here.
i am trying to trigger the MS-DOS Batch file. Here it moves the file and add the date for the file name, when i tried this directly it is working but when i used this command through datastage, it is not working.

expected result : User_Log_Test_Mon 04-15-2013

o/p getting: User_Log_Test_0-0-0

can any one please let me know, where i am getting wrong regarding this.

Advance Thanks
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Show us the method you are using in DataStage. For example are you using a before-job subroutine to invoke ExecDOS? If so, what are you putting into the Input Value field?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Probably a relative v. full path issue but as noted we'd need to see your syntax to have any idea what is going on.
-craig

"You can never have too many knives" -- Logan Nine Fingers
bob7027
Participant
Posts: 22
Joined: Wed Oct 03, 2012 2:49 pm
Location: United States

Post by bob7027 »

Thank you for your reply, i used after job subroutine execDos and the input value is input file.
Thats all i used, bash file is executing perfectly but the expected output is wrong. When I ran the same commands in Cmd prompt, it is executing perfectly, but when the same executed through datastage it is giving as mentioned.
bob7027
Participant
Posts: 22
Joined: Wed Oct 03, 2012 2:49 pm
Location: United States

Post by bob7027 »

chulett wrote:Probably a relative v. full path issue but as noted we'd need to see your syntax to have any idea what is going on.
Thank you for your reply, right now I dont have syntax, but it is nor marl syntax to get the yesterday date.
I will post the systax ASAP.

I am sorry for this...

my question is do I need to keep any default date format in DS
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Changing the contents of this post since the timing was a little off.

The answer to your last question is "no". It doesn't do anything different than you would - create a DOS shell and execute the command. I mentioned the path because it is a common tripping point for people new to the product. They build something that only works when you run it from the right directory, which they always do so it always works... and then doesn't from DataStage. They don't realize that the directory it launches it from, the "current working directory", will be the Project directory of the job that is executing it.

Whatever you are doing in your batch shouldn't make any assumptions about where it is, hence my warning about relative paths. Explicitly cd to wherever you need to be. Seeing your syntax would help rule this out (or in) as the culprit.
-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 »

bob7027 wrote:bash file is executing perfectly but the expected output is wrong
You're executing a bash script using ExecDOS ?

Or do you mean a batch file?

Still waiting to see what you've put in the Input Value field.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
bob7027
Participant
Posts: 22
Joined: Wed Oct 03, 2012 2:49 pm
Location: United States

Post by bob7027 »

echo %DATE:/=%

set /a d= %DATE:~0,2%
set /a month=%d%

set /a d= %DATE:~5,4%
set /a year=%d%

set /a d=%DATE:~3,2%
set /a yesterday=%d% - 1



MovE "\\C\DS\DS_TEMP\BOB\TEXT_.csv"
"\\C\DS\DS_TEMP\BOB\TEXT_%month%-%yesterday%-%year%.csv"



This is the syntax I am using
which works fine when i use from the folder, but not working when using it through datastage
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK... so this is the contents of a batch file you are calling via ExecDOS, yes? And when you say "output" you're not talking about what it echoes to the screen but rather what the name of your file ends up being? Trying to understand exactly what is happening - is your file being "moved" i.e. renamed, it's just that the name isn't correct?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bob7027
Participant
Posts: 22
Joined: Wed Oct 03, 2012 2:49 pm
Location: United States

Post by bob7027 »

Yes what you said is exactly correct. when it moves it should move with the file name.

output got: Text_0-0-0

expected : Text_04172013
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I still want to see what is in the Input Value field for ExecDOS.
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