Conditional execution of job
Moderators: chulett, rschirm, roy
Conditional execution of job
I have to execute a job based on a file count.
If the file count =0 then execute the job
Else if file count > 0 then send an email and stop the sequence flow.
how to do this in Sequencer?
If the file count =0 then execute the job
Else if file count > 0 then send an email and stop the sequence flow.
how to do this in Sequencer?
That could just be trigger expressions. After you count the file (Execute Command stage most likely) then two triggers from it could evaluate the output and branch to either a Job Activity stage or a Notification stage.
What have you tried so far?
What have you tried so far?
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I started with the execution command activity to count the no.of lines in a file in windows command.
I am new to windows scripting. There is a file with rejects data, I have to get the total no.of rejects in afile.
I am using the below command in the execute command activity.
findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /D ":"
am getting the below error:
test_seq..JobControl (@Execute_Command_0): Executed: findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /D ":"
Reply=1
Output from command ====>
find: unable to access "/D": The system cannot find the file specified.
find: unable to access ":": The system cannot find the file specified.
How to pass the count in a variable ?
I am new to windows scripting. There is a file with rejects data, I have to get the total no.of rejects in afile.
I am using the below command in the execute command activity.
findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /D ":"
am getting the below error:
test_seq..JobControl (@Execute_Command_0): Executed: findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /D ":"
Reply=1
Output from command ====>
find: unable to access "/D": The system cannot find the file specified.
find: unable to access ":": The system cannot find the file specified.
How to pass the count in a variable ?
Thanks Craig. You are right.
The actual command is :
findstr /R /N "^" filename.txt | find /C ":"
I used this in cmd prompt and it was giving me the expected result.
When I execute the above command through datastage thro a execute command stage, it was throwing error.
For more information, the datastage is installed in a windows server, we access through citrix.
Not sure , where is the issue. Can anyone help to me fix this.
The actual command is :
findstr /R /N "^" filename.txt | find /C ":"
I used this in cmd prompt and it was giving me the expected result.
When I execute the above command through datastage thro a execute command stage, it was throwing error.
For more information, the datastage is installed in a windows server, we access through citrix.
Not sure , where is the issue. Can anyone help to me fix this.
In the execution command task i gave the command
findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /C ":"
In the log i see the below error:
test_seq..JobControl (@Execute_Command_0): Executed: findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /C ":"
Reply=1
Output from command ====>
find: unable to access "/C": The system cannot find the file specified.
find: unable to access ":": The system cannot find the file specified.
what is the error in the above statement.
findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /C ":"
In the log i see the below error:
test_seq..JobControl (@Execute_Command_0): Executed: findstr /R /N "^" D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv | find /C ":"
Reply=1
Output from command ====>
find: unable to access "/C": The system cannot find the file specified.
find: unable to access ":": The system cannot find the file specified.
what is the error in the above statement.
I think you'd need to open a case with your official support provider if you haven't already. You're right, this old DOS mechanism to count lines in a file works just fine from the command line. This is me executing one on Windows 7:
I thought perhaps quotes were getting stripped but your echo of the command in the log shows everything intact. I'm sorry but I have no idea what is making it not work. Only suggestion (which I really don't think will change the behaviour) is to put only the "findstr" part in the Command prompt and everything else in the Parameter section. This since you said it all went in as the Command.
Code: Select all
D:\>findstr /R /N "^" c:\temp\bootstrap_log.txt | find /C ":"
32
Last edited by chulett on Fri Mar 08, 2013 8:59 am, edited 2 times in total.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 117
- Joined: Wed Feb 06, 2013 9:24 am
- Location: Chennai,TN, India
one thing we must be clear in this:
is it file count
or the record count in file
Since you said reject file, even when there are no rejects empty file will be created.
In that case just use type/more command or command that display file content.
In the expression, check the length of command output.
Mentioning above solution just in case if you didnt get any
is it file count
or the record count in file
Since you said reject file, even when there are no rejects empty file will be created.
In that case just use type/more command or command that display file content.
In the expression, check the length of command output.
Mentioning above solution just in case if you didnt get any
Thanks,
Prasanna
Prasanna
Can you try what I posted in my second post, the UNIX command? That will let us know if you have the MKS Toolkit installed and if it works would greatly simplify things:
Worth a shot before we burn any more braincells on a DOS solution.
Code: Select all
wc -l D:\APP_DATA\VBS\PAS\CIA\REJECTS\SOURCE\ALISSourceRejects.csv
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers