please provide replica DS transformer code of below code

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
vsandu
Participant
Posts: 13
Joined: Mon Aug 09, 2010 3:50 am

please provide replica DS transformer code of below code

Post 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.
Venkat Sandu
vsandu.cg@gmail.com
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If .. Then .. Else If .. Then .. Else If .. Then .. Else ...
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sudha03_vpr
Participant
Posts: 34
Joined: Tue Feb 26, 2013 9:36 am
Location: Chicago

Post 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.
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post 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.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
sudha03_vpr
Participant
Posts: 34
Joined: Tue Feb 26, 2013 9:36 am
Location: Chicago

Post 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.
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post 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.
Franklin Evans
"Shared pain is lessened, shared joy increased. Thus do we refute entropy." -- Spider Robinson

Using mainframe data FAQ: viewtopic.php?t=143596 Using CFF FAQ: viewtopic.php?t=157872
sudha03_vpr
Participant
Posts: 34
Joined: Tue Feb 26, 2013 9:36 am
Location: Chicago

Post 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).
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is a simpler technique in DataStage when the intervals are identically sized. Such was not the case in this example.
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