COnversion

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

COnversion

Post by shrey3a »

Hi,

I've a typical scenario , I need to do the below conversion to provide the file to mainframe group so that they can match the data from ascential generated file with mainframe file

e.g. Value -212.00 should be converted to 0000000021200D

The above looks like decimal to Hex conversion. I tried all tyhe routines in DS for the same like Xtd, dtx, mxoc, MUOC but its not giving the desired o/p even i tried the packed decimal routines provided by datastage for packed decimal field .

Can any body help.

Regards.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Nope, not hex, not packed. Looked like Zoned Decimal for a second, but it's not that either. Ask your mainframe folks what that 'D' is supposed to represent.

The FMT command can handle the zero padding and the descaling of the number to remove the decimal point.
-craig

"You can never have too many knives" -- Logan Nine Fingers
I_Server_Whale
Premium Member
Premium Member
Posts: 1255
Joined: Wed Feb 02, 2005 11:54 am
Location: United States of America

Post by I_Server_Whale »

Hi Shrey3a,

I have encountered a similar case before. It looks like you have to encode your values using a particular logic. Find out if there is any logic to be applied inorder to get the 00D for a negative number.

I think your o/p field is of length 14. You should also let us know the length and datatype of your input field.

More information is needed from your side to proceed further. Once you are sure about the conversion logic, then apply the logic and use the Fmt function as said by Craig.

Thanks,
Naveen.
shrey3a
Premium Member
Premium Member
Posts: 234
Joined: Sun Nov 21, 2004 10:41 pm

Post by shrey3a »

Hi ,

The D stands for (-) and (+) or nothing stands for C. And length of the mainframe field is 14.

Regards,
naveendronavalli wrote:Hi Shrey3a,

I have encountered a similar case before. It looks like you have to encode your values using a particular logic. Find out if there is any logic to be applied inorder to get the 00D for a negative number.

I think your o/p field is of length 14. You should also let us know the length and datatype of your input field.

More information is needed from your side to proceed further. Once you are sure about the conversion logic, then apply the logic and use the Fmt function as said by Craig.

Thanks,
Naveen.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Was wondering if 'D' was debit.

So look at using FMT for everything except the 'D' and manually tack the appropriate trailer character on based on the sign of the amount.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Code: Select all

Fmt(Abs(Iconv(TheNumber,"MD2")),"R%13") : (If TheNumber < 0 Then "D" Else "C")
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