Date in file name : Logic to abort.
Moderators: chulett, rschirm, roy
Date in file name : Logic to abort.
Hi,
I need to determine a logic for the below scenario.
I have an input file name as file_mmddyyyy.txt. Also run time parameter DATE as YYYY-MM-DD . I need to abort the job with a fail status if the date in the input file name that is mmddyyyy is not equal to the DATE from input parameter i.e YYYY-MM-DD.
I think this can be implemented in Before Routine-ExecSH or else in transformer. Greatly appreciate if you can come up with a logic.
I need to determine a logic for the below scenario.
I have an input file name as file_mmddyyyy.txt. Also run time parameter DATE as YYYY-MM-DD . I need to abort the job with a fail status if the date in the input file name that is mmddyyyy is not equal to the DATE from input parameter i.e YYYY-MM-DD.
I think this can be implemented in Before Routine-ExecSH or else in transformer. Greatly appreciate if you can come up with a logic.
-------------------------------------------
Kumar
Kumar
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Don't even start the job if your condition is not met. Test it in a sequence.
Where does the file name come from? Simply extract the date component from that, reformat the date appropriately and compare it to your criterion date in an Execute Command activity.
Where does the file name come from? Simply extract the date component from that, reformat the date appropriately and compare it to your criterion date in an Execute Command activity.
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.
Sorry Ray,
I have misinterpreted the requirement. I need to compare the incoming date field with the parameter date and if equal continue else abort the job and return the message with a failed status.
I think this can be implemented in transformer constraint.
Could you please suggest me an idea?
I have misinterpreted the requirement. I need to compare the incoming date field with the parameter date and if equal continue else abort the job and return the message with a failed status.
I think this can be implemented in transformer constraint.
Could you please suggest me an idea?
-------------------------------------------
Kumar
Kumar
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Suddenly we're in a Transformer stage. So you intend to check the file name for every row you process? Where is the source of this "incoming date field"? Why do you want to abort the job?
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.
Actually the job has already been designed by somebody else.Now i have been asked to implement this logic. I have no other knowledge on this.
I know that input date field is coming from a flat file and parameter date is passed in a transformer using a scheduling tool at run time.
So I thought can establish a condition in the transformer for equality and when if not equal i have to abort the job with the failed message.
This is the only thing i have asked to do and gave me no other extra information.
I know that input date field is coming from a flat file and parameter date is passed in a transformer using a scheduling tool at run time.
So I thought can establish a condition in the transformer for equality and when if not equal i have to abort the job with the failed message.
This is the only thing i have asked to do and gave me no other extra information.
-------------------------------------------
Kumar
Kumar
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Constrain the output from the Transformer stage such that the incoming date field is equal to the parameter value.
Create an extra output from the Transformer stage. Mark this as Otherwise/Log and set a row limit on it of 1. The first mismatch will cause your job to abort.
I really don't like writing jobs that abort. I don't even like writing jobs that generate warnings.
Create an extra output from the Transformer stage. Mark this as Otherwise/Log and set a row limit on it of 1. The first mismatch will cause your job to abort.
I really don't like writing jobs that abort. I don't even like writing jobs that generate warnings.
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Not if you need the job to abort.
If you don't need the job to abort, but only to process rows for which the date matches, then go with the single output link.
If you don't need the job to abort, but only to process rows for which the date matches, then go with the single output link.
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.
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai
Based on ur description ... you can handle this in unix itself ...
file_name=filenanme_ddmmyyyy
date=passed_date
grep $date $file_name
rc=?
if $rc = 0
rundsjob OR exit 0 and run the ds job separately from scheduling tool
else
print " wt ever "
exit 1
Additionally you can use cut command to manager ur date format ...
let me knw ur thoughts
file_name=filenanme_ddmmyyyy
date=passed_date
grep $date $file_name
rc=?
if $rc = 0
rundsjob OR exit 0 and run the ds job separately from scheduling tool
else
print " wt ever "
exit 1
Additionally you can use cut command to manager ur date format ...
let me knw ur thoughts
Thanks
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
Swapnil
"Whenever you find whole world against you just turn around and Lead the world"
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
My thoughts? That you need to learn to spell. If you can, then you need to learn to write professionally when corresponding with others via DSXchange!swapnilverma wrote:Based on ur description ... you can handle this in unix itself ...
file_name=filenanme_ddmmyyyy
date=passed_date
grep $date $file_name
rc=?
if $rc = 0
rundsjob OR exit 0 and run the ds job separately from scheduling tool
else
print " wt ever "
exit 1
Additionally you can use cut command to manager ur date format ...
let me knw ur thoughts
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.
-
- Participant
- Posts: 135
- Joined: Tue Aug 14, 2007 4:27 am
- Location: Mumbai