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

Can we move Alphanumeric data to Numeric Variable


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

New User


Joined: 18 Nov 2006
Posts: 4
Location: hyderabad

PostPosted: Wed Aug 01, 2007 11:43 am
Reply with quote

HI FRNDS,
i have 01 A PIC X(2).
01 B PIC 9(2).
MOVE 12 TO A.
MOVE A TO B.
I KNOW THAT I CAN PASS NUMERIC TO NON-NUMERIC BUT IN THIS CASE HOW CAN IT BE PASSED AS NUMERIC OR NON-NUMERIC..... I KNOW ITS BASIC ONE BUT I WANT UR HELP AS I WAS CONFUSED..... icon_rolleyes.gif

Warning: Caps Lock On
Back to top
View user's profile Send private message
murmohk1

Senior Member


Joined: 29 Jun 2006
Posts: 1436
Location: Bangalore,India

PostPosted: Wed Aug 01, 2007 12:00 pm
Reply with quote

Anil,

Please post your query in CAPS OFF mode.

Quote:
BUT IN THIS CASE HOW CAN IT BE PASSED AS NUMERIC OR NON-NUMERIC..... I KNOW ITS BASIC ONE BUT I WANT UR HELP AS I WAS CONFUSED.....

I dont know you are confused or not. But your post surely is confusing. Please post your exact requirment.

Quote:
MOVE 12 TO A.

Also let us know, is it atypoerr?
Back to top
View user's profile Send private message
saiprasadh

Active User


Joined: 20 Sep 2006
Posts: 154
Location: US

PostPosted: Wed Aug 01, 2007 12:00 pm
Reply with quote

hi anil ,

Use the below code


Code:
COMPUTE B = FUNCTION NUMVAL(A)



Thanks
Sai
Back to top
View user's profile Send private message
chtrisa

New User


Joined: 19 Dec 2006
Posts: 12
Location: chennai

PostPosted: Wed Aug 01, 2007 5:23 pm
Reply with quote

hi anil,

i think, redefine the B(numeric) field, then u can move non mumeric value to B.
Back to top
View user's profile Send private message
agkshirsagar

Active Member


Joined: 27 Feb 2007
Posts: 691
Location: Earth

PostPosted: Wed Aug 01, 2007 5:37 pm
Reply with quote

Code:
Move '12' to A

This moves literal '12' to A and your move will move 12 to A. (Check the apostrophes.)
I think you are confused in diffrentiating numeric and alphanumeric literals.
Back to top
View user's profile Send private message
balakrishna reddy

Active User


Joined: 13 Jul 2007
Posts: 128
Location: Guntur

PostPosted: Thu Aug 02, 2007 7:30 pm
Reply with quote

hi anil,

anil wrote:
Quote:

I KNOW THAT I CAN PASS NUMERIC TO NON-NUMERIC BUT IN THIS CASE HOW CAN IT BE PASSED AS NUMERIC OR NON-NUMERIC..... I KNOW ITS BASIC ONE BUT I WANT UR HELP AS I WAS CONFUSED.....


I think that you are talking about the second move whether numeric value will be moved to 'B' or alphanumeric.

you are moving '12 ' to alphanumeric first since it is in codes it will be treated as alphanumeric.

when you move A to B it will be moved fine and you can use B for any arithmetic operations as well.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Fri Aug 03, 2007 12:20 am
Reply with quote

Hello,

You might want to look at these similar topics:
http://ibmmainframes.com/viewtopic.php?t=22367
http://ibmmainframes.com/viewtopic.php?t=21201
http://ibmmainframes.com/viewtopic.php?t=18093

If you "search" using the link near the top of the page, you will find several more topics.

If after reading them you have any questions, please post what you read that is unclear and your question about it and we will provide more answers.
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 Store the data for fixed length COBOL Programming 1
No new posts Extracting Variable decimal numbers f... DFSORT/ICETOOL 17
No new posts Data set Rec-Cnt and Byte-Cnt Testing & Performance 2
No new posts SCOPE PENDING option -check data DB2 2
Search our Forums:

Back to Top