Command activity checking for a file pattern

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
suja.somu
Participant
Posts: 79
Joined: Thu Feb 07, 2013 10:51 pm

Command activity checking for a file pattern

Post 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.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:!: Your issue = your post. Splitted.
-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 »

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.
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