Decimal to COMP3

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

DSguru2B
Charter Member
Charter Member
Posts: 6854
Joined: Wed Feb 09, 2005 3:44 pm
Location: Houston, TX

Post by DSguru2B »

You can study the source code for routines like "DataTypePicS9" and do the inverse and create your own routine to achieve the same.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
pnetti
Participant
Posts: 17
Joined: Fri Jan 07, 2005 7:28 am

COMP-3

Post by pnetti »

I have to admit that I have not had much success with reversing this code. The original code hardly makes sense.

I am now using iconv with an MP coversion code to pack a number. I ftp the file to the mainframe as binary with no conversion to ebcdic.

Negative whole numbers are sucessful, but I can't pack positive numbers or decimals. Positive numbers do not include the sign bit.

Does any have any thoughts on this one??
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: COMP-3

Post by ray.wurlod »

pnetti wrote:The original code hardly makes sense.
Is that because of your unfamiliarity with the language, or do you really have a problem with the logic?

The Iconv() and Oconv() functions are perilous ground for newbies, particularly the ones that handle binary data.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
pnetti
Participant
Posts: 17
Joined: Fri Jan 07, 2005 7:28 am

COMP 3

Post by pnetti »

I am not that familiar with the language.

When I review the code of the existing routines, it doesnt seem like I can just reverse the logic.

For example, the current routines do not handle the implied decimal. The packed number is converted as a whole number then divided by a number to move the decimal point.

I dont think this approach will work in the reverse order. But as I said, I am not really that strong with the basic language.

(Not only do I need to convert to comp-3, I have to convert to signed comp fields.)
Post Reply