Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

data move to s9(4) comp

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: data move to s9(4) comp
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

Site Director


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

PostPosted: Wed Sep 22, 2010 9:45 am    Post subject:
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    Post subject: Re: data move to s9(4) comp
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    Post subject:
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    Post subject:
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

Site Director


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

PostPosted: Tue Sep 28, 2010 9:54 pm    Post subject:
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    Post subject:
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    Post subject:
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    Post subject: Couldn't you just do a numeric move
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Paasing symbolic parameter to instrea... Anirudh Anand JCL & VSAM 1 Thu Jul 27, 2017 1:22 pm
No new posts Passing data from REXX to C programme... chong.zhou CLIST & REXX 3 Wed Jul 26, 2017 9:11 pm
No new posts copying data without knowing location arunsoods DFSORT/ICETOOL 11 Thu Jul 20, 2017 1:03 pm
This topic is locked: you cannot edit posts or make replies. Fetching data from BAI File arunsoods JCL & VSAM 1 Wed Jul 19, 2017 4:28 pm
No new posts Loading data to table gives wrong for... Raghu navaikulam DB2 19 Thu Jul 13, 2017 2:11 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us