Page 1 of 2

what happens when spaces are moved to the comp-3?

PostPosted: Thu Nov 01, 2007 10:40 am
by dhiviya
01 var a pic x(5) value spaces.
01 var b pic 9(5) comp-3

mov var a to varb.

what will be the value of var b?

Re: what happens when spaces are moved to the comp-3?

PostPosted: Thu Nov 01, 2007 3:04 pm
by CICS Guy
Since the recieving field is numeric: When the sending item is alphanumeric, the data is moved as if the sending item were described as an unsigned integer.
Kind of makes me think that the result would be zero...... But I wonder.....

Re: what happens when spaces are moved to the comp-3?

PostPosted: Sun Dec 09, 2007 4:31 pm
by kiran_ragam
THE RESULT WILL BE 5 SPACES

Re: what happens when spaces are moved to the comp-3?

PostPosted: Mon Dec 10, 2007 12:18 am
by dick scherrer
Hello,

No, it won't.

Re: what happens when spaces are moved to the comp-3?

PostPosted: Thu Dec 27, 2007 2:37 pm
by nikhilgalgate
Hi Dhiviya,

var b has five zero as 00000. If you display it you may see it in spool area practically. :ugeek:

Re: what happens when spaces are moved to the comp-3?

PostPosted: Wed Feb 06, 2008 12:32 pm
by robin.gcet
i think when space are moved to the comp-3...than it will give u soc 7 error..

Re: what happens when spaces are moved to the comp-3?

PostPosted: Wed Feb 06, 2008 4:39 pm
by William Thompson
robin.gcet wrote:i think when space are moved to the comp-3...than it will give u soc 7 error..
If you mean a system 0C7, program check, data exception, no it won't....The 'ZAP' command will not generate one.

Re: what happens when spaces are moved to the comp-3?

PostPosted: Thu Feb 21, 2008 11:35 am
by rawatdewan
it will give a soc-7 error

Re: what happens when spaces are moved to the comp-3?

PostPosted: Thu Mar 27, 2008 5:43 pm
by inbasekarmani
i tried its giving five sequence zeros for me.its not giving soc 7 error.

Re: what happens when spaces are moved to the comp-3?

PostPosted: Fri Mar 27, 2009 7:22 am
by qykong1986
I tried it on mainframe.
01 WS-CHANGE.                                       
    05 WS-CHANGE-IN1         PIC X(20) VALUE SPACE.
    05 WS-CHANGE-OUT         PIC S9(4) COMP-3.     
.....
INITIALIZE WS-CHANGE-OUT.             
MOVE WS-CHANGE-IN1 TO WS-CHANGE-OUT.   
DISPLAY 'STRING: ' WS-CHANGE-OUT 'OK'.
 

The maxcc return 4. The compiler said Alphanumeric or national sending fields 'WS-CHANGE-IN1' exceed 18 digits. The right most 18 characters were used as the sender.
But if I give compiler option ARITH(EXTEND), the maxcc=0. The result show 0000.
When i code like this WS-CHANGE-IN1 PIC X(32) VALUE SPACE, even give compiler option ARITH(EXTEND), the maxcc still return 4.