Issue with Job sequencer
Moderators: chulett, rschirm, roy
Issue with Job sequencer
Good Morning all and wish u happy new year
Secondly, we are using datastage server jobs with 7x release
I have issue with my job sequencer.
In my process i have job that writes data in flat file, in the next step we send that file to other server via FTP.
Some time we don't process any records, at that time empty file was sent to other server.
I have to change my job like if i don't have any data on the file, the i should not send this file to other server.
how would i achive this functonality in datastage
here in this job sequence i am using execute command activity. that will
fire the Ftp script and sends the file to other server
please let me know
Secondly, we are using datastage server jobs with 7x release
I have issue with my job sequencer.
In my process i have job that writes data in flat file, in the next step we send that file to other server via FTP.
Some time we don't process any records, at that time empty file was sent to other server.
I have to change my job like if i don't have any data on the file, the i should not send this file to other server.
how would i achive this functonality in datastage
here in this job sequence i am using execute command activity. that will
fire the Ftp script and sends the file to other server
please let me know
Use a execute command stage before your FTP stuff as Craig said.
So, your JOb sequencer design would be:
In Executecommand stage use:
Command: awk
Parameters: '{print $1}' #TargetPath#/#FileName#
After extract job is completed, ExecuteCommandStage should invoke the Unix box to check the file content.
In the condition to FTP job use
So, if file size is not equal to empty, the FTP job will trigger.
@FM is used to get rid of any linefeeds in the file.
So, your JOb sequencer design would be:
Code: Select all
ExtractJob --> ExecuteCommandStage --> FTP Job
Command: awk
Parameters: '{print $1}' #TargetPath#/#FileName#
After extract job is completed, ExecuteCommandStage should invoke the Unix box to check the file content.
In the condition to FTP job use
Code: Select all
Trim(Convert(@FM, "", Execute_Command.$CommandOutput)) <> ''
@FM is used to get rid of any linefeeds in the file.
Thanks and Regards!!
dspxlearn
dspxlearn
Rather than awk the entire file, a simple conditional expression could be used to check the file. For example:
Code: Select all
-s file True if file exists and has size greater than zero.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Craig,
I was also checking the content of the file and if and blank spaces or line feeds, those will be converted to empty. Cause, with these stuff, the file size will be increased.
Can you please let us know how this is used in the execute command stage?
I was also checking the content of the file and if and blank spaces or line feeds, those will be converted to empty. Cause, with these stuff, the file size will be increased.
Code: Select all
Rather than awk the entire file, a simple conditional expression could be used to check the file. For example:
Code:
-s file True if file exists and has size greater than zero.
Thanks and Regards!!
dspxlearn
dspxlearn
With 'test'.
Returns true if the file exists and is greater than zero bytes in size, otherwise it returns false. Reverse the check with the bang:
Returns true if the file doesn't exist or exists and is zero bytes in size.
Code: Select all
test -s filename
Code: Select all
test ! -s filename
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks a lot
Thanks for your valuble suggestions,
I will try this way and let u know if my prob is solveds
Thanks
Krishna
I will try this way and let u know if my prob is solveds
Thanks
Krishna