For Programmers: Free Programming Magazines  


Home > Archive > Cobol > May 2007 > Re: Question on Cobol Move statement - mixed move x to zzz9.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Question on Cobol Move statement - mixed move x to zzz9.
HeyBub

2007-05-21, 9:55 pm

Michael Schey wrote:
> 18 year cobol veteran here. Stumped trying to come up with a
> technical explanation on this one. I know why this is happening but I
> can't explain it to the higher ups because I can't explain it to
> myself.
>
> 05 WS-PROP-PREMISE PIC X(04).
>
>
> 05 WS-FORMAT-4 PIC ZZZ9.
>
>
> WS-PROP-PREMISE has a value of 3. That is 3 followed by 3 spaces.
>
> The code MOVE WS-PROP-PREMISE to WS-FORMAT-4 results in
>
> 3000
>
> Why?
>
> When the sending field has 0003 we get 3 in the result. This is what
> we are expecting from the sending system. Now they are 'sometimes'
> sending us a 3 followed by 3 spaces, which gives us the 3000 in the
> result field.


One way to explain it:

In the original (asume ASCII), you have 33303030. The move routine
(evidently) moves only the right-most nibbles, x3x0x0x0 ==> 3000 and is
indifferent to the left-most nibbles


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com