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

What is the use of Renames clause


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

New User


Joined: 12 Dec 2004
Posts: 22

PostPosted: Thu Dec 16, 2004 10:56 am
Reply with quote

hi all

can anyone explain me what is the use of renames clause.


regards
purushoth
Back to top
View user's profile Send private message
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 211
Location: Keane Inc., Minneapolis USA.

PostPosted: Thu Dec 16, 2004 12:51 pm
Reply with quote

Hi,

RENAMES in cobol is used to declare a new data item in terms of an existing data item. The level number should be 66.

Eg: 01 MY-REC.
02 X PIC 9(3).
02 Y PIC X(10).
02 Z PIC X(20).
I want to declare a U-REC with same structure as MY-REC then

66 U-REC RENAMES MY-REC.
This is equilant to declaring U-REC with same structure of MY-REC.

If you want to declare U-REC with a part of MY-REC then u can declare it as...

66 U-REC RENAMES X THROUGH Y.
It means your record will contain only X,Y sub data items.


Bye,
Reddy.
Back to top
View user's profile Send private message
muthukumarapandian

New User


Joined: 08 Oct 2004
Posts: 42
Location: chennai, india

PostPosted: Tue Mar 01, 2005 6:21 pm
Reply with quote

Hi reddy,

It is not possible to use renames in level numbers other than 02 to 49.
Back to top
View user's profile Send private message
anuradha

Active User


Joined: 06 Jan 2004
Posts: 247
Location: Hyderabad

PostPosted: Wed Mar 02, 2005 11:04 am
Reply with quote

Hi muthukumarapandian

Quote:
It is not possible to use renames in level numbers other than 02 to 49.


I couldn't get you what you are saying? Do you mean to say we can use renames only with level numbers 02-49.

Renames should be used only with level number 66.
Back to top
View user's profile Send private message
muthukumarapandian

New User


Joined: 08 Oct 2004
Posts: 42
Location: chennai, india

PostPosted: Wed Mar 02, 2005 6:35 pm
Reply with quote

Hi ,

I am telling that u can rename the elements declared in 02 to 49 level.
Back to top
View user's profile Send private message
mcmillan

Site Admin


Joined: 18 May 2003
Posts: 1210
Location: India

PostPosted: Fri Mar 04, 2005 1:13 am
Reply with quote

But the question is: "What's the use of Renames Clause"

The uses of RENAMES Clause:

1. To create a new group from one or more existing groups
2. To create an alias name

But the main purpose of RENAMES Clause, it can be used in DISPLAY statement effectively.

For example, assume that I have a group with 5 subjects. I want to display the second, third and forth subjects only.

Code:

01 MARKS.
 02 MARK1 PIC 99.
 02 MARK2 PIC 99.
 02 MARK3 PIC 99.
 02 MARK4 PIC 99.
 02 MARK5 PIC 99.

So I have to use DISPLAY M2, M3, M4. (if NO renames)

With RENAMES, I can do this like:

66 SUBMARKS RENAMES MARK2 THRU MARK4.

Now I can say: DISPLAY SUBMARKS.
    (Assume the efficiency if you have 100 fields in that group)
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 To search DB2 table based on Conditio... DB2 1
No new posts NOT IN clause in COBOL pgm COBOL Programming 8
No new posts SUSBSCRIPT WITH SIGN IN PIC CLAUSE COBOL Programming 3
No new posts usage of CASE in WHERE clause DB2 10
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
Search our Forums:

Back to Top