Set Transaction

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
aditya
Charter Member
Charter Member
Posts: 41
Joined: Sat May 28, 2005 7:32 am

Set Transaction

Post by aditya »

DS Gurus,

I have a requirement where I have to log errors to a file, do a count reconciliation on the file and check whether the count on the error file is greater than say x%

If the count is greater than x% then I will have to rollback all the inserts I have made to the target tables. Else I will have to commit them.

I had thought of the following job structure:

Script which
invokes the ===> DS Job
Set Transaction ===> DS Job ----> Reconciliation---> Script that
in Oracle commits the
transaction

Multiple DS Jobs run in parallel and are all associated with the same transaction.

My question was whether such a scenario is feasible or is there a better turnaround.

Thanks
Aditya.
DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

Do a count on the file, something like "wc -l" and perform your percentage manipulation. Pass that value as a job parameter to your job.
Specify a reject link that will capture all the rejects. The constraint will, along with the .REJECTED, IF @OUTROWNUM > ABORTCOUNT then UtilityAbortToLog("Threshold Reached") else @TRUE.
'ABORTCOUNT' will be the parameter.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Don't have time for a 'proper' answer, but it's way too late to commit in a script - it's done by then. Once the stage is 'closed' your changes are either commited or rolled back, all you can do after that is 'undo' them all. Which goes way beyond deleting new records, typically.

I do believe that you'll need to do your calculation 'on the fly' and abort the moment you exceed the threshold...
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply