View previous topic :: View next topic
|
Author |
Message |
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Craq Giegerich
Senior Member
Joined: 19 May 2007 Posts: 1512 Location: Virginia, USA
|
|
|
|
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 |
|
|
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
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 |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
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 |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Ambili S
Active User
Joined: 06 Sep 2007 Posts: 112 Location: India
|
|
|
|
Hi Dick
What i meant was can HEX values be used directly in move statememtns to comp fields ? |
|
Back to top |
|
|
Kjeld
Active User
Joined: 15 Dec 2009 Posts: 365 Location: Denmark
|
|
|
|
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 |
|
|
ridgewalker58
New User
Joined: 26 Sep 2008 Posts: 51 Location: New York
|
|
|
|
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 |
|
|
|