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

REDEFINES Alphanumeric to Numeric


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

New User


Joined: 18 Feb 2005
Posts: 1

PostPosted: Fri Feb 18, 2005 10:59 am
Reply with quote

I have a code as such :

WORKING-STORAGE SECTION
01 A pic x(2).
01 B redefines A pic 9(2).

PROCEDURE DIVISION.
PARA-1.
Move 'ab' to A.
Display B.

What will be output ?
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Fri Feb 18, 2005 5:03 pm
Reply with quote

Ha ha ha, You will get undefined results.


MOVE <alphabetic> to <NUMERIC> is ILLEGAL in ANSI 85 Standards.

Depending on the compiler, you will get unrecognized result.
Back to top
View user's profile Send private message
muthukumarapandian

New User


Joined: 08 Oct 2004
Posts: 42
Location: chennai, india

PostPosted: Sat Feb 26, 2005 7:46 pm
Reply with quote

Hi saugata,

the result will be ab why because ur datas acts like alphanumeric even if u declared that one as a numeric.
Back to top
View user's profile Send private message
therasith

New User


Joined: 02 Jan 2004
Posts: 52
Location: chennai

PostPosted: Sat Feb 26, 2005 8:13 pm
Reply with quote

the output is display ab.according to cobol 85.
Back to top
View user's profile Send private message
priya

Moderator


Joined: 24 Jul 2003
Posts: 568
Location: Bangalore

PostPosted: Sun Feb 27, 2005 1:46 am
Reply with quote

Oh,

Sorry Friends, I didn't notice the declaration of 'ab' (Alphanumeric!).

If it's alphanumeric you will get 'ab'. If it's alphabetic, you will get error!

Am I right?
Back to top
View user's profile Send private message
muthukumarapandian

New User


Joined: 08 Oct 2004
Posts: 42
Location: chennai, india

PostPosted: Sun Feb 27, 2005 1:37 pm
Reply with quote

Hi priya,

In redefines or any other thing if ur using any group means ur group data type becomes alphanumeric even if ur group items declared as numeric.
Back to top
View user's profile Send private message
gvt460

New User


Joined: 04 Mar 2005
Posts: 23

PostPosted: Fri Mar 04, 2005 6:42 pm
Reply with quote

in this example we are not initializing any value to b.so we will get the out put as ab.if we initialize any value to B at that time display a&b will get b value only
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Fri Mar 04, 2005 7:10 pm
Reply with quote

Quote:
if we initialize any value to B


We cannot use VALUE clause with B. (Its' redefined)
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sat Mar 05, 2005 8:49 pm
Reply with quote

These are NOT group items, they're elementary items. Elementary items are defined by the presence of a PIC clause, NOT their LEVEL number (01).
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 Convert HEX to Numeric DB2 3
No new posts Find a record count/numeric is multip... COBOL Programming 1
No new posts Handling the numeric data in unstring... COBOL Programming 18
No new posts convert alphanumeric PIC X(02) to hex... COBOL Programming 3
Search our Forums:

Back to Top