ExecDOS Command
Moderators: chulett, rschirm, roy
ExecDOS Command
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
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
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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.
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.
Thank you for your reply, right now I dont have syntax, but it is nor marl syntax to get the yesterday date.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.
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
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.
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
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
You're executing a bash script using ExecDOS ?bob7027 wrote:bash file is executing perfectly but the expected output is wrong
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
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
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
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
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact: