Guest_imported
New member
- Jan 1, 1970
- 0
This code works as it is but it is too long.
Can any one of you gurus please help me condense it?
Here is the code snippet:
FOR i in c_arafab LOOP
IF (i.dept3 = '06B' or i.doc2 = '0007' or i.doc2 = '0507' ) then
BEGIN
IF i.ref = 'A' then
sum1ra := sum1ra + 1;
ELSIF i.ref = 'B' then
sum1rb := sum1rb + 1;
ELSIF i.ref = 'X' then
sum1rx := sum1rx + 1;
ELSIF i.cons = 'A' then
sum1ca := sum1ca + 1;
ELSIF i.cons = 'B' then
sum1cb := sum1cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06F' or i.doc2 = '0016' or i.doc2 = '0516' ) then
BEGIN
IF i.ref = 'A' then
sum2ra := sum2ra + 1;
ELSIF i.ref = 'B' then
sum2rb := sum2rb + 1;
ELSIF i.ref = 'X' then
sum2rx := sum2rx + 1;
ELSIF i.cons = 'A' then
sum2ca := sum2ca + 1;
ELSIF i.cons = 'B' then
sum2cb := sum2cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06G' or i.doc2 = '0024' or i.doc2 = '0524' ) then
BEGIN
IF i.ref = 'A' then
sum3ra := sum3ra + 1;
ELSIF i.ref = 'B' then
sum3rb := sum3rb + 1;
ELSIF i.ref = 'X' then
sum3rx := sum3rx + 1;
ELSIF i.cons = 'A' then
sum3ca := sum3ca + 1;
ELSIF i.cons = 'B' then
sum3cb := sum3cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06A' or i.dept3 = '76A' or i.doc2 = '0006' or i.doc2 = '0506' ) then
BEGIN
IF i.ref = 'A' then
sum4ra := sum4ra + 1;
ELSIF i.ref = 'B' then
sum4rb := sum4rb + 1;
ELSIF i.ref = 'X' then
sum4rx := sum4rx + 1;
ELSIF i.cons = 'A' then
sum4ca := sum4ca + 1;
ELSIF i.cons = 'B' then
sum4cb := sum4cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06C' or i.doc2 = '0023' or i.doc2 = '0523' ) then
BEGIN
IF i.ref = 'A' then
sum5ra := sum5ra + 1;
ELSIF i.ref = 'B' then
sum5rb := sum5rb + 1;
ELSIF i.ref = 'X' then
sum5rx := sum5rx + 1;
ELSIF i.cons = 'A' then
sum5ca := sum5ca + 1;
ELSIF i.cons = 'B' then
sum5cb := sum5cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06L' or i.doc2 = '0022' or i.doc2 = '0522' ) then
BEGIN
IF i.ref = 'A' then
sum6ra := sum6ra + 1;
ELSIF i.ref = 'B' then
sum6rb := sum6rb + 1;
ELSIF i.ref = 'X' then
sum6rx := sum6rx + 1;
ELSIF i.cons = 'A' then
sum6ca := sum6ca + 1;
ELSIF i.cons = 'B' then
sum6cb := sum6cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06D' or i.doc2 = '0010' or i.doc2 = '0510' ) then
BEGIN
IF i.ref = 'A' then
sum7ra := sum7ra + 1;
ELSIF i.ref = 'B' then
sum7rb := sum7rb + 1;
ELSIF i.ref = 'X' then
sum7rx := sum7rx + 1;
ELSIF i.cons = 'A' then
sum7ca := sum7ca + 1;
ELSIF i.cons = 'B' then
sum7cb := sum7cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06M' or i.doc2 = '0013' or i.doc2 = '0513' ) then
BEGIN
IF i.ref = 'A' then
sum8ra := sum8ra + 1;
ELSIF i.ref = 'B' then
sum8rb := sum8rb + 1;
ELSIF i.ref = 'X' then
sum8rx := sum8rx + 1;
ELSIF i.cons = 'A' then
sum8ca := sum8ca + 1;
ELSIF i.cons = 'B' then
sum8cb := sum8cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06K' or i.doc2 = '0017' or i.doc2 = '0517' ) then
BEGIN
IF i.ref = 'A' then
sum9ra := sum9ra + 1;
ELSIF i.ref = 'B' then
sum9rb := sum9rb + 1;
ELSIF i.ref = 'X' then
sum9rx := sum9rx + 1;
ELSIF i.cons = 'A' then
sum9ca := sum9ca + 1;
ELSIF i.cons = 'B' then
sum9cb := sum9cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06E' or i.doc2 = '0035' or i.doc2 = '0535' ) then
BEGIN
IF i.ref = 'A' then
sum10ra := sum10ra + 1;
ELSIF i.ref = 'B' then
sum10rb := sum10rb + 1;
ELSIF i.ref = 'X' then
sum10rx := sum10rx + 1;
ELSIF i.cons = 'A' then
sum10ca := sum10ca + 1;
ELSIF i.cons = 'B' then
sum10cb := sum10cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06I' or i.doc2 = '0039' or i.doc2 = '0539' ) then
BEGIN
IF i.ref = 'A' then
sum11ra := sum11ra + 1;
ELSIF i.ref = 'B' then
sum11rb := sum11rb + 1;
ELSIF i.ref = 'X' then
sum11rx := sum11rx + 1;
ELSIF i.cons = 'A' then
sum11ca := sum11ca + 1;
ELSIF i.cons = 'B' then
sum11cb := sum11cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06H' or i.doc2 = '0018' or i.doc2 = '0518' ) then
BEGIN
IF i.ref = 'A' then
sum12ra := sum12ra + 1;
ELSIF i.ref = 'B' then
sum12rb := sum12rb + 1;
ELSIF i.ref = 'X' then
sum12rx := sum12rx + 1;
ELSIF i.cons = 'A' then
sum12ca := sum12ca + 1;
ELSIF i.cons = 'B' then
sum12cb := sum12cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06P' or i.doc2 = '0004' or i.doc2 = '0504' ) then
BEGIN
IF i.ref = 'A' then
sum13ra := sum13ra + 1;
ELSIF i.ref = 'B' then
sum13rb := sum13rb + 1;
ELSIF i.ref = 'X' then
sum13rx := sum13rx + 1;
ELSIF i.cons = 'A' then
sum13ca := sum13ca + 1;
ELSIF i.cons = 'B' then
sum13cb := sum13cb + 1;
END IF;
END;
sumra1:=sum1ra+sum2ra+sum3ra+sum4ra+sum5ra+sum6ra;
sumra2:=sum7ra+sum8ra+sum9ra+sum10ra+sum11ra+sum12ra+sum13ra;
sumra := sumra1 + sumra2;
sumrb1:=sum1rb+sum2rb+sum3rb+sum4rb+sum5rb+sum6rb;
sumrb2:=sum7rb+sum8rb+sum9rb+sum10rb+sum11rb+sum12rb+sum13rb;
sumrb := sumrb1 + sumrb2;
sumrx1:=sum1rx+sum2rx+sum3rx+sum4rx+sum5rx+sum6rx;
sumrx2:=sum7rx+sum8rx+sum9rx+sum10rx+sum11rx+sum12rx+sum13rx;
sumrx := sumrx1 + sumrx2;
sumca1:=sum1ca+sum2ca+sum3ca+sum4ca+sum5ca+sum6ca;
sumca2:=sum7ca+sum8ca+sum9ca+sum10ca+sum11ca+sum12ca+sum13ca;
sumca := sumca1 + sumca2;
sumcb1:=sum1cb+sum2cb+sum3cb+sum4cb+sum5cb+sum6cb;
sumcb2:=sum7cb+sum8cb+sum9cb+sum10cb+sum11cb+sum12cb+sum13cb;
sumcb := sumcb1 + sumcb2;
sumt := sumra + sumrb + sumrx + sumca + sumcb;
END IF;
END LOOP;
thank u very much!!
tankem
Can any one of you gurus please help me condense it?
Here is the code snippet:
FOR i in c_arafab LOOP
IF (i.dept3 = '06B' or i.doc2 = '0007' or i.doc2 = '0507' ) then
BEGIN
IF i.ref = 'A' then
sum1ra := sum1ra + 1;
ELSIF i.ref = 'B' then
sum1rb := sum1rb + 1;
ELSIF i.ref = 'X' then
sum1rx := sum1rx + 1;
ELSIF i.cons = 'A' then
sum1ca := sum1ca + 1;
ELSIF i.cons = 'B' then
sum1cb := sum1cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06F' or i.doc2 = '0016' or i.doc2 = '0516' ) then
BEGIN
IF i.ref = 'A' then
sum2ra := sum2ra + 1;
ELSIF i.ref = 'B' then
sum2rb := sum2rb + 1;
ELSIF i.ref = 'X' then
sum2rx := sum2rx + 1;
ELSIF i.cons = 'A' then
sum2ca := sum2ca + 1;
ELSIF i.cons = 'B' then
sum2cb := sum2cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06G' or i.doc2 = '0024' or i.doc2 = '0524' ) then
BEGIN
IF i.ref = 'A' then
sum3ra := sum3ra + 1;
ELSIF i.ref = 'B' then
sum3rb := sum3rb + 1;
ELSIF i.ref = 'X' then
sum3rx := sum3rx + 1;
ELSIF i.cons = 'A' then
sum3ca := sum3ca + 1;
ELSIF i.cons = 'B' then
sum3cb := sum3cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06A' or i.dept3 = '76A' or i.doc2 = '0006' or i.doc2 = '0506' ) then
BEGIN
IF i.ref = 'A' then
sum4ra := sum4ra + 1;
ELSIF i.ref = 'B' then
sum4rb := sum4rb + 1;
ELSIF i.ref = 'X' then
sum4rx := sum4rx + 1;
ELSIF i.cons = 'A' then
sum4ca := sum4ca + 1;
ELSIF i.cons = 'B' then
sum4cb := sum4cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06C' or i.doc2 = '0023' or i.doc2 = '0523' ) then
BEGIN
IF i.ref = 'A' then
sum5ra := sum5ra + 1;
ELSIF i.ref = 'B' then
sum5rb := sum5rb + 1;
ELSIF i.ref = 'X' then
sum5rx := sum5rx + 1;
ELSIF i.cons = 'A' then
sum5ca := sum5ca + 1;
ELSIF i.cons = 'B' then
sum5cb := sum5cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06L' or i.doc2 = '0022' or i.doc2 = '0522' ) then
BEGIN
IF i.ref = 'A' then
sum6ra := sum6ra + 1;
ELSIF i.ref = 'B' then
sum6rb := sum6rb + 1;
ELSIF i.ref = 'X' then
sum6rx := sum6rx + 1;
ELSIF i.cons = 'A' then
sum6ca := sum6ca + 1;
ELSIF i.cons = 'B' then
sum6cb := sum6cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06D' or i.doc2 = '0010' or i.doc2 = '0510' ) then
BEGIN
IF i.ref = 'A' then
sum7ra := sum7ra + 1;
ELSIF i.ref = 'B' then
sum7rb := sum7rb + 1;
ELSIF i.ref = 'X' then
sum7rx := sum7rx + 1;
ELSIF i.cons = 'A' then
sum7ca := sum7ca + 1;
ELSIF i.cons = 'B' then
sum7cb := sum7cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06M' or i.doc2 = '0013' or i.doc2 = '0513' ) then
BEGIN
IF i.ref = 'A' then
sum8ra := sum8ra + 1;
ELSIF i.ref = 'B' then
sum8rb := sum8rb + 1;
ELSIF i.ref = 'X' then
sum8rx := sum8rx + 1;
ELSIF i.cons = 'A' then
sum8ca := sum8ca + 1;
ELSIF i.cons = 'B' then
sum8cb := sum8cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06K' or i.doc2 = '0017' or i.doc2 = '0517' ) then
BEGIN
IF i.ref = 'A' then
sum9ra := sum9ra + 1;
ELSIF i.ref = 'B' then
sum9rb := sum9rb + 1;
ELSIF i.ref = 'X' then
sum9rx := sum9rx + 1;
ELSIF i.cons = 'A' then
sum9ca := sum9ca + 1;
ELSIF i.cons = 'B' then
sum9cb := sum9cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06E' or i.doc2 = '0035' or i.doc2 = '0535' ) then
BEGIN
IF i.ref = 'A' then
sum10ra := sum10ra + 1;
ELSIF i.ref = 'B' then
sum10rb := sum10rb + 1;
ELSIF i.ref = 'X' then
sum10rx := sum10rx + 1;
ELSIF i.cons = 'A' then
sum10ca := sum10ca + 1;
ELSIF i.cons = 'B' then
sum10cb := sum10cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06I' or i.doc2 = '0039' or i.doc2 = '0539' ) then
BEGIN
IF i.ref = 'A' then
sum11ra := sum11ra + 1;
ELSIF i.ref = 'B' then
sum11rb := sum11rb + 1;
ELSIF i.ref = 'X' then
sum11rx := sum11rx + 1;
ELSIF i.cons = 'A' then
sum11ca := sum11ca + 1;
ELSIF i.cons = 'B' then
sum11cb := sum11cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06H' or i.doc2 = '0018' or i.doc2 = '0518' ) then
BEGIN
IF i.ref = 'A' then
sum12ra := sum12ra + 1;
ELSIF i.ref = 'B' then
sum12rb := sum12rb + 1;
ELSIF i.ref = 'X' then
sum12rx := sum12rx + 1;
ELSIF i.cons = 'A' then
sum12ca := sum12ca + 1;
ELSIF i.cons = 'B' then
sum12cb := sum12cb + 1;
END IF;
END;
ELSIF (i.dept3 = '06P' or i.doc2 = '0004' or i.doc2 = '0504' ) then
BEGIN
IF i.ref = 'A' then
sum13ra := sum13ra + 1;
ELSIF i.ref = 'B' then
sum13rb := sum13rb + 1;
ELSIF i.ref = 'X' then
sum13rx := sum13rx + 1;
ELSIF i.cons = 'A' then
sum13ca := sum13ca + 1;
ELSIF i.cons = 'B' then
sum13cb := sum13cb + 1;
END IF;
END;
sumra1:=sum1ra+sum2ra+sum3ra+sum4ra+sum5ra+sum6ra;
sumra2:=sum7ra+sum8ra+sum9ra+sum10ra+sum11ra+sum12ra+sum13ra;
sumra := sumra1 + sumra2;
sumrb1:=sum1rb+sum2rb+sum3rb+sum4rb+sum5rb+sum6rb;
sumrb2:=sum7rb+sum8rb+sum9rb+sum10rb+sum11rb+sum12rb+sum13rb;
sumrb := sumrb1 + sumrb2;
sumrx1:=sum1rx+sum2rx+sum3rx+sum4rx+sum5rx+sum6rx;
sumrx2:=sum7rx+sum8rx+sum9rx+sum10rx+sum11rx+sum12rx+sum13rx;
sumrx := sumrx1 + sumrx2;
sumca1:=sum1ca+sum2ca+sum3ca+sum4ca+sum5ca+sum6ca;
sumca2:=sum7ca+sum8ca+sum9ca+sum10ca+sum11ca+sum12ca+sum13ca;
sumca := sumca1 + sumca2;
sumcb1:=sum1cb+sum2cb+sum3cb+sum4cb+sum5cb+sum6cb;
sumcb2:=sum7cb+sum8cb+sum9cb+sum10cb+sum11cb+sum12cb+sum13cb;
sumcb := sumcb1 + sumcb2;
sumt := sumra + sumrb + sumrx + sumca + sumcb;
END IF;
END LOOP;
thank u very much!!
tankem