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 an alphanumeric field to numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Can we move an alphanumeric field to numeric
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: 686
Location: Earth

PostPosted: Thu May 24, 2007 3:28 pm    Post subject:
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: 8593
Location: Back in jolly old England

PostPosted: Thu May 24, 2007 3:53 pm    Post subject:
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    Post subject: Re: Can we move an alphanumeric field to numeric
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: 686
Location: Earth

PostPosted: Thu May 24, 2007 5:23 pm    Post subject:
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    Post subject: Re: Can we move an alphanumeric field to numeric
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

Active Member


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

PostPosted: Thu May 24, 2007 5:40 pm    Post subject:
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: 686
Location: Earth

PostPosted: Thu May 24, 2007 5:42 pm    Post subject:
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    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 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
No new posts outrec field outside range Danielle.Filteau SYNCSORT 10 Sat Mar 04, 2017 2:37 am
No new posts 2 byte YEAR from Y'DATE2' field tecnokrat DFSORT/ICETOOL 2 Tue Feb 07, 2017 12:05 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm


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