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

Can we move directly comp element into alphanumeric


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

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Thu Jan 31, 2008 1:43 pm
Reply with quote

Hi All,
can we move directly comp element into alphanumeric.Thanks
i.e
pic 9(4) comp to x(15)
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jan 31, 2008 2:21 pm
Reply with quote

if the alphafield is an edit mask then the conversion will take place; otherwise the answer is no.
Back to top
View user's profile Send private message
jackal
Currently Banned

New User


Joined: 21 Jan 2006
Posts: 48
Location: india

PostPosted: Thu Jan 31, 2008 3:03 pm
Reply with quote

If No, then will it give compilation error?run time error?
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jan 31, 2008 5:38 pm
Reply with quote

????????????? you don't have access to a computer?
Back to top
View user's profile Send private message
rag swain

New User


Joined: 17 Dec 2007
Posts: 33
Location: pune,INDIA

PostPosted: Thu Jan 31, 2008 6:06 pm
Reply with quote

The move should be okay
Back to top
View user's profile Send private message
Anuj Dhawan

Superior Member


Joined: 22 Apr 2006
Posts: 6250
Location: Mumbai, India

PostPosted: Thu Jan 31, 2008 6:53 pm
Reply with quote

jackal wrote:
If No, then will it give compilation error?run time error?
Some times a little self-coding gives better answers...
Back to top
View user's profile Send private message
Phrzby Phil

Senior Member


Joined: 31 Oct 2006
Posts: 1042
Location: Richmond, Virginia

PostPosted: Thu Jan 31, 2008 6:57 pm
Reply with quote

Let's see now - a new user (above) says that the "move should be ok" (my emphasis).

Would you rather rely on this? Or, just spend one minute of your own time to test it, then you'll be the alphanumeric move guru.
Back to top
View user's profile Send private message
dbzTHEdinosauer

Global Moderator


Joined: 20 Oct 2006
Posts: 6966
Location: porcelain throne

PostPosted: Thu Jan 31, 2008 7:10 pm
Reply with quote

I spent the necessary minute to code and test a module.

moved comp, binary, & packed-decimal +50 to alpha. ok

moved comp, binary, & packed-decimal -50 to alpha. not ok, sign is not moved.

and this was cobol 2. so the conversion of the numbers will take place, but the sign will not be converted or moved.

which leads me to ask, since the conversion only half works, why do it?
Back to top
View user's profile Send private message
rag swain

New User


Joined: 17 Dec 2007
Posts: 33
Location: pune,INDIA

PostPosted: Thu Jan 31, 2008 7:52 pm
Reply with quote

I completely agree with 'Phrzby Phil' and dbzTHEdinosauer. Only this is possible when comp variable is +ve. I did not give a thought about -ve at first sight. I should have done that one minute test. icon_redface.gif

No, of course not, i don't rely on this type of move which does have any existence in APLLICATION world.

Thank You.
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 COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Call program, directly from panel CLIST & REXX 9
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
No new posts Converting ASCII values to COMP-3 (ZD... JCL & VSAM 2
No new posts Interviewers are surprised with my an... Mainframe Interview Questions 6
Search our Forums:

Back to Top