MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

cobol-redefines clause

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
keshav
Beginner


Joined: 08 Dec 2004
Posts: 3
Topics: 2

PostPosted: Tue Dec 28, 2004 6:40 am    Post subject: cobol-redefines clause Reply with quote

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
View user's profile Send private message
dtf
Beginner


Joined: 10 Dec 2004
Posts: 110
Topics: 8
Location: Colorado USA

PostPosted: Tue Dec 28, 2004 9:16 am    Post subject: Reply with quote

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
View user's profile Send private message
Fin
Beginner


Joined: 19 Jan 2004
Posts: 27
Topics: 8

PostPosted: Mon Mar 21, 2005 9:58 am    Post subject: Reply with quote

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
View user's profile Send private message
kolusu
Site Admin
Site Admin


Joined: 26 Nov 2002
Posts: 12378
Topics: 75
Location: San Jose

PostPosted: Mon Mar 21, 2005 10:18 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Fin
Beginner


Joined: 19 Jan 2004
Posts: 27
Topics: 8

PostPosted: Mon Mar 21, 2005 10:24 am    Post subject: Reply with quote

Thank you Kolusu.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group