IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

DIFF B/W REDEFINES AND RENAMES ?


IBM Mainframe Forums -> COBOL Programming
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
malla

New User


Joined: 16 Nov 2005
Posts: 15

PostPosted: Thu Jan 12, 2006 10:11 am
Reply with quote

What r the major differences between REDEFINES AND RENAMES

:)
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Thu Jan 12, 2006 11:51 am
Reply with quote

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
View user's profile Send private message
ofer71

Global Moderator


Joined: 27 Dec 2005
Posts: 2358
Location: Israel

PostPosted: Thu Jan 12, 2006 1:58 pm
Reply with quote

I think you can clearly see the differnce between REDEFINES and RENAMES from the fine manual.

O.
Back to top
View user's profile Send private message
malla

New User


Joined: 16 Nov 2005
Posts: 15

PostPosted: Thu Jan 12, 2006 4:45 pm
Reply with quote

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
View user's profile Send private message
prashantshinde

New User


Joined: 25 Nov 2005
Posts: 49
Location: Pune

PostPosted: Thu Jan 12, 2006 5:13 pm
Reply with quote

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
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Thu Jan 12, 2006 5:53 pm
Reply with quote

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
View user's profile Send private message
dhanunjayperakam

New User


Joined: 12 Jan 2006
Posts: 1
Location: hyd

PostPosted: Fri Jan 13, 2006 9:07 am
Reply with quote

Hi Iknow and prashantshinde,


thanks alot guys. I got a clear picture now.

icon_smile.gif
Back to top
View user's profile Send private message
malla

New User


Joined: 16 Nov 2005
Posts: 15

PostPosted: Fri Jan 13, 2006 9:15 am
Reply with quote

thanks for the detailed explanation. Nice to see guys like u spending some time to help us.

thanks again.
icon_smile.gif
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 411
Location: Colarado, US

PostPosted: Fri Jan 13, 2006 6:02 pm
Reply with quote

Hi,

Helping others is forums goal. I am a part of it.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> COBOL Programming

 


Similar Topics
Topic Forum Replies
No new posts Sort on different fields, removing du... SYNCSORT 8
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
No new posts How syntax check at Bind time is diff... DB2 5
No new posts Another redefines in COBOL COBOL Programming 1
No new posts Compare PD Values with same storage &... JCL & VSAM 5
Search our Forums:

Back to Top