View previous topic :: View next topic
|
Author |
Message |
saugata
New User
Joined: 18 Feb 2005 Posts: 1
|
|
|
|
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 |
|
|
priya
Moderator
Joined: 24 Jul 2003 Posts: 568 Location: Bangalore
|
|
|
|
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 |
|
|
muthukumarapandian
New User
Joined: 08 Oct 2004 Posts: 42 Location: chennai, india
|
|
|
|
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 |
|
|
therasith
New User
Joined: 02 Jan 2004 Posts: 52 Location: chennai
|
|
|
|
the output is display ab.according to cobol 85. |
|
Back to top |
|
|
priya
Moderator
Joined: 24 Jul 2003 Posts: 568 Location: Bangalore
|
|
|
|
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 |
|
|
muthukumarapandian
New User
Joined: 08 Oct 2004 Posts: 42 Location: chennai, india
|
|
|
|
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 |
|
|
gvt460
New User
Joined: 04 Mar 2005 Posts: 23
|
|
|
|
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 |
|
|
mcmillan
Site Admin
Joined: 18 May 2003 Posts: 1210 Location: India
|
|
|
|
Quote: |
if we initialize any value to B |
We cannot use VALUE clause with B. (Its' redefined) |
|
Back to top |
|
|
mmwife
Super Moderator
Joined: 30 May 2003 Posts: 1592
|
|
|
|
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 |
|
|
|