IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

Shell we MOVE SPACES to the COMP and COMP-3 values


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
narasridhar

New User


Joined: 12 Oct 2006
Posts: 32
Location: India

PostPosted: Thu Nov 30, 2006 6:32 pm
Reply with quote

Hi,

Shell we MOVE SPACES to the COPM and COMP-3 values.

Just for writing in a file .
Back to top
View user's profile Send private message
cobolunni

Active User


Joined: 07 Aug 2006
Posts: 127
Location: kerala,india

PostPosted: Thu Nov 30, 2006 7:01 pm
Reply with quote

It is not possible to move spaces to comp and comp3 identifiers because comp is used in the case of numeric identifiers so as to increase the speed of arithmetic operations .So since it is not possible to insert a alphabetic value to numeric we cannot move spaces to comp field
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Thu Nov 30, 2006 7:25 pm
Reply with quote

Yes, but only to a group name that the COMP and COMP3 fields contained in. The COMP value will be valid but the COMP3 filed willo not and could cause an abend.
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Thu Nov 30, 2006 7:34 pm
Reply with quote

Hi

You cant move spaces directly to a COMP or COMP-3 data item.But you can move spaces to a group-item having numeric sub-items

Thanks
Arun
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Thu Nov 30, 2006 9:09 pm
Reply with quote

Hi Nara,

As previous posters have indicated you can move SPACES to those fields. The more important ques is: should you?

Spaces in num fields can cause abends or incorrect results. If you have a good reason to do so, eval the pluses & minuses thoroughly and ask a supervisor if it's OK.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


Joined: 23 Nov 2006
Posts: 19244
Location: Inside the Matrix

PostPosted: Fri Dec 01, 2006 1:02 am
Reply with quote

Hello,

If you are trying to save some lines of code by moving spaces to a group item that includes "comp" fields, you might look into the INITIALIZE statement.

I very much agree with the previous reply - - EVERYthing that uses the file (and references those "comp" fields will abend or need code to check for valid numerics to prevent the abend.

Hope this helps. . . .

d.sch.
Back to top
View user's profile Send private message
sandip_mainframe
Warnings : 2

New User


Joined: 20 Sep 2006
Posts: 63
Location: pune

PostPosted: Fri Dec 01, 2006 10:11 am
Reply with quote

Hi,
it's not possible bscoz comp it is used for numerical fields and
we move spaces to alphabetic fields so that it is not possible.
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Dec 02, 2006 8:55 am
Reply with quote

Sandip,

One way spaces wind up in numeric fields is tha tsomeone gets the idea to clear a group field by moving spaces to it, as in the example below:
Code:

05  var-05.
    10  an-var-10     pic   x(015).
    10  pd-var-10     pic  s9(005) comp-3.

move spaces to var-05

As a result pd-var-10 will contain 3 spaces and, of course an-var-10 will contain 15 spaces.

A group move is considered an A/n move regardless of how the elementary fields are defined.
Back to top
View user's profile Send private message
vijay_bn79

New User


Joined: 20 Nov 2006
Posts: 48
Location: Hyderabad

PostPosted: Tue Dec 05, 2006 10:37 am
Reply with quote

Hi..,


We can move spaces to COMP but not to COMP-3
COMP is a binary representation of data item, we can enter any thing, it will convert that into binary format and stores init.
But COMP-3 is in Packed decimal format it is not possible to move spaces to this
Back to top
View user's profile Send private message
Arun Raj

Moderator


Joined: 17 Oct 2006
Posts: 2481
Location: @my desk

PostPosted: Tue Dec 05, 2006 11:13 am
Reply with quote

Hi Vijay

We cant move SPACE to either COMP or COMP-3.You will get severe compile error in either case.You can check it yourself.


Code:
62  IGYPA3005-S   "SPACE" and "NUM4 (BINARY INTEGER)" did not follow the  "MOVE" statement compatibility rules.  The statement was discarded.


Thanks
Arun
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts INCLUDE OMIT COND for Multiple values... DFSORT/ICETOOL 5
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts leading spaces can be removed in trai... DFSORT/ICETOOL 1
No new posts Null values are considered in Total c... DFSORT/ICETOOL 6
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
Search our Forums:

Back to Top