Page 1 of 1

please provide replica DS transformer code of below code

Posted: Thu Feb 28, 2013 3:36 am
by vsandu
below is the COBOL code , please provide DS code for the same
immediate reply appreciate


EVALUATE CLAT-DIAGN-CD(WS-CLAT-IDX)
WHEN 0.0 THROUGH 136.9
MOVE 1 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 137.0 THROUGH 226.9
MOVE 2 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 227.0 THROUGH 279.9
MOVE 3 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 280.0 THROUGH 289.9
MOVE 4 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 290.0 THROUGH 315.9
MOVE 5 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 316.0 THROUGH 389.9
MOVE 6 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 390.0 THROUGH 458.9
MOVE 7 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 459.0 THROUGH 519.9
MOVE 8 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 520.0 THROUGH 577.9
MOVE 9 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 578.0 THROUGH 629.9
MOVE 10 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 630.0 THROUGH 677.9
MOVE 11 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 678.0 THROUGH 709.9
MOVE 12 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 710.0 THROUGH 738.9
MOVE 13 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 739.0 THROUGH 796.9
MOVE 14 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN 797.0 THROUGH 996.9
MOVE 15 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
WHEN OTHER
MOVE 16 TO CLAT-DIAGN-CTGRY-CD(WS-CLAT-IDX)
END-EVALUATE.

Posted: Thu Feb 28, 2013 4:22 am
by ray.wurlod
If .. Then .. Else If .. Then .. Else If .. Then .. Else ...

Posted: Thu Feb 28, 2013 10:13 am
by sudha03_vpr
Just to Brief on what ray suggested

If CLAT-DIAGN-CD >= 0.0 and CLAT-DIAGN-CD <= 136.9 Then
1
Else If CLAT-DIAGN-CD >=137.0 and CLAT-DIAGN-CD <= 226.9 Then
2
So Forth.

You may be writing this in the derivation part of the transformer against the Column CLAT-DIAGN-CTGRY-CD or else you can create stag variable.

Posted: Thu Feb 28, 2013 1:43 pm
by FranklinE
Venkat, the general answer is that DataStage does not offer an equivalent of EVALUATE (case, switch) at the column level. It is a big reason why I require my COBOL partners to handle this sort of logic as much as possible before I get the data for ETL.

Posted: Thu Feb 28, 2013 2:16 pm
by sudha03_vpr
Most of the Switch and Case functionalities can be achieved by IF THEN ELse If in datastage. Am not sure what you mean by that.

Posted: Thu Feb 28, 2013 2:47 pm
by FranklinE
sudha03_vpr wrote:Most of the Switch and Case functionalities can be achieved by IF THEN ELse If in datastage. Am not sure what you mean by that.
In COBOL development -- especially in shops like mine with millions of lines of code -- simpler is always better. Indeed, for complex IF statements with more than 3 or 4 branches, we would require the developer to rewrite it with EVALUATE.

Testing and code coverage in DataStage would be more efficient if we had a case-style function. Venkat's example is fairly common, and I would see it as a major headache to properly test.

Posted: Thu Feb 28, 2013 3:17 pm
by sudha03_vpr
I agree with that but every tool / programing has its own pros and cons. I was involved in migrating the COBOL code to Datastage and luckily i was not having a complex loop. But COBOL data loads was taking a day's time but with Datastage or with any relevant ETL tool, it would take a hour or lesser than that (For the same Volume).

Posted: Thu Feb 28, 2013 3:50 pm
by ray.wurlod
There is a simpler technique in DataStage when the intervals are identically sized. Such was not the case in this example.