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



Support for OS/VS COBOL, VS COBOL II, COBOL for OS/390 & VM and Enterprise COBOL for z/OS

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

Postby dhiviya » Thu Nov 01, 2007 10:40 am

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?
dhiviya
 
Posts: 4
Joined: Mon Oct 29, 2007 4:57 pm
Has thanked: 0 time
Been thanked: 0 time

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

 

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

Postby CICS Guy » Thu Nov 01, 2007 3:04 pm

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.....
CICS Guy
 
Posts: 255
Joined: Wed Jun 20, 2007 4:08 am
Has thanked: 0 time
Been thanked: 0 time

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

Postby kiran_ragam » Sun Dec 09, 2007 4:31 pm

THE RESULT WILL BE 5 SPACES
kiran_ragam
 
Posts: 5
Joined: Sun Dec 09, 2007 3:27 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby dick scherrer » Mon Dec 10, 2007 12:18 am

Hello,

No, it won't.
Hope this helps,
d.sch.
User avatar
dick scherrer
Global moderator
 
Posts: 6304
Joined: Sat Jun 09, 2007 8:58 am
Has thanked: 3 times
Been thanked: 91 times

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

Postby nikhilgalgate » Thu Dec 27, 2007 2:37 pm

Hi Dhiviya,

var b has five zero as 00000. If you display it you may see it in spool area practically. :ugeek:
nikhilgalgate
 
Posts: 9
Joined: Tue Dec 25, 2007 1:12 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby robin.gcet » Wed Feb 06, 2008 12:32 pm

i think when space are moved to the comp-3...than it will give u soc 7 error..
robin.gcet
 
Posts: 1
Joined: Wed Feb 06, 2008 12:13 pm
Location: noida
Has thanked: 0 time
Been thanked: 0 time

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

Postby William Thompson » Wed Feb 06, 2008 4:39 pm

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.
William Thompson
 
Posts: 86
Joined: Sat Jun 09, 2007 4:24 am
Location: Tucson AZ
Has thanked: 0 time
Been thanked: 1 time

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

Postby rawatdewan » Thu Feb 21, 2008 11:35 am

it will give a soc-7 error
rawatdewan
 
Posts: 14
Joined: Tue Jan 15, 2008 5:28 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby inbasekarmani » Thu Mar 27, 2008 5:43 pm

i tried its giving five sequence zeros for me.its not giving soc 7 error.
inbasekarmani
 
Posts: 2
Joined: Wed Jan 09, 2008 2:41 pm
Has thanked: 0 time
Been thanked: 0 time

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

Postby qykong1986 » Fri Mar 27, 2009 7:22 am

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.
--------------------------------------------------------------------------------------------------------------
Thanks ^_^
Hubery.
qykong1986
 
Posts: 10
Joined: Thu Mar 19, 2009 11:28 am
Location: Shanghai.
Has thanked: 0 time
Been thanked: 0 time

Next

Return to IBM Cobol

 


  • Related topics
    Replies
    Views
    Last post