Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
REDEFINES Alphanumeric to Numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
saugata

New User


Joined: 18 Feb 2005
Posts: 1

PostPosted: Fri Feb 18, 2005 10:59 am    Post subject: REDEFINES Alphanumeric to Numeric
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
References
priya

Moderator


Joined: 24 Jul 2003
Posts: 624
Location: Bangalore

PostPosted: Fri Feb 18, 2005 5:03 pm    Post subject: Re
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: 44
Location: chennai, india

PostPosted: Sat Feb 26, 2005 7:46 pm    Post subject:
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

Active User


Joined: 02 Jan 2004
Posts: 88
Location: chennai

PostPosted: Sat Feb 26, 2005 8:13 pm    Post subject: Result according to cobol 85
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: 624
Location: Bangalore

PostPosted: Sun Feb 27, 2005 1:46 am    Post subject: Re
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: 44
Location: chennai, india

PostPosted: Sun Feb 27, 2005 1:37 pm    Post subject: About data type of group item.
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    Post subject:
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: 923
Location: India

PostPosted: Fri Mar 04, 2005 7:10 pm    Post subject: Re
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: 1508

PostPosted: Sat Mar 05, 2005 8:49 pm    Post subject:
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1