Hi,
My requirement is to call a poweshell script in DataStage Sequencer. I searched and followed same as mention to call script:
viewtopic.php?t=146877
My script is to rename files, when I run the script in powershell, it works fine but as when I am trying to run in Execute Command Activity stage in datastage sequence , it is getting hanged , in logs it says scripts has initiated then it keeps running , it doesn't say anything in log.
For testing, i just wrote a single line powershell script just echo 123, even if I am trying to call this in Execute Command Activity stage it is running indefinitely.
Is there any difference in the way we call shell script and powershell script?
Can anybody please help me to find the issue.
Thank you.
Execute Command Activity stage Issue
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 125
- Joined: Mon Sep 11, 2006 4:22 am
- Location: India
![Exclamation :!:](./images/smilies/icon_exclaim.gif)
ray.wurlod wrote:Does Powershell need an option to return once the command is complete (like the -c option for sh in UNIX, or the /C switch for DOS in Windows)?
Poovalingam wrote:does this job sequence having the exec command activity alone? It may be in execution in other activities as well. we can try using a small command like echo 'dummy' in the exec command activity to debug.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 125
- Joined: Mon Sep 11, 2006 4:22 am
- Location: India
Hi,
Sorry for posting in wrong place.
Thank you for your reply.
I am trying as below :
Created a dummy job only with Execute command Activity stage and wrote echo dummy in Command , this running good and finished successfully, echo dummy in log.
Now I saved same text (echo dummy) in a file name dummy.ps1 called that file in Execute command Activity stage like ./C:\test\dummy.ps1, it gives error
So can anybody please guide what is going wrong here or how do I need to call a sript.
Thanks you.
Sorry for posting in wrong place.
Thank you for your reply.
I am trying as below :
Created a dummy job only with Execute command Activity stage and wrote echo dummy in Command , this running good and finished successfully, echo dummy in log.
Now I saved same text (echo dummy) in a file name dummy.ps1 called that file in Execute command Activity stage like ./C:\test\dummy.ps1, it gives error
Then I tried to execute like C:\test\dummy.ps1 in Execute command Activity stage, it doen't fail or complete , it keeps on running , if I am trying to Abort , it is not working .Reply=1
Output from command ====>
'.' is not recognized as an internal or external command,
operable program or batch file.
So can anybody please guide what is going wrong here or how do I need to call a sript.
Thanks you.
-
- Participant
- Posts: 125
- Joined: Mon Sep 11, 2006 4:22 am
- Location: India
Thank you for reply.
I agree when I am trying to run with ./ it might fail , but in last option i tried to run only the script name with path : C:\test\dummy.ps1
I tried all different execution option mentioned at http://ss64.com/ps/syntax-run.html but nothing is working.
Thank you in advance for help.
I agree when I am trying to run with ./ it might fail , but in last option i tried to run only the script name with path : C:\test\dummy.ps1
Then it keeps on running .Then I tried to execute like C:\test\dummy.ps1 in Execute command Activity stage, it doen't fail or complete , it keeps on running , evenif I am trying to Abort , it is not working .
I tried all different execution option mentioned at http://ss64.com/ps/syntax-run.html but nothing is working.
Thank you in advance for help.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Try excaping the backslashes.
Code: Select all
C:\\test\\dummy.ps1
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.
Correction - it will fail. As you've seen.Roopanwita wrote:I agree when I am trying to run with ./ it might fail
Why the need for "powershell"? Why not a simple batch file?
ps. I haven't seen any evidence posted where you've used the syntax noted at the URL you posted. For example:
You seem to be omitting the "PS" part, the part that actually invokes the PowerShell session.The most common (default) way to run a script is by calling it:
PS C:\> & "C:\Belfry\My first Script.ps1"
If the path does not contain any spaces, then you can omit the quotes and the '&' operator
PS C:\> C:\Belfry\Myscript.ps1
If the script is in the current directory, you must indicate this using .\ (or ./ will also work)
PS C:\> .\Myscript.ps1
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 125
- Joined: Mon Sep 11, 2006 4:22 am
- Location: India