How to convert a FIXED DECIMAL type in using flat files

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
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

How to convert a FIXED DECIMAL type in using flat files

Post by DS_MJ »

Hello All:

I am getting a VSAM file (Binary) converted to ASCII format as my source file. This source file is a flat file with fixed width length. However there are many columns as type "Fixed Decimal". When I see the data of these fixed decimal columns I see weird characters. How do I do the conversion on the server side for this type...?

Thanks in advance.

MJ
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

And this flat file is transformed and loaded to a DB2 Database (target)
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You go back to the providers of the file, and tell them that it's not an ASCII file - it contains binary fields, whereas you require EXTERNAL representations of numeric data.

Another possibility is to investigate the Iconv() function, with a second argument of "MB" or, perhaps, "MX". The former converts from binary to decimal, the latter from hexadecimal to decimal.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You might want to post some of these 'weird characters'. You might be seeing zoned decimal or something of that ilk.

Best answer is Ray's answer - get the provider of the file to cut you a break and build you a straight non-funky ascii file. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You may need to post the definition of the file you are receiving to make sure we are all on the same page. If your file truly has packed decimal fields and if they simply converted the entire record from EBCDIC to ASCII - then they have destroyed the packed fields in the process.

Packed is packed, neither ASCII nor EBCDIC in a sense, so those fields need to be 'skipped' during the conversion. If they can't manage to do that for you, then you have a couple of choices:

1) Leave everything in EBCDIC and you convert the character fields to ASCII and unpack the packed decimal fields yourself. Yuck.

2) Make them unpack the packed fields for you - external representations of the numeric data as Ray put it. Then they can convert it all to ASCII and not trash anything. ps: It is way easier for them to deliver the fields to you unpacked than it is for you to unpack them.

I push hard for what's behind Door Number 2. :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

chulett wrote:You may need to post the definition of the file you are receiving to make sure we are all on the same page. If your file truly has packed decimal fields and if they simply converted the entire record from EBCDIC to ASCII - then they have destroyed the packed fields in the process.

Packed is packed, neither ASCII nor EBCDIC in a sense, so those fields need to be 'skipped' during the conversion. If they can't manage to do that for you, then you have a couple of choices:

1) Leave everything in EBCDIC and you convert the character fields to ASCII and unpack the packed decimal fields yourself. Yuck.

2) Make them unpack the packed fields for you - external representations of the numeric data as Ray put it. Then they can convert it all to ASCII and not trash anything. ps: It is way easier for them to deliver the fields to you unpacked than it is for you to unpack them.

I push hard for what's behind Door Number 2. :wink:
Hi chulett:

What do you mean when you/ray say "external representations of the numeric data"

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

Post by chulett »

It simply means to have the packed fields unpacked. Not an 'internal' representation, but rather something 'external' or people readable.
-craig

"You can never have too many knives" -- Logan Nine Fingers
DS_MJ
Participant
Posts: 157
Joined: Wed Feb 02, 2005 10:00 am

Post by DS_MJ »

chulett wrote:It simply means to have the packed fields unpacked. Not an 'internal' representation, but rather something 'external' or people readable.
Hello chulett:

Thank you much, appreciate it. :D

Anyways, we tried to get the DATA in ASCII and had issues with Packed decimal. However, when we went with DataStage doing the conversion from ECDIC with format type Binary....the data looks good so far. Datastage does a good job of the conversion. :D

MJ
Post Reply