Skip to main content

Greetings,

I have a PIC 9(12)v99 COMP-3 variable and want to convert it to a decimal PIC 9(12)V99. I read that the true value of this comp-3 would be (12 2 1)/2 = 7,5 (8 rounded up), tried that but to no avail.

Also tried a simple move from one to another but when i write my converted file (a text file), and when i display on screen it shows me gibberish.

How do i convert this guy?

Thanks in advance.

Greetings,

I have a PIC 9(12)v99 COMP-3 variable and want to convert it to a decimal PIC 9(12)V99. I read that the true value of this comp-3 would be (12 2 1)/2 = 7,5 (8 rounded up), tried that but to no avail.

Also tried a simple move from one to another but when i write my converted file (a text file), and when i display on screen it shows me gibberish.

How do i convert this guy?

Thanks in advance.

Do you have a simple program you could post the code from?

I put together a simple program using Visual COBOL to see if I could duplicate what you are seeing.

 

When I step through the code, this is what I get:

 

 


Greetings,

I have a PIC 9(12)v99 COMP-3 variable and want to convert it to a decimal PIC 9(12)V99. I read that the true value of this comp-3 would be (12 2 1)/2 = 7,5 (8 rounded up), tried that but to no avail.

Also tried a simple move from one to another but when i write my converted file (a text file), and when i display on screen it shows me gibberish.

How do i convert this guy?

Thanks in advance.

redefine the field such as:

05 field-a   pic 9(12v99 comp-3.

05 field-b pic 9(14) comp-3  redefines field-a.

05 field-c pic 9(14).

05 field-d redefines field-c 9(12v99.

move field-b to field-c.


Greetings,

I have a PIC 9(12)v99 COMP-3 variable and want to convert it to a decimal PIC 9(12)V99. I read that the true value of this comp-3 would be (12 2 1)/2 = 7,5 (8 rounded up), tried that but to no avail.

Also tried a simple move from one to another but when i write my converted file (a text file), and when i display on screen it shows me gibberish.

How do i convert this guy?

Thanks in advance.

In the end the problem was that i was moving comp-3 from copybook to pic 9 12v99 copybook directly. I used a work var than moved to copybook and it worked perfectly.


Greetings,

I have a PIC 9(12)v99 COMP-3 variable and want to convert it to a decimal PIC 9(12)V99. I read that the true value of this comp-3 would be (12 2 1)/2 = 7,5 (8 rounded up), tried that but to no avail.

Also tried a simple move from one to another but when i write my converted file (a text file), and when i display on screen it shows me gibberish.

How do i convert this guy?

Thanks in advance.

In the end the problem was that i was moving comp-3 from copybook to pic 9 12v99 copybook directly. I used a work var than moved to copybook and it worked perfectly.