equalent datastage transaformer 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

equalent datastage transaformer code

Post by vsandu »

Hi Gurus,
i am working on COBOL to DS conversion project , i am facing problem with generating a code for the cobol code

COMPUTE CLAT-CLMT-DSBLTY-DRTN(WS-CLAT-IDX) =
(FUNCTION INTEGER-OF-DATE (WS-VLTN-DT-YYYYMMDD) -
FUNCTION INTEGER-OF-DATE (WS-ONSETDT-YYYYMMDD) + 1)
/ 30.4375
END-COMPUTE
above two are dates , find the days b/w two dats and the divide by 30.4375
please send me equivalent ds code
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 »

Convert both dates to Julian then perform the arithmetic. Convert the result back from Julian.
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 »

It will be much easier if you do it in the SQL query level i.e i mean at the DB level when fetching the data from the table.
FranklinE
Premium Member
Premium Member
Posts: 739
Joined: Tue Nov 25, 2008 2:19 pm
Location: Malvern, PA

Post by FranklinE »

COMPUTE is a "wrapper" that permits complex arithmetic functions formerly restricted to other COBOL keywords like ADD, SUBTRACT, MULTIPLY, etc. If you want to maintain coding integrity in your conversion, I suggest rewriting the COMPUTE on the older standard.

Convert WS-VLTN-DT-YYYYMMDD and WS-ONSETDT-YYYYMMDD to integers in working storage fields defined for them. How you do that is dependent on what the integer values should look like. Julian dates might work best.

SUBTRACT first ws field FROM the other other ws field GIVING yet another ws field.

ADD 1 TO the last ws field.

Finally: DIVIDE [last ws field] BY 30.4376 GIVING CLAT-CLMT-DSBLTY-DRTN.

You will find it relatively easy to convert each step to a similar coding within the transformer, using stage variables in place of the working storage fields.
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
Post Reply