Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist 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: 8619
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: 967
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 how can i move s9(9) to s9(9) usage comp HARENDRA CHOUDHARY COBOL Programming 3 Mon Nov 06, 2017 12:10 am
No new posts Move from Comp3 variable to Edited Va... Revathy.nair0485 COBOL Programming 7 Fri Nov 03, 2017 3:30 pm
This topic is locked: you cannot edit posts or make replies. Can a alphanumeric data be moved to a... nico_neoz COBOL Programming 10 Mon Oct 30, 2017 8:28 am
This topic is locked: you cannot edit posts or make replies. Incrementing current time field by 30... arunsoods DFSORT/ICETOOL 11 Thu Oct 26, 2017 3:22 pm
No new posts sort records based on length exceeds ... maxsubrat DFSORT/ICETOOL 7 Wed Oct 04, 2017 4:48 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us