Hi all,
I am using the target dataset of a job1 as an input of job2.I have skip the job2 if no records was passed to the target dataset in the job1
How can i achieve this,Can anyone suggest me a solution..
Use a sequence job to check either the size of the dataset or how many rows were written to it in the previous job and then only run the second job when that comes back non-zero.
-craig
"You can never have too many knives" -- Logan Nine Fingers
Call job1 from a sequence job, after that completes do an execute command stage of "orchadmin describe -f {YourDataSetFileDescriptor}", then parse the output for the last line starting with " records" and then take the numeric value after the ":" character. You can then use this number of records to decide whether or not to call job2.
Another method to get the number of records in the dataset would be to use a call to DSGetLinkInfo() to get the number of rows that went down a particular link in job1.
We are running in daily cycle, So it will not be a null dataset.
The problem in my case is :The records of the last run was loading again in the dataset creating duplicate records.
My requirement is : Not to load the last run records to the database if the current run produses no records.
Can this be achievable by any other way(By not skipping the job)
Otherwise you can create a technical field in your dataset which is different each time your job run and store this parameter in a technical table. Next before launching your job, you check if new records are present or not.
If for some reason you need the past data then add a date field to data set.
In job1 set the derivation as sysdate for this field.
add filter on this field in the job2.
i am overwriting the file, but while loading the last run records are loaded...
Is ther any problem whiile overwriting the file without any records or do i have to change any properties in dataset ??
you can create a new field in the job called 'modified date' which holds the date when the record is updated. If there are new records, compare the date with modified date. Add a filter such that only last loaded records are loaded. this can be achieved by comparing the record load date with the ,modified date column.
Thank you all for your replies,
But now i have a doubt about the dataset stage
:: I am overwriting a dataset here, If there are no records passed ,then the dataset should be emptied.But i am having the past run records. Why is it so....
Please clarify my doubt
Sending zero records to a dataset with the Update Policy set to Overwrite results in an empty dataset, regardless of what was in there before. Something else must be going on.
-craig
"You can never have too many knives" -- Logan Nine Fingers