View previous topic :: View next topic
|
Author |
Message |
s ismail
New User
Joined: 09 Mar 2007 Posts: 1 Location: Mysore
|
|
|
|
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 |
|
|
William Thompson
Global Moderator
Joined: 18 Nov 2006 Posts: 3156 Location: Tucson AZ
|
|
Back to top |
|
|
zensa
New User
Joined: 21 Feb 2007 Posts: 10 Location: India
|
|
|
|
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 |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
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. |
|
Back to top |
|
|
dick scherrer
Moderator Emeritus
Joined: 23 Nov 2006 Posts: 19244 Location: Inside the Matrix
|
|
|
|
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 |
|
|
Suryanarayana.tadala
New User
Joined: 03 Nov 2005 Posts: 43 Location: St.Louis
|
|
|
|
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 |
|
|
rakesh.in.in
New User
Joined: 01 Mar 2007 Posts: 5 Location: Pune
|
|
|
|
You Can't move alphanumeric/non-numeric to numeric.
When u r trying to do this there must be SOC7 Abend |
|
Back to top |
|
|
agkshirsagar
Active Member
Joined: 27 Feb 2007 Posts: 691 Location: Earth
|
|
|
|
Rakesh,
There won't be S0C7 for MOVE. (Check that yourself )
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 |
|
|
socker_dad
Active User
Joined: 05 Dec 2006 Posts: 177 Location: Seattle, WA
|
|
|
|
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 |
|
|
|