aborting jobs when data source empty
Moderators: chulett, rschirm, roy
aborting jobs when data source empty
Hello,
Although the data source is empty either because the source server is down or simply because there is no data , the job runs perfectly.If i want the job to abort what could i do? Can i make use of the activity stages in the sequencer (eg terminator) or use the triggers to detect data source empty?
Although the data source is empty either because the source server is down or simply because there is no data , the job runs perfectly.If i want the job to abort what could i do? Can i make use of the activity stages in the sequencer (eg terminator) or use the triggers to detect data source empty?
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Yes, but prefer to issue a warning (UtilityWarningToLog routine) and exit (Terminator activity) rather than to abort.
Create a small job that selects COUNT(*) from source into a text file, then read this text file (Execute Command activity) then, depending on the result, either continue with regular processing or take the path described in the previous paragraph.
Create a small job that selects COUNT(*) from source into a text file, then read this text file (Execute Command activity) then, depending on the result, either continue with regular processing or take the path described in the previous paragraph.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
You can write shell scripts in windows utilizing the MKS toolkit. It is installed when you install datastage. The advantage to writing shell scripts is that they will translate to Unix with few problems. If you don't want to write a shell scripts, you could write a .bat file to check filesize before you run the job and only execute if greater than 0. Use a combiniation of the dir and find command in a command window.
Hope this helps.
Hope this helps.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
kumar_s wrote:Iam still thinking a way to capture the file size (alone) from dos prompt.
Code: Select all
test -z $filename
Code: Select all
if [ -z $filename ] ...
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
i wonder how you can make Execute Command activity fail/pass if source file is empty/full.ray.wurlod wrote:Create a small job that selects COUNT(*) from source into a text file, then read this text file (Execute Command activity) then, depending on the result, either continue with regular processing or take the path described in the previous paragraph.
may be i did not get what ray told
pls somebody through some light.
By checking the result of the command. Perhaps it counts the number of records in the file, so you check to see if the returned value is 0 or >0. Perhaps it simply tests to see if the file exists and is empty or not empty, so you check to see of the returned value is true or false. Etc Etc.sendmk wrote:i wonder how you can make Execute Command activity fail/pass if source file is empty/full.
Do the checking in the triggers you define in the Execute Command stage and branch accordingly. Custom triggers that check the StageName.$ReturnValue if I remember correctly.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
May be you can try this. Did a search and found it.kumar_s wrote:Iam still thinking a way to capture the file size (alone) from dos prompt.
Code: Select all
:: chk4zero.bat
@echo off
if %1'==' echo usage is: %0 FILENAME.EXT && goto :eof
if not exist %1 echo %1 was not found && goto :eof
if %~z1 EQU 0 goto :0
goto :eof
:: Put in any code you want to run if the file is not zero length.
::
:0
echo %1 is size zero
:: DONE
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Exactly as Craig stated; ActivityName.$ReturnValue where ActivityName is the name of your Execute Command activity. If you're on 7.x you can select these "activity variables" from the "Add Parameter" button's dialog. In earlier releases (5.2 and later) they had to be entered manually, but could still be used.
Where and how did you look?
Where and how did you look?
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.