Issue with reading varchar() as zoned decimal

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
sshettar
Premium Member
Premium Member
Posts: 264
Joined: Thu Nov 30, 2006 10:37 am

Issue with reading varchar() as zoned decimal

Post by sshettar »

I have this job where i am reading a file with 10 fields of which one column which should be in signed decimal form

the data looks like this
000000{
009600A
034566}

and this should be stored as decimal(7,2)

and the out put should look like
00000.00
00960.01
-0345.66

I tried giving something like this in the edit column metadata
Decimal Type
Data format = text
Allow all zeros = yes
Packed = no (overpunch)
Signed position = trailing
Precision = 7
Scale =2
Field width = 7

But no use cause its reading all zeros for all values
here is what it reads
00000.00
00000.00
00000.00
00000.00


How do i accomplish this

Any help would be highly appreciated

Thanks
Mike
Premium Member
Premium Member
Posts: 1021
Joined: Sun Mar 03, 2002 6:01 pm
Location: Tampa, FL

Post by Mike »

Are these values encoded as EBCDIC? Or have they been handed to you after an EBCDIC to ASCII translation (frequently the result of an ftp that wasn't done in binary). The overpunch character only retains its meaning while in EBCDIC form.

For example:
A has a hex value of C1 in EBCDIC, which equates to +1 (i.e. C is the nibble denoting a positive sign and 1 is the nibble denoting the digit)

In ASCII, A has a hex value of 41 (so the meaning of the nibbles has been corrupted by a translation to ASCII).

If your values are in ASCII, you'll have to convert the 20 possible ASCII characters into a multiplier (+1 or -1) and a digit 0-9, and reconstruct your number (stage variables and the convert function will help with this).

Mike
Post Reply