Hi all,
In my current integration project, we all share a common file sharing server. Datstage drops the files for other system to pick the file after the required transformations and validations. The requirement is to drop the file from DataStage only if the record count is equal to or greater than one. Can anyone help on how to handle this in a script so I can run this script in the After-job routine.
Thanks
How to check the record count before dropping the file
Moderators: chulett, rschirm, roy
In other words, a non-zero record count.
Lots of posts on this subject lately. You can do it all in a Routine or a shell script, whichever you feel more comfortable with. Search for topics discussing things like DSGetLinkInfo with the 'row count' info-type argument to check the number of records that went down the link to the Sequential File stage producing the file. Or a simple shell check of the file itself - I think it is "if -s" that is true if the file exists and has more than zero bytes in it. Or "wc -l" to count the lines, which can be helpful if there is a header record.
Many ways to skin any given cat around here.
Lots of posts on this subject lately. You can do it all in a Routine or a shell script, whichever you feel more comfortable with. Search for topics discussing things like DSGetLinkInfo with the 'row count' info-type argument to check the number of records that went down the link to the Sequential File stage producing the file. Or a simple shell check of the file itself - I think it is "if -s" that is true if the file exists and has more than zero bytes in it. Or "wc -l" to count the lines, which can be helpful if there is a header record.
Many ways to skin any given cat around here.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
What do you mean by "datastage drops the file". Do you mean creates it? If thats the case, then the file will be created regardless of the record count. If you mean something else then please clarify.
You can check for number of lines in a file by wc -l command. If it returns 0 that means the file is empty. If you have the "First line is column names" option checked, then wc -l will return 1 and that will mean the file is empty. You can easily script this. If you want more unix help, google can retrieve vast amount of info for you to get started.
You can check for number of lines in a file by wc -l command. If it returns 0 that means the file is empty. If you have the "First line is column names" option checked, then wc -l will return 1 and that will mean the file is empty. You can easily script this. If you want more unix help, google can retrieve vast amount of info for you to get started.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.