Hi All:
My source file has 1 header, n detail and 1 trailer records.
First I perform a check on the header, if the header is not found, I abort the job after 1 record in the constraint.
I need to do the same with the trailer. I reject the trailer in a separate sequencial file, here if the trailer is not found then abort the job. I am unable to do this in the constraint, as there is no record found in the sequencial file, if the trailer does not appear in the source file.
Hence I am trying to write a routine using the DSLogfatal, but cannot get started with it. Can anyone please guide me thru the steps I need to follow or what should be included in the routine. Also where and how do I implement this routine?
Any help is greatly appreciated.
How to abort a job in a routine if the source file is empty?
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 17
- Joined: Wed Jul 07, 2004 7:59 am
Why not write a before/after routine that uses Unix commands? In the routine, you can use the DSExecute API (search the forum for LOADS of examples) to execute a shell command. You can do heads and tails and lots of stuff that will return the screen output in a variable, then look at the variable and take appropriate action. To call DSLogFatal, again search the forum for loads of examples.
Kenneth Bland
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
In the tranform into which the input file is going, code something like the following in a derivation field:
If Input.HeaderCount = 0 then UtilityAbortToLog("No Records to process") Else Input.HeaderCount
Modify this to fit your needs. Use field names to match your transform, put your own expression after the else.
You might want to verify the syntax, but it is close.
Larry
If Input.HeaderCount = 0 then UtilityAbortToLog("No Records to process") Else Input.HeaderCount
Modify this to fit your needs. Use field names to match your transform, put your own expression after the else.
You might want to verify the syntax, but it is close.
Larry
Hi ,
We had also same problem , but we resolve this problem with Unix shell scripting, we had got confirmation that source file having standard head and trailer , then we create unix script which check header and trailer and call this script in datastage job - before job subrotuine .
With Regards
Arun
We had also same problem , but we resolve this problem with Unix shell scripting, we had got confirmation that source file having standard head and trailer , then we create unix script which check header and trailer and call this script in datastage job - before job subrotuine .
With Regards
Arun
Arun Verma
-
- Participant
- Posts: 17
- Joined: Wed Jul 07, 2004 7:59 am