IBM Mainframe Forum Index
 
Log In
 
IBM Mainframe Forum Index Mainframe: Search IBM Mainframe Forum: FAQ Register
 

use of Redefines and Occurs Cluase


IBM Mainframe Forums -> JCL & VSAM
Post new topic   Reply to topic
View previous topic :: View next topic  
Author Message
kedianirmal

New User


Joined: 08 Feb 2008
Posts: 82
Location: Bangalore, India

PostPosted: Thu Mar 13, 2008 6:34 am
Reply with quote

hi all,

I am a new commer in mainframe having an experience of 1 year only.

I have to make a few changes in an existing program. My changes are compiling fine. But i am getting error for few other statement in the program. The statement are as follows:

01 WS-MESSAGE-TABLE.
* A00002 - 1
03 FILLER PIC X(160) VALUE
' XXXXXXXXXX TO XXXXXXXXXX '.
* A00003 - 2
03 FILLER PIC X(160) VALUE
'xxxxxxxx to xxxxxxxxxx '.
* A00004 - 3
03 FILLER PIC X(160) VALUE
'From xxxxxxxxxx to xxxxxxxxxx '.
* A00001 - 4
03 FILLER PIC X(160) VALUE
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.
* A00002 - 5
03 FILLER PIC X(160) VALUE
'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.

01 WS-MESSAGE-ARRAY REDEFINES WS-MESSAGE-TABLE.
03 WS-MSG OCCURS 5 PIC X(160).

Here the grouped data WS-MESSAGE-TABLE is redefined by WS-MESSAGE-ARRAY and the OCCURS clause is also used in the same.

According to my knowledge there should not be any OCCURS clause with redefines, but the code is running in our production but is giving error while compiling.

Please Help,
Nirmal
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 13, 2008 8:14 am
Reply with quote

You can't redefine an 01 level, other than that it is fine. Why is it in production if it is getting a compile error?
Back to top
View user's profile Send private message
Craq Giegerich

Senior Member


Joined: 19 May 2007
Posts: 1512
Location: Virginia, USA

PostPosted: Thu Mar 13, 2008 8:24 am
Reply with quote

I have to correct myself, you can redefine an 01. That's what I get for answering questions late at night.
Back to top
View user's profile Send private message
dick scherrer

Moderator Emeritus


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

PostPosted: Thu Mar 13, 2008 8:33 am
Reply with quote

Hello,

Quote:
According to my knowledge there should not be any OCCURS clause with redefines,
This knowledge is incorrect.

The bit of code you posted looks ok, but you need to post code using the "Code" tab near the top of the reply panel.

If you want help, you need to post the complete error messgae(s) given by the compile. . .
Back to top
View user's profile Send private message
r.mishra

New User


Joined: 12 Mar 2008
Posts: 4
Location: pune

PostPosted: Thu Mar 13, 2008 9:47 am
Reply with quote

in given code redefines claused is used on 01 level and ocurrs is at 03 level so i think it will work .
Back to top
View user's profile Send private message
Help-Me-Out

New User


Joined: 09 Dec 2006
Posts: 56
Location: Pune

PostPosted: Thu Mar 13, 2008 9:57 am
Reply with quote

It should not be problem with the above code.

Could you plz provide the compilation error. that helps to understand the exact cause
Back to top
View user's profile Send private message
vasanthkumarhb

Active User


Joined: 06 Sep 2007
Posts: 275
Location: Bang,iflex

PostPosted: Thu Mar 13, 2008 10:18 am
Reply with quote

Hi



Quote:
01 WS-MESSAGE-ARRAY REDEFINES WS-MESSAGE-TABLE.
03 WS-MSG OCCURS 5 PIC X(160).



01 level can be used in the WORKING-STORAGE SECTION for REDEFINES but it cannot be used in DATA DIVISION OF FD description

and also the above code is correct you are using OCCURS in 03 level and used another variable like WS-MSG which is not redefined. so it should work.

otherwise send us your compiler source listing.
Back to top
View user's profile Send private message
View previous topic :: :: View next topic  
Post new topic   Reply to topic View Bookmarks
All times are GMT + 6 Hours
Forum Index -> JCL & VSAM

 


Similar Topics
Topic Forum Replies
No new posts Updating a 1 byte thats in occurs mul... DFSORT/ICETOOL 6
No new posts Cobol redefines for Signed pictured c... COBOL Programming 4
This topic is locked: you cannot edit posts or make replies. SYMNAMES using COBDFSYM for OCCURS cl... CLIST & REXX 12
No new posts Multiple OCCURS depending on in same ... COBOL Programming 6
No new posts Another redefines in COBOL COBOL Programming 1
Search our Forums:

Back to Top