Portal | Manuals | References | Downloads | Info | Programs | JCLs | Mainframe wiki | Quick Ref
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Profile Log in to check your private messages Log in
 
Is this RENAMES code valid?

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
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    Post subject: Is this RENAMES code valid?
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: 8593
Location: Back in jolly old England

PostPosted: Mon Jan 04, 2010 5:08 pm    Post subject:
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    Post subject:
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: 8152
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jan 04, 2010 5:57 pm    Post subject:
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    Post subject:
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    Post subject:
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: 8152
Location: East Dubuque, Illinois, USA

PostPosted: Mon Jan 04, 2010 6:29 pm    Post subject:
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    Post subject:
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    IBMMAINFRAMES.com Support Forums -> COBOL Programming All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
This topic is locked: you cannot edit posts or make replies. how to code for GDG in Rexx cvnlynn CLIST & REXX 13 Wed Aug 09, 2017 9:13 pm
This topic is locked: you cannot edit posts or make replies. rexx code to create a ps file Bharath Vikraman CLIST & REXX 4 Mon Aug 07, 2017 10:30 am
No new posts I want to retire TRX and use only Rex... Abhinav Sharma CLIST & REXX 6 Sat Jul 29, 2017 2:53 am
No new posts UNIT=AFF for Easytrieve code gandikk JCL & VSAM 7 Wed Jul 12, 2017 11:42 pm
No new posts DB2 Program abending without giving a... rahulgarg14 DB2 7 Mon May 29, 2017 8:10 pm

Facebook
Back to Top
 
Job Vacancies | Forum Rules | Bookmarks | Subscriptions | FAQ | Polls | Contact Us