View previous topic :: View next topic
|
Author |
Message |
kshirabdhi
New User
Joined: 22 Nov 2007 Posts: 13 Location: Noida
|
|
|
|
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 |
|
|
expat
Global Moderator
Joined: 14 Mar 2007 Posts: 8796 Location: Welsh Wales
|
|
|
|
What happened when you tried it youself ? |
|
Back to top |
|
|
kshirabdhi
New User
Joined: 22 Nov 2007 Posts: 13 Location: Noida
|
|
|
|
I did't try it... dont have mainframe connection
I have read in a book that this code is invalid! |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
kshirabdhi
New User
Joined: 22 Nov 2007 Posts: 13 Location: Noida
|
|
|
|
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 |
|
|
kshirabdhi
New User
Joined: 22 Nov 2007 Posts: 13 Location: Noida
|
|
|
|
One more quick query .... if FIELD-2 is an elementary item, will it give compilation error? |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8700 Location: Dubuque, Iowa, USA
|
|
|
|
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 |
|
|
kshirabdhi
New User
Joined: 22 Nov 2007 Posts: 13 Location: Noida
|
|
|
|
Thanks Robert. |
|
Back to top |
|
|
|