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
 
REDEFINES Alphanumeric to Numeric

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    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

priya

Moderator


Joined: 24 Jul 2003
Posts: 568
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: 42
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

New User


Joined: 02 Jan 2004
Posts: 52
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: 568
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: 42
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: 1200
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: 1592

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
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 File Aid tool to compare numeric data balaji81_k Compuware & Other Tools 2 Tue Sep 26, 2017 3:35 am
No new posts Remove leading spaces from numeric field rexx77 SYNCSORT 6 Wed Sep 06, 2017 2:15 am
No new posts Return a Non Numeric value from REXX Learncoholic CLIST & REXX 3 Fri Sep 01, 2017 8:33 pm
No new posts Select numeric portion from CHAR data... balaji81_k DB2 6 Sat Aug 19, 2017 1:51 am
No new posts Validate if a Value from the file is ... balacsv2 COBOL Programming 8 Mon Jun 19, 2017 11:52 pm

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