DSRoutine
Moderators: chulett, rschirm, roy
DSRoutine
Hi
I am having ajob sequence. One of the job activity in the job sequence has a job in the following way:
STPstage--->Sequential File.
So now the sequential file is storing the output of procedure as Error num = 1 or 0. But my sequence is runing irrespective of whether the procedure fails or success.
Now I would like to read the output from the file and check if it is 0 then the next job activity should be triggered else job sequence should get aborted.
How to accomplish this
I am having ajob sequence. One of the job activity in the job sequence has a job in the following way:
STPstage--->Sequential File.
So now the sequential file is storing the output of procedure as Error num = 1 or 0. But my sequence is runing irrespective of whether the procedure fails or success.
Now I would like to read the output from the file and check if it is 0 then the next job activity should be triggered else job sequence should get aborted.
How to accomplish this
Pradeep Kumar
Re: DSRoutine
Of course - it does not have a clue that a '1' to you means there was a problem. The job ran just fine so the Sequence goes on with life.pradkumar wrote:So now the sequential file is storing the output of procedure as Error num = 1 or 0. But my sequence is runing irrespective of whether the procedure fails or success.
You have a couple of options. One would be to add your '1' as a Fatal Error on the Error Codes tab of the SP stage. When one of them is detected, the job aborts.
Or use an Execute Command stage to 'cat' or 'echo' the contents of the file to std out. You can then interrogate $CommandOutput<1> from the stage in a Custom trigger and send it down the proper link based on the value found.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Thanks
Actually the error can be anything and not only 1.
I developed a routine as follows:
$INCLUDE DSINCLUDE JOBCONTROL.H
EQUATE RoutineName TO 'GetErrorNum'
EQUATE filename TO FileName
* Attempt to open the Error file.
OpenSeq filename TO SeqFile Else
Call DSLogFatal("Error opening ":filename,RoutineName)
End
* Attempt to read the named record from the file.
ReadSeq errornum From SeqFile Else
Call DSLogFatal ("Error Retrieving ErrorNum from ":FileName, RoutineName)
End
CloseSeq SeqFile
If errornum = 0 Then
errornum = 0
End
Ans = errornum
In the job sequence:
Success
proc1---->routineactivity-------->job2
|(Fail)
|
Mail
In the trigger apge of routine activity I am mentioning the filename in single quotes.
I am using Return Value conditional = 0 for sucess link
and Failed for other link.
But even though the procedure gets executed I am getting a Failed mail.
Actually the error can be anything and not only 1.
I developed a routine as follows:
$INCLUDE DSINCLUDE JOBCONTROL.H
EQUATE RoutineName TO 'GetErrorNum'
EQUATE filename TO FileName
* Attempt to open the Error file.
OpenSeq filename TO SeqFile Else
Call DSLogFatal("Error opening ":filename,RoutineName)
End
* Attempt to read the named record from the file.
ReadSeq errornum From SeqFile Else
Call DSLogFatal ("Error Retrieving ErrorNum from ":FileName, RoutineName)
End
CloseSeq SeqFile
If errornum = 0 Then
errornum = 0
End
Ans = errornum
In the job sequence:
Success
proc1---->routineactivity-------->job2
|(Fail)
|
In the trigger apge of routine activity I am mentioning the filename in single quotes.
I am using Return Value conditional = 0 for sucess link
and Failed for other link.
But even though the procedure gets executed I am getting a Failed mail.
Pradeep Kumar
-
- Premium Member
- Posts: 1255
- Joined: Wed Feb 02, 2005 11:54 am
- Location: United States of America
Did you test the routine individually by passing the 'FileName' to it?
Does it return the right code when tested?
Whale.
Does it return the right code when tested?
Whale.
Anything that won't sell, I don't want to invent. Its sale is proof of utility, and utility is success.
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Author: Thomas A. Edison 1847-1931, American Inventor, Entrepreneur, Founder of GE
Ok, just going on the fact that you said "the sequential file is storing the output of procedure as Error num = 1 or 0".pradkumar wrote:Actually the error can be anything and not only 1.
Would have been simpler to just "type filename" in an Execute Command stage and check the CommandOutput variable.pradkumar also wrote:I developed a routine as follows:
Then it is not returning a zero... and you need to figure out why. Suggest you add a call (or two) to DSLogInfo and write some fun things into the job's log like your value of errornum just before you pass it back. That and anything else you think might be of use.pradkumar lastly wrote:But even though the procedure gets executed I am getting a Failed mail.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
Since you are on a Windows server, you literally put "type" as the Command and the filename (or the job parameter you are using for the filename) in the Parameters section. That's it.
Then you use the Activity Variable "StageName.$CommandOutput<1>" as the LHS of a custom trigger - and compare that to whatever comes from the command: '0', '1', whatever and branch accordingly.
Then you use the Activity Variable "StageName.$CommandOutput<1>" as the LHS of a custom trigger - and compare that to whatever comes from the command: '0', '1', whatever and branch accordingly.
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
I am sorry for my mistake. My files ares tored in unix box.
And The procedure returns "0" if success and can return any oracle error number if not sucesss.
Is there anything similar to type(windows) in UNIX.
Is it cat?
And The procedure returns "0" if success and can return any oracle error number if not sucesss.
Is there anything similar to type(windows) in UNIX.
Is it cat?
Last edited by pradkumar on Wed Dec 20, 2006 10:43 pm, edited 2 times in total.
Pradeep Kumar
I am using cat in command and file name in parameter.
I am using in the stage as follows:
Expression type = Custom COnditional
Expression value : Execute_Command_12.$CommandOutput ='0' (for one link)
Execute_Command_12.$CommandOutput<>'0' (for naother link)
Even though my procedure gets executed succesfully, the sequence is passing to fail link.
Moreover when I see my log I am getting the following:
*** No output from command ***
Any suggestions plz?
I am using in the stage as follows:
Expression type = Custom COnditional
Expression value : Execute_Command_12.$CommandOutput ='0' (for one link)
Execute_Command_12.$CommandOutput<>'0' (for naother link)
Even though my procedure gets executed succesfully, the sequence is passing to fail link.
Moreover when I see my log I am getting the following:
*** No output from command ***
Any suggestions plz?
Pradeep Kumar
In the command activity stage you have to give the fully qualified path of the file.
Code: Select all
cat /Dir1/Dir2/Dir3/myfile.txt
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.