QualityStage Ruleset problem - variable

Infosphere's Quality Product

Moderators: chulett, rschirm

Post Reply
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

QualityStage Ruleset problem - variable

Post by Luciana »

I need to store the result of a multiplication in a variable.
COPY " 3 " tmp1
COPY " 4 " tmp2
[tmp1 * tmp2] = result

Is it possible to do this in QualityStage? I verified in the documentation of the Pattern-Action Language that is possible to execute a multiplication, but I didn't find anything on this.

Can any one help me to resolve
roy
Participant
Posts: 2598
Joined: Wed Jul 30, 2003 2:05 am
Location: Israel

Post by roy »

Hi,
I think the docs have the language syntax.
Alas I have no access to QS at the moment and it has been a while since I last used it...

IHTH,
Roy R.
Time is money but when you don't have money time is all you can afford.

Search before posting:)

Join the DataStagers team effort at:
http://www.worldcommunitygrid.org
Image
Alexander
Participant
Posts: 17
Joined: Fri May 12, 2006 10:10 am
Location: Europe

Re: QualityStage Ruleset problem - variable

Post by Alexander »

Hi,

I don't use arithmetic expression in a ruleset along time ago.

Last time I do it, i used a TBL file with the arithmethic table:
1x1 1
...
4x5 20
...
9x9 81

then put var1xvar2 in one variable and convert it using TBL file.
Luciana
Participant
Posts: 60
Joined: Fri Jun 10, 2005 7:22 am
Location: Brasil

Post by Luciana »

Hi Alexander,

Thank you. Your solution is interesting, but I also need to execute sum and division.
I have a routine in basic (in DataStage) and it would like this validation in QualityStage.

Code: Select all

Function valCPF(cpf)

   Dim VetNum(11)

   numCpf = fmt(cpf,"11'0'R")
   For count = 1 to 11
      VetNum(count) = numCpf[count, 1]
   Next count

   Total1 = VetNum(1) * 10 + VetNum(2) * 9 + VetNum(3) * 8 + VetNum(4) * 7 + VetNum(5) * 6
   Total1 = Total1 + VetNum(6) * 5 + VetNum(7) * 4 + VetNum(8) * 3 + VetNum(9) * 2

   resto1 = mod(Total1,11)
   if resto1 < 2 then
      Dig1 = 0
   End
   Else
      Dig1 = 11 - resto1
   End

   if Dig1 <> VetNum(10) then
      Ans = "CPF invalid"
   End
   Else
 
      Total2 = VetNum(1) * 11 + VetNum(2) * 10 + VetNum(3) * 9 + VetNum(4) * 8 + VetNum(5) * 7
      Total2 = Total2 + VetNum(6) * 6 + VetNum(7) * 5 + VetNum(8) * 4 + VetNum(9) * 3 + Dig1 * 2

      resto2 = mod(Total2,11)
      if resto2 < 2 then
         Dig2 = 0
      End
      Else
         Dig2 = 11 - resto2
      End

      if Dig2 <> VetNum(11) then
         Ans = "CPF invalid"
      End
      Else
         Ans = "CPF valid"
      End
   End
Return(Ans)
Alexander
Participant
Posts: 17
Joined: Fri May 12, 2006 10:10 am
Location: Europe

Post by Alexander »

Hi,

I recgonize that function, it's to validate a checkdigit of somekind.

In QS there isn't any easy way to do it, you could use a Ruleset but will give you a lot of headache, using 2 TBL files with two arithmetic + and *.

I advise you to implement it in another language wich you could invoke from PGM operation, like perl or shellscript.

Alex
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

I agree - that would be almost impossible in PAL. Alexander's advice to use PGM is sound.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply