View previous topic :: View next topic
|
Author |
Message |
malla
New User
Joined: 16 Nov 2005 Posts: 15
|
|
|
|
What r the major differences between REDEFINES AND RENAMES
:) |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi malla,
Please search the forum before you post your queries.
The topic has already been discussed.
Please stick to the forum rules. |
|
Back to top |
|
|
ofer71
Global Moderator
Joined: 27 Dec 2005 Posts: 2358 Location: Israel
|
|
|
|
I think you can clearly see the differnce between REDEFINES and RENAMES from the fine manual.
O. |
|
Back to top |
|
|
malla
New User
Joined: 16 Nov 2005 Posts: 15
|
|
|
|
iknow wrote: |
Hi malla,
Please search the forum before you post your queries.
The topic has already been discussed.
Please stick to the forum rules |
u r name itself says that u know. but i was not aware. Still i searched the forum, i didn't get a clear picture. therefore i posted.
:wink:
ofer71 wrote: |
I think you can clearly see the differnce between REDEFINES and RENAMES from the fine manual.
O. |
thanks.. ofer71
:) |
|
Back to top |
|
|
prashantshinde
New User
Joined: 25 Nov 2005 Posts: 49 Location: Pune
|
|
|
|
rename is used to rename or regroups the previously defined data items.
whereas redefines is used to redefines the data item.
01 rty.
05 a pic a(10).
05 b redefines a pic a(10).
in this redefines both data items will share same memory space.
regard.
manjinder........ |
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi malla,
Check the information below.
The RENAMES clause does not use any extra space within the program as all it is doing is supplying a replacement name for use in a data definition attached to the program via a COPY statement. This allows the same code to be copied multiple times and given different names. All of this is resolved by the compiler and does not affect the size of the resultant program.
The REDEFINES clause is used to provide a different data definition for the same data area. In this instance both of the names supplied are accessible to be used in the PROCEDURE DIVISION. As such the code generated by the compiler may be different depending on which of the names that is used.
NOTE
Additional information on REDEFINES
Restrictions on REDEFINES
[list=]OCCURS and REDEFINES cannot be combined
Qualification of data-name-2 not required
Value Clauses only in Condition Names
Redefinition Ceases Whenever a Level No is <= that of data-name-1 or data-name-2 is encountered
The Size of Data-name-1 must be Less than or equal to Data-name-2
Data item lengths and types can also be respecified within an area [/list]
REDEFINES Examples:
Quote: |
05 NAME-2.
10 SALARY PICTURE XXX.
10 SO-SEC-NO PICTURE X(9).
10 MONTH PICTURE XX.
05 NAME-1 REDEFINES NAME-2.
10 WAGE PICTURE 999V999.
10 EMP-NO PICTURE X(6).
10 YEAR PICTURE XX. |
When an area is redefined, all descriptions of the area are always in effect. That is, redefinition does not cause any data to be erased and never supersedes a previous description.
Thus, if B REDEFINES C has been specified, either of the two procedural statements, MOVE X TO B and MOVE Y TO C, could be executed at any point in the program.
Hope this helps. |
|
Back to top |
|
|
dhanunjayperakam
New User
Joined: 12 Jan 2006 Posts: 1 Location: hyd
|
|
|
|
Hi Iknow and prashantshinde,
thanks alot guys. I got a clear picture now.
|
|
Back to top |
|
|
malla
New User
Joined: 16 Nov 2005 Posts: 15
|
|
|
|
thanks for the detailed explanation. Nice to see guys like u spending some time to help us.
thanks again.
|
|
Back to top |
|
|
iknow
Active User
Joined: 22 Aug 2005 Posts: 411 Location: Colarado, US
|
|
|
|
Hi,
Helping others is forums goal. I am a part of it. |
|
Back to top |
|
|
|