Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ 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 -> 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: 1202
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 Validate date and numeric fields and ... Rick Silvers DFSORT/ICETOOL 6 Thu May 11, 2017 6:51 pm
No new posts Converting decimal to numeric using I... Balaryan DFSORT/ICETOOL 4 Thu Feb 02, 2017 11:27 pm
This topic is locked: you cannot edit posts or make replies. How to move a long alphanumeric data ... lind sh COBOL Programming 8 Mon Dec 05, 2016 7:51 pm
No new posts Sort records based on numeric field. Alks SYNCSORT 2 Wed Oct 19, 2016 10:14 pm
No new posts Casting a Binary Number to Numeric in... Bob Steinkraus Java & MQSeries 6 Tue Aug 09, 2016 5:58 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us