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
 
Usage of redefines clause

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> COBOL Programming
View previous topic :: :: View next topic  
Author Message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 147
Location: Coimbatore

PostPosted: Tue Oct 27, 2009 11:57 am    Post subject: Usage of redefines clause
Reply with quote

How do we use REDEFINE for a group variable which is having arrays in it?

01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES DEPENDING ON X.
05 TEMP-2 OCCURS 1 TO 100 TIMES DEPENDING ON Y.
How to use it in file section?. Also kindly let me know if we can redefine a 01 level variable.
Back to top
View user's profile Send private message

k.junaid83

New User


Joined: 19 Apr 2006
Posts: 22
Location: bangalore

PostPosted: Tue Oct 27, 2009 1:58 pm    Post subject:
Reply with quote

Yes we can redefine a variable which is having an OCCURS clause, however Neither data item can contain an OCCURS DEPENDING ON clause.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Tue Oct 27, 2009 3:01 pm    Post subject:
Reply with quote

Hi Abdul,

Adding on to Junaid's post...

A note from the REDEFINES topic available in the Manuals
Code:
The data description entry for the redefined item cannot contain an OCCURS clause. However, the redefined item can be subordinate to an item whose data description entry contains an OCCURS clause. In this case, the reference to the redefined item in the REDEFINES clause must not be subscripted. Neither the redefined item nor the redefining item, or any items subordinate to them, can contain an OCCURS DEPENDING ON clause.


Quote:
How to use it in file section?. Also kindly let me know if we can redefine a 01 level variable.

In case of files... its not necessary to give REDEFINES. Just Define two 01 levels under the file and it should be fine.
Back to top
View user's profile Send private message
abdulrafi

Active User


Joined: 14 Sep 2009
Posts: 147
Location: Coimbatore

PostPosted: Wed Oct 28, 2009 10:37 am    Post subject: Reply to: Usage of redefines clause
Reply with quote

Hi Binop,

So as per your statement "the redefining item or the redefined item must not contain depending on clause", the code which I have given seems to be incorrect as it has a depending clause.

The below code is incorrect.
01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES DEPENDING ON X.
05 TEMP-2 OCCURS 1 TO 100 TIMES DEPENDING ON Y.

The below code is correct.
01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES.
05 TEMP-2 OCCURS 1 TO 100 TIMES.


I think usage of Indexed wont have any problem like the one mentioned below,
01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES INDEXED BY X.
05 TEMP-2 OCCURS 1 TO 100 TIMES INDEXED BY Y.


Please let me know if my understanding is correct and if anyting is wrong correct me?.
Back to top
View user's profile Send private message
Binop B

Active User


Joined: 18 Jun 2009
Posts: 407
Location: Nashville, TN

PostPosted: Wed Oct 28, 2009 10:44 am    Post subject:
Reply with quote

Hi Abdul,

Quote:
So as per your statement "the redefining item or the redefined item must not contain depending on clause", the code which I have given seems to be incorrect as it has a depending clause.

I dare say this as my statement... icon_rolleyes.gif as mentioned its a line picked out from the manuals...

Quote:
Please let me know if my understanding is correct and if anyting is wrong correct me?.
With all due respect.. suggest you to have a look into the manuals... That should be the first task... If you are still unclear... please post here again.. and surely someone will be able to help you...
Back to top
View user's profile Send private message
Robert Sample

Global Moderator


Joined: 06 Jun 2008
Posts: 8165
Location: East Dubuque, Illinois, USA

PostPosted: Wed Oct 28, 2009 5:07 pm    Post subject:
Reply with quote

Quote:
The below code is incorrect.
01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES DEPENDING ON X.
05 TEMP-2 OCCURS 1 TO 100 TIMES DEPENDING ON Y.

The below code is correct.
01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES.
05 TEMP-2 OCCURS 1 TO 100 TIMES.


I think usage of Indexed wont have any problem like the one mentioned below,
01 A PIC X(100)
01 B REDEFINES A.
05 TEMP-1 OCCURS 0 TO 10 TIMES INDEXED BY X.
05 TEMP-2 OCCURS 1 TO 100 TIMES INDEXED BY Y.


Please let me know if my understanding is correct and if anyting is wrong correct me?.
None of these will compile since your TEMP-1 and TEMP-2 variables have no picture clauses associated with them, nor do you have a period after the X(100) for A -- syntax errors.

Even after fixing the syntax errors, you will find that none of these examples will compile:
Code:
            01  A2                          PIC X(100).
            01  B2                          REDEFINES A2.

                05  TEMP-12                 OCCURS 0 TO 10 TIMES

IGYDS1262-E A minimum occurrence integer was specified for table "TEMP-12" witho
            the "DEPENDING ON" phrase.  The minimum occurrence integer was disca

                                            INDEXED BY X2
                                            PIC X(01).
                05  TEMP-22                 OCCURS 1 TO 100 TIMES
IBM Enterprise COBOL for z/OS  3.4.1               MF0103    Date 10/28/2009  Ti
 SL  ----+-*A-1-B--+----2----+----3----+----4----+----5----+----6----+----7-|--+

IGYDS1262-E A minimum occurrence integer was specified for table "TEMP-22" witho
            the "DEPENDING ON" phrase.  The minimum occurrence integer was disca

                                            INDEXED BY Y2
                                            PIC X(01).
The correct statement to make is that a REDEFINES that has an OCCURS clause must only have the number of occurrences (which can total less than the size of the redefined variable), period. It explicitly cannot be an OCCURS DEPENDING ON nor can it implicitly be an OCCURS DEPENDING ON by having a range of occurrences.
Back to top
View user's profile Send private message
dick scherrer

Site Director


Joined: 23 Nov 2006
Posts: 19270
Location: Inside the Matrix

PostPosted: Wed Oct 28, 2009 8:14 pm    Post subject:
Reply with quote

Hello,

Quote:
How do we use REDEFINE for a group variable which is having arrays in it?
If you post some of the actual data it may help.

It may also help if you explain how this data was created. . .
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
No new posts )SEL and )ENDSEL usage cvnlynn TSO/ISPF 4 Thu Jun 15, 2017 1:15 am
No new posts Need inputs on Space requirement and... ashek15 IMS DB/DC 0 Sat Apr 01, 2017 8:26 am
No new posts Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts How can amount of the Storage Usage b... esduman61 CICS 6 Wed Mar 09, 2016 1:19 pm
No new posts Controlling usage of resources by tasks raja1128 CICS 3 Fri Nov 06, 2015 9:53 am

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