how to implement Reject logic

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

how to implement Reject logic

Post by marpadga18 »

SUK |ECS |EC goods imported into UK |0 |31/12/20|28/01/98|
SUK |OTS |Outside The Scope 0% |0 |31/12/20|04/02/98|
SUK |PRO |Irrecoverable VAT pro-forma |17500 |31/12/20|01/01/06|
SUK |RVC |Reverse Charge-Int'l Service |0 |31/12/20|01/04/91|
SUK |UKB |Tax 17.5% |17500 |31/12/09|01/12/08|
SUK |UKB |Tax 15.0% |15000 |31/12/20|01/01/10|
SUK |UKN |UK Non Recoverable 0% |0 |31/12/20|04/02/98|
SUK |UKR |Reduced rate VAT 5% |5000 |31/12/20|01/01/97|

Above is the sample file format.
I need to reject row if the coumn does not have | before column that
record should be rejected.
I kept a reject link in transformer stage but how to give a condition I am
not able to do?
can any one can share their ideas??
Thanks,
M
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Use a reject link from the Sequential File stage that reads this file. Rows will be rejected if they don't contain the correct number of field delimiter characters.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

ray.wurlod wrote:Use a reject link from the Sequential File stage that reads this file. Rows will be rejected if they don't contain the correct number of field delimiter characters. ...
You mean keep a reject link from sequential file were I read the data?
no need for trnsformer stage?
Thanks,
M
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Yes. In PX it would be directly from the stage, source or target, not off the Transformer like you would do in the Server product.
-craig

"You can never have too many knives" -- Logan Nine Fingers
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

i kept a reject link from source seq_file stage
and Reject mode= output
than also it is not rejecting the records to reject link

it should reject in the below scenario mentioned if the coulmn does not have |before it reject it..
SHARPUK |ECS |EC goods imported into UK |0 |31/12/20|28/01/98|
SHARPUK |OTS |Outside The Scope 0% |0 |31/12/20|04/02/98|
SHARPUK |PRO |Irrecoverable VAT pro-forma |17500 |31/12/20|01/01/06|
SHARPUK |RVC Reverse Charge-Int'l Service |0 |31/12/20|01/04/91|
SHARPUK |UKB |Tax 17.5% |17500 |31/12/09|01/12/08|
SHARPUK |UKB |Tax 15.0% |15000 |31/12/20|01/01/10|
SHARPUK |UKN |UK Non Recoverable 0% |0 |31/12/20|04/02/98|
SHARPUK |UKR |Reduced rate VAT 5% |5000 |31/12/20|01/01/97|
SHARPUK |UKS |Tax Rate 17.5% 17500 |30/11/08|01/01/94|
SHARPUK |UKS Tax Rate 15.0% |15000 |31/12/09|01/12/08|
SHARPUK |UKS Tax Rate 17.5% |17500 |31/12/20|01/01/10|
SHARPUK |UKZ UK Zero Rate 0% |0 |31/12/20|04/02/98|
SHARPUK |UVO |"UK VAT Only " 17500 |31/12/20|01/01/94|
SHARPUK |WWV |Foreign Invoice NON UK VAT |0 |31/12/20|01/04/91|
SHARPUK |XMT |Exempt 0% |0 |31/12/20|28/01/98|
Thanks,
M
ravireddy25
Participant
Posts: 59
Joined: Wed Dec 31, 2008 5:49 am

Re: how to implement Reject logic

Post by ravireddy25 »

Hi,
Afer sequential file take transformer and do the count based on '|'
any way you will be knowing the max limit so that you can put constraint
in transformer saying that count less than that should be passed else rejected.
Ravi
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Re: how to implement Reject logic

Post by marpadga18 »

hi Ravi thanks for reply but need some help!

in seq_file _stage i gave this format
Record level:
Final delimeter =none
Record delimeter = Unix new line
Field defaults:
Delimeter =|
Quote = none
job is running fine but problem when testing it with reject logic not able to get reject records:(:(:(

but not able to reject the records to reject file if coulmn doesnot have "|" before it..


I never did this scenario can u elaborate more? I mean what condition we should give? total "|" in file are 5 no need to vary about the last "|"
could you please give any example reagrding the condition in transformer stage?

These are the cloumns
Tra_Ori varchar 10
Tax_Ra varchar 10
Desc varchar 30
TR_1 varchar 7
expirydate varchar 8
effective dt varchar 8
Thanks,
M
udayk_2007
Participant
Posts: 72
Joined: Wed Dec 12, 2007 2:29 am

Post by udayk_2007 »

you can design your job this way

Seq_File------->Transformer------> Seq_File

In the source sequential file..take the complete record in only one field only..declare its length as the maximum possible length of a record according to your input specifications

Then use Dcount function in transformer which i guess,counts the number of occurence of given symbol (in your case its pipe)

If the value returned by Dcount function for a record, is less than the minimum number of pipes you are expecting,then direct it to the reject link

Hope this helps

Regards
Ulhas
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

chulett wrote:Yes. In PX it would be directly from the stage, source or target, not off the Transformer like you would do in the Server product. ...
in seq_file _stage i gave this format
Record level:
Final delimeter =none
Record delimeter = Unix new line
Field defaults:
Delimeter =|
Quote = none
reject mode=output

job is running fine but problem when testing it with reject logic not able to get reject records:(

but not able to reject the records to reject file if coulmn doesnot have "|" before it..


These are the cloumns
Tra_Ori varchar 10
Tax_Ra varchar 10
Desc varchar 30
TR_1 varchar 7
expirydate varchar 8
effective dt varchar 8

any clear solution for rejecting from source stage seq-file stage were I am redaing the data???
Thanks,
M
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Try being more explicit with data types. VarChar is very forgiving. Change TR1 to integer and expirydate and effective_dt to date (with a format string of "%dd/%mm/%yy").
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

hi
Need some condition in transformer stage to reject the rows if "|" are less than 5 so that i can reject that row?
Thanks,
M
nitkuar
Participant
Posts: 46
Joined: Mon Jun 23, 2008 3:09 am

Post by nitkuar »

ray.wurlod wrote:Use a reject link from the Sequential File stage that reads this file. Rows will be rejected if they don't contain the correct number of field delimiter characters. ...
Ray's solution should resolve the issue. Could you please provide some sample record which is not getting rejected as per your expectations.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

marpadga18 wrote:Need some condition in transformer stage to reject the rows if "|" are less than 5 so that i can reject that row?
Constraint expression of

Code: Select all

Count(InLink.TheString, "|") >= 5
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
marpadga18
Premium Member
Premium Member
Posts: 96
Joined: Fri Aug 20, 2010 8:51 am

Post by marpadga18 »

chulett wrote:Yes. In PX it would be directly from the stage, source or target, not off the Transformer like you would do in the Server product. ...
Thanks chulett it is rejecting when I keep reject link from source file itself thanks for ur help
Thanks,
M
Post Reply