Hi
Job1. Load Data To Sequential File S1
Job2. S1-------->Target
While running job Job2, I want to check the source file S1 for data. If there is no row in the file I want to exit the job with Status Success. How it can be done? Please suggest.
Regards
rubu
Abort Job While No rows in Source File
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 3337
- Joined: Mon Jan 17, 2005 4:49 am
- Location: United Kingdom
In other words, there is absolutely no problem with processing an 'empty' sequential file. The job will simply process zero records and then declare everything good, green and A-Ok.
You problem will come in if the file does not exist. That will cause the job to abort.
You problem will come in if the file does not exist. That will cause the job to abort.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Add job control code (job properties dialog) to perform the check and issue a DSStopJob(DSJ.ME) request. Job control code, if present, is executed before any stage is opened.
Code: Select all
FileName = DSGetParamInfo(DSJ.ME, "FileName", DSJ.PARAMVALUE)
If FileName < 0
Then
Call DSLogFatal("Unable to get FileName job parameter value", "Job control")
End
Else
Command = "wc -l " : FileName
Call DSExecute("UNIX", Command, Result, ExitStatus)
If ExitStatus = 0
Then
If Oconv(Result, "MCN") = 0
Then
Call DSLogInfo("Job stopped because input file empty.", "Job control")
ErrCode = DSStopJob(DSJ.ME)
End
End
Else
Call DSLogWarn("Error in wc command: " : @FM : Result, "Job control")
ErrCode = DSStopJob(DSJ.ME)
End
End
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.