Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can we MOVE Alphanumeric field to numeric filed

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can we MOVE Alphanumeric field to numeric filed
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: 3158
Location: Tucson AZ

PostPosted: Mon Mar 12, 2007 2:23 pm    Post subject:
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    Post subject:
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: 686
Location: Earth

PostPosted: Mon Mar 12, 2007 3:04 pm    Post subject:
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

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Mon Mar 12, 2007 9:24 pm    Post subject:
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    Post subject:
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    Post subject:
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: 686
Location: Earth

PostPosted: Fri Mar 16, 2007 11:54 am    Post subject:
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: 147
Location: Columbia, MO

PostPosted: Sat Mar 17, 2007 1:08 am    Post subject: Re: Can we MOVE Alphanumeric field to numeric filed
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts READ A PACKED "NEGATIVE" FI... jdesouza CA Products 3 Tue May 02, 2017 11:43 pm
No new posts Alter &DATENS field in HEADER1 Angad DFSORT/ICETOOL 4 Mon Apr 24, 2017 11:49 am
No new posts SORT VSAM file with each field one by... maxsubrat DFSORT/ICETOOL 6 Tue Mar 14, 2017 1:07 pm
No new posts IMS DB-How to update a record (a sing... Nic Clouston IMS DB/DC 9 Thu Mar 09, 2017 4:38 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us