|
View previous topic :: View next topic
|
| Author |
Message |
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
Hi,
Will following code cause any errors or issues?
10 WS-OL-MO-BENE-AMT PIC 9(5)V99.
10 BF-OL-MO-BENE-AMT PIC S9(5)V99 COMP-3.
MOVE BF-OL-MO-BENE-AMT TO WS-OL-MO-BENE-AMT |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
It's OK but only if the the sending field is positive.
If it is negative, the sign will be lost. |
|
| Back to top |
|
 |
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
I am getting junk values in resultant field WS-OL-MO-BENE-AMT. any idea why?
Also if i want to include sign field then how should i define resultant field. |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| sauraso wrote: |
| I am getting junk values in resultant field WS-OL-MO-BENE-AMT. any idea why? |
My guess would be that there is garbage in BF-OL-MO-BENE-AMT.....
The UNPK will unpack garbage without an exception...
| Quote: |
| Also if i want to include sign field then how should i define resultant field. |
10 WS-OL-MO-BENE-AMT PIC S9(5)V99. |
|
| Back to top |
|
 |
Bill O'Boyle
CICS Moderator

Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
Make sure your COMP-3 data is valid so that it unpacks correctly.
After the move (unpack) of valid data to the receiving field, the high-order nibble (4-Bit) of the last byte will equal X'C' or X'D' (positive and negative, respectively).
The low-order nibble will contain a X'0' through a X'4'.
You will never find a X'D0' (IE: Negative Zero), just a X'C0' in the last byte.
Bill |
|
| Back to top |
|
 |
sauraso Warnings : 1 New User
Joined: 27 Feb 2010 Posts: 16 Location: usa
|
|
|
|
Is there any particular method to make sure comp-3 field is converted properly into numeric field.
Thanks Bill and CICS guy for responce. |
|
| Back to top |
|
 |
CICS Guy
Senior Member

Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
| sauraso wrote: |
| Is there any particular method to make sure comp-3 field is converted properly into numeric field. |
A COBOL move from numeric to numeric will always convert correctly.
Bad sending data can cause the recieving data to appear as garbage or a S0C7. |
|
| Back to top |
|
 |
dick scherrer
Moderator Emeritus

Joined: 23 Nov 2006 Posts: 19243 Location: Inside the Matrix
|
|
|
|
Hello,
Suggest you identify/resolve how you have an "input" (i.e. sending field) comp-3 field that does not contain valid numerics. . .
Whatever causes this should be corrected. |
|
| Back to top |
|
 |
Bill O'Boyle
CICS Moderator

Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
| Bill O'Boyle wrote: |
The low-order nibble will contain a X'0' through a X'4'. |
Oops, I must have been looking the other way while typing.
The correct value ranges are X'0' through X'9'.
Bill |
|
| Back to top |
|
 |
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
| Bill O'Boyle wrote: |
Oops, I must have been looking the other way while typing.  |
Thanks, I was really wondering what I was missing.....  |
|
| Back to top |
|
 |
Kjeld
Active User

Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
| Bill O'Boyle wrote: |
Make sure your COMP-3 data is valid so that it unpacks correctly.
After the move (unpack) of valid data to the receiving field, the high-order nibble (4-Bit) of the last byte will equal X'C' or X'D' (positive and negative, respectively).
The low-order nibble will contain a X'0' through a X'9'.
You will never find a X'D0' (IE: Negative Zero), just a X'C0' in the last byte.
|
(The typo was corrected in above quote).
As the WS-OL-MO-BENE-AMT was unsigned numeric I would expect the high order nibble to be x'F' in all bytes. It is only in signed fields you have the above signed values in the last byte. |
|
| Back to top |
|
 |
Bill O'Boyle
CICS Moderator

Joined: 14 Jan 2008 Posts: 2501 Location: Atlanta, Georgia, USA
|
|
|
|
I guess yesterday was "Head up my A$$ day"? The receiving field was unsigned display-numeric and the high order nibble will always be X'F'. Perhaps it was wishful thinking on my part?
Bill |
|
| Back to top |
|
 |
Kjeld
Active User

Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
It's Ok Bill, I am sure no harm done. Hope your head is in it's right place today
I think our topic poster have left us to investigate were his junk input came from... |
|
| Back to top |
|
 |
|
|