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

Can we move '123' to a PIC S9(09) COMP variable?


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

New User


Joined: 19 Sep 2006
Posts: 26

PostPosted: Fri Oct 27, 2006 5:19 pm
Reply with quote

Can we move '123' to a PIC S9(9) COMP variable?

If yes, what is the difference between
MOVE '123' TO <PIC S9(09) COMP variable> and
MOVE 123 TO <PIC S9(09) COMP variable>?
Back to top
View user's profile Send private message
shreevamsi

Active User


Joined: 23 Feb 2006
Posts: 305
Location: Hyderabad,India

PostPosted: Fri Oct 27, 2006 5:31 pm
Reply with quote

hi

You can't move '123' intp PIC S9(9).
Within quotes, if you move some value to a variable, it is expected to be a alphanumeric. In your case...your receiving variable is declared as numberic.
If
77 VAR1 PIC S9(09) COMP
then you can only
MOVE 123 TO VAR1
but not '123'

got it??

~Vamsi
Back to top
View user's profile Send private message
Yoyoyo

New User


Joined: 19 Sep 2006
Posts: 26

PostPosted: Fri Oct 27, 2006 5:42 pm
Reply with quote

Thanks shreevamsi for your reply!

But let me know if anyone else has got a different opinion.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Fri Oct 27, 2006 5:57 pm
Reply with quote

Hi There,

Its not throwing ne error when moving '123' to comp variable.
& Result is also same 000000123.
Back to top
View user's profile Send private message
Yoyoyo

New User


Joined: 19 Sep 2006
Posts: 26

PostPosted: Sat Oct 28, 2006 1:04 pm
Reply with quote

Thanks Ekta for the confirmation! :-)
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1208
Location: Bangalore,India

PostPosted: Sat Oct 28, 2006 9:47 pm
Reply with quote

Hi Yoyoyo,

Glad I could help.
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 Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Variable Output file name DFSORT/ICETOOL 8
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Moving Or setting POINTER to another ... COBOL Programming 2
Search our Forums:

Back to Top