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

data move to s9(4) comp


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

Active User


Joined: 06 Sep 2007
Posts: 112
Location: India

PostPosted: Wed Sep 22, 2010 9:12 am
Reply with quote

Could somebody help me out with the following query as i don't have access to mainframes to test it by myself.

Is the following correct .

Move X'001' to WS-A .
WS-A is defined in working storage with picture clause S9(4) comp.

Thanks
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: Wed Sep 22, 2010 9:45 am
Reply with quote

Hello,

At the top of the page is a link to "IBM Manuals". Among them are the COBOL Language Reference for current compiler releases.

Suggest you read all about elementary moves.
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Wed Sep 22, 2010 5:47 pm
Reply with quote

Ambili S wrote:
Could somebody help me out with the following query as i don't have access to mainframes to test it by myself.

Is the following correct .

Move X'001' to WS-A .
WS-A is defined in working storage with picture clause S9(4) comp.

Thanks


X'001' is 1 and 1/2 bytes and is not a valid value for a hex literal.
Back to top
View user's profile Send private message
Ambili S

Active User


Joined: 06 Sep 2007
Posts: 112
Location: India

PostPosted: Tue Sep 28, 2010 11:44 am
Reply with quote

Hi Craq ,

Then the below statement is valid ?

MOVE X'0001' to WS-A , where WS-A is defined with S9(4) comp .
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Tue Sep 28, 2010 1:57 pm
Reply with quote

Ambili S wrote:
Hi Craq ,

Then the below statement is valid ?

MOVE X'0001' to WS-A , where WS-A is defined with S9(4) comp .


That statement will not get past syntax check, as the literal x'0001' is not compatible with the binary integer type of the comp field.
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: Tue Sep 28, 2010 9:54 pm
Reply with quote

Hello,

One should move numeric only values to fields that are defined as numeric.

If you simply must use x'0001', redefine the 9(4) comp field as pic xx and move the x'0001' to the pic xx field.
Back to top
View user's profile Send private message
Ambili S

Active User


Joined: 06 Sep 2007
Posts: 112
Location: India

PostPosted: Wed Sep 29, 2010 10:21 am
Reply with quote

Hi Dick

What i meant was can HEX values be used directly in move statememtns to comp fields ?
Back to top
View user's profile Send private message
Kjeld

Active User


Joined: 15 Dec 2009
Posts: 365
Location: Denmark

PostPosted: Wed Sep 29, 2010 12:48 pm
Reply with quote

Ambili S wrote:
Hi Dick

What i meant was can HEX values be used directly in move statememtns to comp fields ?

I have just answered you above that you will get a compiler error message if you move a literal x'0001' to a comp field.
Back to top
View user's profile Send private message
ridgewalker58

New User


Joined: 26 Sep 2008
Posts: 51
Location: New York

PostPosted: Thu Sep 30, 2010 12:30 am
Reply with quote

Couldn't you just move a numeric 1 to WS-A ????

01 WS-A PIC S9(04) COMP.

MOVE 01 TO WS-A.

???
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 Store the data for fixed length COBOL Programming 1
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
No new posts Check data with Exception Table DB2 0
No new posts JCL EXEC PARM data in C Java & MQSeries 2
Search our Forums:

Back to Top