View previous topic :: View next topic
|
Author |
Message |
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
Hi,
I guess i miss something in the below issue and here goes the problem,there is a zero coming in the last digit of the move from 9(10) to 9(10).Not sure how it comes?
This is the COBOL declaration
Code: |
05 WS-BULKCPY-SUBMITTED-AMT1 PIC 9(10) VALUE ZEROS.
05 BULKCPY-SUBMITTED-AMT1 PIC 9(10) VALUE ZEROS. |
This is the programming code
Code: |
DISPLAY 'QUEUE SUB AMT : ' , WS-BULKCPY-SUBMITTED-AMT1
INITIALIZE BULKCPY-SUBMITTED-AMT1
DISPLAY 'SUB AMT-BM:' , BULKCPY-SUBMITTED-AMT1
MOVE WS-BULKCPY-SUBMITTED-AMT1 TO
BULKCPY-SUBMITTED-AMT1
DISPLAY 'SUB AMT:' , BULKCPY-SUBMITTED-AMT1 |
Output is
Code: |
QUEUE SUB AMT : 100
SUB AMT-BM:0000000000
SUB AMT:100 0 |
HEX ON Ouptut is
Code: |
QUEUE SUB AMT : 100
DECEC4EEC4CDE474FFF444444444444444444444
84545024201430A01000000000000000000000000
SUB AMT-BM:0000000000
EEC4CDE6CD7FFFFFFFFFF
2420143024A0000000000
SUB AMT:100 0
EEC4CDE7FFF444444F44444
2420143A100000000000000 |
|
|
Back to top |
|
|
Succor
New User
Joined: 20 Feb 2009 Posts: 96 Location: Bangalore :)
|
|
|
|
Muthuvel,
Any idea why
Code: |
DISPLAY 'QUEUE SUB AMT : ' , WS-BULKCPY-SUBMITTED-AMT1 |
is displayed as
Code: |
QUEUE SUB AMT : 100 |
and not as
Code: |
QUEUE SUB AMT : 000000100 |
Secondly, did you try expediting the code and moving 100 to BULKCPY-SUBMITTED-AMT1 field and displaying the same.
Not sure if this will actually help you ..just trying to open few doors.
WTF |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
muthuvel wrote: |
there is a zero coming in the last digit of the move from 9(10) to 9(10).Not sure how it comes? |
Since the receiving field has no sign specified, COBOL is setting the half byte to a 'F', insuring a positive sign. |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
The input file to this has the number as 100 in 9(10) with right justified data and i tried previously to move 100 directly and the output that occured was
Code: |
QUEUE SUB AMT : 100
SUB AMT-BM:0000000000
SUB AMT:0000000100 |
My understanding is ,when you move from a variable A to variable B provided both are of same data type and same type ,the move is similar to copy.Am I right? |
|
Back to top |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
|
|
muthuvel wrote: |
My understanding is ,when you move from a variable A to variable B provided both are of same data type and same type ,the move is similar to copy.Am I right? |
Half way.....
Packed decimal is always ZAPed (zero and add packed), but display character and numeric is MVCed (moved). |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
As you've defined the code, there's no reason for the behavior that you're seeing. I ran a test with using Enterprise COBOL 3.4 of:
Code: |
01 WS-VARIABLES.
05 WS-BULKCPY-SUBMITTED-AMT1 PIC 9(10) VALUE ZEROS.
05 BULKCPY-SUBMITTED-AMT1 PIC 9(10) VALUE ZEROS.
PROCEDURE DIVISION.
S1000-MAIN SECTION.
MOVE 100 TO WS-BULKCPY-SUBMITTED-AMT1.
DISPLAY 'QUEUE SUB AMT : ' WS-BULKCPY-SUBMITTED-AMT1.
INITIALIZE BULKCPY-SUBMITTED-AMT1.
DISPLAY 'SUB AMT-BM:' BULKCPY-SUBMITTED-AMT1.
MOVE WS-BULKCPY-SUBMITTED-AMT1 TO
BULKCPY-SUBMITTED-AMT1.
DISPLAY 'SUB AMT:' BULKCPY-SUBMITTED-AMT1.
|
and got results of
Code: |
QUEUE SUB AMT : 0000000100
SUB AMT-BM:0000000000
SUB AMT:0000000100 |
Either the variables aren't defined as you have them, or the code isn't as you have it. The behavior you posted is what I would expect if the sending variable was defined as X(03) or possibly X(10), not 9(10). |
|
Back to top |
|
|
CICS Guy
Senior Member
Joined: 18 Jul 2007 Posts: 2146 Location: At my coffee table
|
|
|
|
Robert wrote: |
As you've defined the code, there's no reason for the behavior that you're seeing. |
Not quite, since the OP has shown that WS-BULKCPY-SUBMITTED-AMT1 contains:
Code: |
100
FFF4444444
1000000000 |
Which perfectly explains this behavior..... |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
You're right, CICS Guy -- so I think the question becomes, why that value in WS-BULKCPY-SUBMITTED-AMT1? |
|
Back to top |
|
|
muthuvel
Active User
Joined: 29 Nov 2005 Posts: 217 Location: Canada
|
|
|
|
As Rob and CICS guy said,though the input passed was numbers it was passed as right justified to my input part (making it to be alphanumeric format) , which caused the problem.
When I received it in alphanumeric format X(10) and moved to 9(10) ,it got solved.
Thanks Folks !!! |
|
Back to top |
|
|
|