Portal | Manuals | References | Downloads | Info | Programs | JCLs | Master the Mainframes
IBM Mainframe Computers Forums Index
 
Register
 
IBM Mainframe Computers Forums Index Mainframe: Search IBM Mainframe Forum: FAQ Memberlist Usergroups Profile Log in to check your private messages Log in
 

 

Can i use redefine clause in occurs

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

New User


Joined: 15 Oct 2005
Posts: 25

PostPosted: Mon Feb 20, 2006 11:34 am    Post subject: Can i use redefine clause in occurs
Reply with quote

can i use redefine clause in occurs? if yes please explain with example?
Back to top
View user's profile Send private message

smiley
Warnings : 1

New User


Joined: 08 Feb 2006
Posts: 27

PostPosted: Mon Feb 20, 2006 11:54 am    Post subject:
Reply with quote

Quote:
can i use redefine clause in occurs? if yes please explain with example?



Yes,we can..

eg:-

Quote:
01 DATA-REC.
05 STRING-1 PIC X(04) VALUE ?TEST?.
05 TEST-REC REDEFINES STRING-1 OCCURS 12 TIMES PICXXX.
Back to top
View user's profile Send private message
smiley
Warnings : 1

New User


Joined: 08 Feb 2006
Posts: 27

PostPosted: Mon Feb 20, 2006 11:57 am    Post subject:
Reply with quote

sorry..it is like this..

Quote:
01 DATA-REC.
05 STRING-1 PIC X(100).
05 STRING-2 REDEFINES STRING-1 OCCURS 10 TIMES PIC X(10).

Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Feb 21, 2006 11:45 am    Post subject:
Reply with quote

Quote:
Hi smiley,

You gave a example of REDEFINE with occurs clause. Where as Tarun asked example of REDEFINE within OCCURS clause.



We can use REDEFINE within OCCURS clause, as shown below:

Code:
01 A.                   
  05 B1 OCCURS 10 TIMES.
    10 C1      PIC X(1).
    10 C2      PIC X(5).
    10 C3 REDEFINES C2. 
       15 D1   PIC X(2).
       15 D2   PIC X(2).
    10 C4      PIC X(5).
Back to top
View user's profile Send private message
fixdoubts

New User


Joined: 21 Oct 2005
Posts: 54

PostPosted: Tue Feb 21, 2006 11:54 am    Post subject:
Reply with quote

Hi,

Code:

01 A.                   
  05 B1 OCCURS 10 TIMES.
    10 C1      PIC X(1).
    10 C2      PIC X(5).
    10 C3 REDEFINES C2. 
       15 D1   PIC X(2).
       15 D2   PIC X(2).
    10 C4      PIC X(5).


works fine but some thing like

Code:
01 A.                   
  05 B1 OCCURS 10 TIMES.
    10 C1      PIC X(1).
    10 C2      PIC X(5).
    10 C3 REDEFINES C2. 
       15 D1   PIC X(2).
       15 D2   PIC X(2).
    10 C4      PIC X(5).
  05 B2 REDEFINES B1
 

will give error.

We cant redefine a table.
Back to top
View user's profile Send private message
small_world

New User


Joined: 22 Jul 2005
Posts: 24
Location: pune

PostPosted: Tue Feb 21, 2006 12:22 pm    Post subject: HI
Reply with quote

05 TIBECAAP-WORK-REC.
10 FILLER PIC X(22) VALUE 'AC AC '.
10 FILLER PIC X(22) VALUE 'AT AT '.
10 FILLER PIC X(22) VALUE 'MR PS '.
10 FILLER PIC X(22) VALUE 'PS PS '.

05 TIBECAAP-TAB-R REDEFINES TIBECAAP-WORK-REC.
10 TIBECAAP-ENT OCCURS 22 TIMES.
15 TIBECAAP-SRV PIC X(04).
15 TIBECAAP-SUB-SRV PIC X(04).
15 TIBECAAP-DFLT-IDC PIC X(01).


icon_wink.gif
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Feb 21, 2006 12:27 pm    Post subject:
Reply with quote

Yes you are right fixdoubts.

Thanks.
Back to top
View user's profile Send private message
umeshkmrsh

New User


Joined: 21 Sep 2005
Posts: 79
Location: India

PostPosted: Tue Feb 21, 2006 1:58 pm    Post subject: Re: HI
Reply with quote

small_world wrote:
05 TIBECAAP-WORK-REC.
10 FILLER PIC X(22) VALUE 'AC AC '.
10 FILLER PIC X(22) VALUE 'AT AT '.
10 FILLER PIC X(22) VALUE 'MR PS '.
10 FILLER PIC X(22) VALUE 'PS PS '.

05 TIBECAAP-TAB-R REDEFINES TIBECAAP-WORK-REC.
10 TIBECAAP-ENT OCCURS 22 TIMES.
15 TIBECAAP-SRV PIC X(04).
15 TIBECAAP-SUB-SRV PIC X(04).
15 TIBECAAP-DFLT-IDC PIC X(01).


icon_wink.gif


Boss this will give a compilation error.
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 Need help on SQL Dynamic WHERE Clause subratarec DB2 12 Sat Jul 16, 2016 3:11 pm
No new posts [SQL0029] INTO clause missing from em... HABBIE DB2 2 Fri Sep 04, 2015 3:54 pm
No new posts Multiple OCCURS depending on in same ... muralirajansm COBOL Programming 6 Fri Aug 21, 2015 4:23 pm
No new posts 3-D Table with nested DEPENDING ON Cl... VivekKhanna COBOL Programming 5 Sat Aug 08, 2015 11:18 pm
No new posts when=group clause: question about the... tuxama DFSORT/ICETOOL 2 Thu Mar 26, 2015 12:51 pm


Facebook
Back to Top
 
Mainframe Wiki | Forum Rules | Bookmarks | Subscriptions | FAQ | Tutorials | Contact Us