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

Can we MOVE Alphanumeric field to numeric filed


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

New User


Joined: 09 Mar 2007
Posts: 1
Location: Mysore

PostPosted: Mon Mar 12, 2007 2:09 pm
Reply with quote

I just want to know whether we can move Alphanumeric feild to numeric field.

I had moved a alphanumeric value 'sunrise' declared as x(8) to numeric field declared as 9(6) . Is this valid move..........

Please let me know ........
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3156
Location: Tucson AZ

PostPosted: Mon Mar 12, 2007 2:23 pm
Reply with quote

No, that move is not valid. Look at Table 44. Valid and invalid elementary moves
Back to top
View user's profile Send private message
zensa

New User


Joined: 21 Feb 2007
Posts: 10
Location: India

PostPosted: Mon Mar 12, 2007 3:00 pm
Reply with quote

Yes we can move Alphanumeric to Numeric & the Vice versa. But when

the same data items are used in an arithmetic operations,

compilation error will occur at the time of compilation.The thing is we

cannot move Alphabetic to numeric & the viceversa.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Mon Mar 12, 2007 3:04 pm
Reply with quote

Yes.
Cobol allows to move Alphanumeric variables to numeric variables.
Alphabetic to numeric move is not alllowed.

However if you move the data as mentioned in your question, you may encounter S0c7 when you do arithmatic or use that var in conditional expression. icon_smile.gif
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: Mon Mar 12, 2007 9:24 pm
Reply with quote

Hello,

While many things arepossible, there are some we should just not do.

Do notmove aplha fields to numeric fields. Even if your code compiles successfully and you manage to run some tests successfully, there is a highprobablilty that there will be an abend later in production.
Back to top
View user's profile Send private message
Suryanarayana.tadala

New User


Joined: 03 Nov 2005
Posts: 43
Location: St.Louis

PostPosted: Fri Mar 16, 2007 4:24 am
Reply with quote

Hello ,
The answer would be a big NO...
Even though your code might work , I stand with Dick's comments wich are valid and you would be caught in a bizzare situation while testing in Production.

Surya
Back to top
View user's profile Send private message
rakesh.in.in

New User


Joined: 01 Mar 2007
Posts: 5
Location: Pune

PostPosted: Fri Mar 16, 2007 11:21 am
Reply with quote

You Can't move alphanumeric/non-numeric to numeric.
When u r trying to do this there must be SOC7 Abend
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Fri Mar 16, 2007 11:54 am
Reply with quote

Rakesh,
There won't be S0C7 for MOVE. (Check that yourself icon_wink.gif )
When you use that numeric field in arithmatic or conditional expression then you will get S0C7.
Read the manual to get more information.
Back to top
View user's profile Send private message
socker_dad

Active User


Joined: 05 Dec 2006
Posts: 177
Location: Seattle, WA

PostPosted: Sat Mar 17, 2007 1:08 am
Reply with quote

I had a similar problem in a large program in which I am installing a major upgrade.

The field was defined as x(10) in the old copybook, but in the new, it had been changed to a S9(5)V COMP-3. I missed this in my analysis and went testing merrily along.

Well, we use a PC-based development product called Microfocus MFE that comes fairly close to emulating the mainframe - except in this instance! MFE allowed me to move alphanumeric data to this field and use it in compares without an abend. As soon as we migrated the program to the mainframe for system testing, however, I got the the CICS version of the S0C7 - ASRA.

Oh, Calcutta!
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 Issues Converting From ZD to Signed N... DFSORT/ICETOOL 4
No new posts Replace Multiple Field values to Othe... DFSORT/ICETOOL 12
No new posts COBOL - Move S9(11)v9(7) COMP-3 to -(... COBOL Programming 5
No new posts Join 2 files according to one key field. JCL & VSAM 3
No new posts How to move the first field of each r... DFSORT/ICETOOL 5
Search our Forums:

Back to Top