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

Is this RENAMES code valid?


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

New User


Joined: 22 Nov 2007
Posts: 13
Location: Noida

PostPosted: Mon Jan 04, 2010 5:05 pm
Reply with quote

Is this RENAMES code valid?

01 RECORD-3.
05 FIELD-1.
10 FIELD11 PIC X(5).
10 FIELD12 PIC X(5).
05 FIELD-2.

66 RECORD-4 RENAMES FIELD12 THRU FIELD-2.
Back to top
View user's profile Send private message
expat

Global Moderator


Joined: 14 Mar 2007
Posts: 8796
Location: Welsh Wales

PostPosted: Mon Jan 04, 2010 5:08 pm
Reply with quote

What happened when you tried it youself ?
Back to top
View user's profile Send private message
kshirabdhi

New User


Joined: 22 Nov 2007
Posts: 13
Location: Noida

PostPosted: Mon Jan 04, 2010 5:10 pm
Reply with quote

I did't try it... dont have mainframe connection icon_sad.gif

I have read in a book that this code is invalid!
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 04, 2010 5:57 pm
Reply with quote

As you've coded it, compilation fails. However, it fails because you don't have an elementary item under FIELD-2 group item (and since FIELD-2 does not have a picture clause, it must be a group item). Once you define an elementary variable under FIELD-2, the code compiles just fine and executes under Enterprise COBOL. The issue is NOT the RENAMES but the FIELD-2 definition.
Back to top
View user's profile Send private message
kshirabdhi

New User


Joined: 22 Nov 2007
Posts: 13
Location: Noida

PostPosted: Mon Jan 04, 2010 6:12 pm
Reply with quote

I forgot to write the PIC clause for FIELD-2.

Thank you Robert. I wanted to confirm if the code works fine.
Back to top
View user's profile Send private message
kshirabdhi

New User


Joined: 22 Nov 2007
Posts: 13
Location: Noida

PostPosted: Mon Jan 04, 2010 6:14 pm
Reply with quote

One more quick query .... if FIELD-2 is an elementary item, will it give compilation error?
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8700
Location: Dubuque, Iowa, USA

PostPosted: Mon Jan 04, 2010 6:29 pm
Reply with quote

Quote:
One more quick query .... if FIELD-2 is an elementary item, will it give compilation error?
Nope -- FIELD-2 PIC X(10) compiles just fine.
Back to top
View user's profile Send private message
kshirabdhi

New User


Joined: 22 Nov 2007
Posts: 13
Location: Noida

PostPosted: Mon Jan 04, 2010 6:35 pm
Reply with quote

Thanks Robert.
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 run rexx code with jcl CLIST & REXX 15
No new posts Compile rexx code with jcl CLIST & REXX 6
No new posts REXX code to expand copybook in a cob... CLIST & REXX 2
No new posts VSAM return code 23 - for a Random read COBOL Programming 4
No new posts Monitoring production job progress. N... JCL & VSAM 4
Search our Forums:

Back to Top