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

Can we move an alphanumeric field to numeric


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

New User


Joined: 24 Jul 2006
Posts: 99
Location: Los Angeles

PostPosted: Thu May 24, 2007 2:40 pm
Reply with quote

Hi All,

Can we move an alphanumeric field to numeric. If Yes, why is it possible ?

If no why not ?

Also is the other way round possible.

Thanks
-Neelesh
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 24, 2007 3:28 pm
Reply with quote

These are rules imposed by COBOL about what is possible and what is not , you can not ask "why" for each thing.
BTW. Alphanumeric to Numeric integer movement is possible.
You have to take care so that it does not give you S0C7 while doing an arithmetic operation.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8797
Location: Welsh Wales

PostPosted: Thu May 24, 2007 3:53 pm
Reply with quote

Why not try it out and see what happens.
Back to top
View user's profile Send private message
look123

New User


Joined: 20 Apr 2007
Posts: 9
Location: pune

PostPosted: Thu May 24, 2007 5:19 pm
Reply with quote

It is not possible.You will be get soc7 error.

01 a pic x(6) value 123awe.

01 b oic 9 (6).

Procedure division.

move a to b.

display b.

You will be get soc7 error.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 24, 2007 5:23 pm
Reply with quote

Quote:
It is not possible.You will be get soc7 error.

Suresh,
Don' you think you have two contradictory statements here. icon_smile.gif
Regarding S0C7, I give you 101% gurantee, above program will not abend with S0C7. icon_cool.gif
Back to top
View user's profile Send private message
look123

New User


Joined: 20 Apr 2007
Posts: 9
Location: pune

PostPosted: Thu May 24, 2007 5:24 pm
Reply with quote

Small correction

It is not possible.You will be get soc7 error.

01 a pic x(6) value 123awe.

01 b pic 9 (6).

01 c pic x(6).

Procedure division.

move a to b.

comput c = a+ b.

display c.

You will be get soc7 error.
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 May 24, 2007 5:40 pm
Reply with quote

The question was moving an alpha field (a COBOL question), not an alpha value (a more fundamental question).

Of course, expat's answer is the correct one - for such a simple question, any good student who really wants to learn and remember the answer will perform the suitable variety of tests.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Thu May 24, 2007 5:42 pm
Reply with quote

Quote:
comput c = a+ b

Are you sure that this statement will compile..
Test your program this time before posting.
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