Portal | IBM Manuals | Downloads | Products | Refer | Info | Programs | JCLs | Forum Rules*| Site Map | Mainframe CD 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index
 
Register
 
IBMMAINFRAMES.com - IBM Mainframe Support Forums Index FAQ Search Memberlist Usergroups Profile Log in to check your private messages Log in
 
what is the use of renames clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL
Author Message
purushoth_jp

New User


Joined: 12 Dec 2004
Posts: 22

PostPosted: Thu Dec 16, 2004 10:56 am    Post subject: what is the use of renames clause
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
References
ovreddy

Active User


Joined: 06 Dec 2004
Posts: 200
Location: Keane India Ltd., Hyderabad

PostPosted: Thu Dec 16, 2004 12:51 pm    Post subject: Here is your answer...
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.

I Think its clear for you. For more information on renames u can visit http://www.helsinki.fi/atk/unix/dec_manuals/cobv27ua/cobrm_014.htm

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

New User


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

PostPosted: Tue Mar 01, 2005 6:21 pm    Post subject: regarding renames
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

Global Moderator


Joined: 06 Jan 2004
Posts: 257

PostPosted: Wed Mar 02, 2005 11:04 am    Post subject:
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: 44
Location: chennai, india

PostPosted: Wed Mar 02, 2005 6:35 pm    Post subject:
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: 932
Location: India

PostPosted: Fri Mar 04, 2005 1:13 am    Post subject: Re
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
Display posts from previous:   
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe COBOL All times are GMT + 6 Hours
Page 1 of 1