View previous topic :: View next topic |
Author |
Message |
keshav Beginner
Joined: 08 Dec 2004 Posts: 3 Topics: 2
|
Posted: Tue Dec 28, 2004 6:40 am Post subject: cobol-redefines clause |
|
|
can a redefined item have occurs clause and index item, but as far as i know a redefined item can not have any of the two items.But the program which iam analysing contains this code.i want to know wheather we can dot that or not ? does it relate's to the version of the cobol which we are using? |
|
Back to top |
|
 |
dtf Beginner
Joined: 10 Dec 2004 Posts: 110 Topics: 8 Location: Colorado USA
|
Posted: Tue Dec 28, 2004 9:16 am Post subject: |
|
|
Not sure exactly what you are saying, but items in redefines are indexed all the time. The classic example would be setting values for a table. Such as below:
Code: |
01 TABLE-WORK.
05 TABLE-VALUES.
10 PIC X(10) VALUE '1SUNDAY'.
10 PIC X(10) VALUE '2MONDAY'.
10 PIC X(10) VALUE '3TUESDAY'.
10 PIC X(10) VALUE '4WEDNESDAY'.
10 PIC X(10) VALUE '5THURSDAY'.
10 PIC X(10) VALUE '6FRIDAY'.
10 PIC X(10) VALUE '7SATURDAY'.
05 DAY-TABLE REDEFINES TABLE-VALUES OCCURS 7 INDEXED BY D-IDX.
10 DAY-CODE PIC 9.
10 DAY-LITERAL PIC X(9). |
________
medical marijuana news
Last edited by dtf on Tue Feb 01, 2011 1:37 pm; edited 1 time in total |
|
Back to top |
|
 |
Fin Beginner
Joined: 19 Jan 2004 Posts: 27 Topics: 8
|
Posted: Mon Mar 21, 2005 9:58 am Post subject: |
|
|
In a program I am maintaining there is code like this:
01 WS-TABLE.
05 TABLE-INFO.
10 FILLER PIC X(80) VALUE
'01FIRST '.
10 FILLER PIC X(80) VALUE
'02SECOND '.
....and there are 81 'filler' items like this, then
05 WS-HEADERS REDEFINES TABLE-INFO.
10 RPT-TITLES OCCURS 80 TIMES INDEXED BY INDX1.
15 HEADER-TITLE PIC 9(04).
15 HEADER-INFO PIC X(76).
I am confused as to why the 'redfines' occur 80 times, when there are 81 filler entries in the table? Are we losing the 81st filler item? |
|
Back to top |
|
 |
kolusu Site Admin

Joined: 26 Nov 2002 Posts: 12378 Topics: 75 Location: San Jose
|
Posted: Mon Mar 21, 2005 10:18 am Post subject: |
|
|
Quote: |
I am confused as to why the 'redfines' occur 80 times, when there are 81 filler entries in the table? Are we losing the 81st filler item?
|
Fin,
Yes you are loosing the 81st filler item. You can always redefine a Large item . WS-HEADERS redefined a larger item.
WS-TABLE occupies 6480 bytes (81 * 80 = 6480) where as WS-HEADERS only occupies 6400 bytes.
So correct your program to pick the 81st occurance.
Hope this helps...
Cheers
kolusu _________________ Kolusu
www.linkedin.com/in/kolusu |
|
Back to top |
|
 |
Fin Beginner
Joined: 19 Jan 2004 Posts: 27 Topics: 8
|
Posted: Mon Mar 21, 2005 10:24 am Post subject: |
|
|
Thank you Kolusu. |
|
Back to top |
|
 |
|
|