Page 1 of 1

Command activity checking for a file pattern

Posted: Mon Jun 10, 2013 7:17 am
by suja.somu
Datastage PX version 8.5 on windows(MKS installed):

I have the same scenario to implement as noted here.

Step2 in the previous post: "2. Exec command activity checking for a file pattern using a if condition. If file found print 'Found' else sleep for some seconds. "

I tried the below commands in the execute command stage. I am getting error. can anyone help me to debug this ?

[-f "Client_Export_Out_"* ]&& ECHO "file exists"||SLEEP 60

(or)
IF [-f "Client_Export_Out_"* ]; THEN ECHO "file exists" ELSE SLEEP 60

error from log:

..JobControl (@Execute_Command_0): Executed: [ -f "Client_Export_Out_"* ]&& ECHO "file exists"||SLEEP 60
Reply=0
Output from command ====>
'[' is not recognized as an internal or external command,
operable program or batch file.

Posted: Mon Jun 10, 2013 7:22 am
by chulett
:!: Your issue = your post. Splitted.

Posted: Mon Jun 10, 2013 2:53 pm
by ray.wurlod
The Execute Command activity executes a command in the operating system, in this case Windows. To execute MKS Tookit commands, its bin directory must be named in the Windows PATH environment variable.

Another approach would be to name a UNIX shell explicitly in the command you are executing, for example

Code: Select all

/bin/ksh test -f "Client_Export_Out"* && echo "file exists" || sleep 60
Note also that UNIX commands are case sensitive; ECHO is not valid in UNIX.