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
 

 

Need the syntax of Redefines with Occurs

 
Post new topic   Reply to topic    IBMMAINFRAMES.com Support Forums -> Mainframe Interview Questions
View previous topic :: :: View next topic  
Author Message
harkar
Warnings : 2

New User


Joined: 11 Nov 2006
Posts: 7
Location: Chennai

PostPosted: Thu Feb 15, 2007 12:01 pm    Post subject: Need the syntax of Redefines with Occurs
Reply with quote

Hi everybody,

Can any one send me the syntax for REDEFINES WITH OCCURS.

I appriciate your quick response.

Thanks in Advance
Harkar
Back to top
View user's profile Send private message

guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Feb 15, 2007 12:05 pm    Post subject:
Reply with quote

Hi there,

Please see the below example

Code:
01  NameTable.
    02 TableValues.
       03 FILLER        PIC X(18) VALUE "Dublin   Belfast  ".
       03 FILLER        PIC X(18) VALUE "Cork     Galway   ".
       03 FILLER        PIC X(18) VALUE "Sligo    Waterford".
       03 FILLER        PIC X(9)  VALUE "Limerick".
    02 FILLER REDEFINES TableValues.
       03 CityName     PIC X(9) OCCURS 7 TIMES.
Back to top
View user's profile Send private message
padma_prakasam

New User


Joined: 06 Oct 2005
Posts: 31

PostPosted: Thu Feb 15, 2007 12:31 pm    Post subject:
Reply with quote

I have a doubt, Is that the redefined value (here 9 x 7 =63) should necessarily equals the original (in case of this example - REDEFINES with OCCURS)? Can i have something like this under this redefines - CITYNAME PIC X(10) OCCURS 8 TIMES which exceeds 63.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Feb 15, 2007 12:35 pm    Post subject:
Reply with quote

Hi Padma,

Ya u can have but then the field will be populated accordingly...
first city name will contain 'Dublin B"
Second will contain 'elfast Co'

like wise ...

Hope it is clear
Back to top
View user's profile Send private message
padma_prakasam

New User


Joined: 06 Oct 2005
Posts: 31

PostPosted: Thu Feb 15, 2007 12:46 pm    Post subject:
Reply with quote

Thank you
Back to top
View user's profile Send private message
William Thompson

Global Moderator


Joined: 18 Nov 2006
Posts: 3158
Location: Tucson AZ

PostPosted: Thu Feb 15, 2007 2:26 pm    Post subject:
Reply with quote

padma_prakasam wrote:
I have a doubt, Is that the redefined value (here 9 x 7 =63) should necessarily equals the original (in case of this example - REDEFINES with OCCURS)? Can i have something like this under this redefines - CITYNAME PIC X(10) OCCURS 8 TIMES which exceeds 63.
The area being redefined SHOULD be equal to or larger than the redefine. Your occurs is always defined with a maximum size.
In the above case, COBOL will either flag it as bad error and not compile or flag it as a warning and allow it while reserving enough area for the 10 * 8.
Back to top
View user's profile Send private message
guptae

Moderator


Joined: 14 Oct 2005
Posts: 1187
Location: Bangalore,India

PostPosted: Thu Feb 15, 2007 2:46 pm    Post subject:
Reply with quote

Hi There,

Bill is correct As per ANSI-85 standards, we can redefine to higer range, only if both variables are declared in 01 level.

Bill :Thanks for correcting me
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 -> Mainframe Interview Questions All times are GMT + 6 Hours
Page 1 of 1

 

Search our Forum:

Similar Topics
Topic Author Forum Replies Posted
No new posts Syntax for running batch history repo... polymathtarun CA Products 1 Tue Jun 21, 2016 1:51 pm
No new posts Syntax to check the first 4 digits of... kshirabdhi DFSORT/ICETOOL 10 Tue May 03, 2016 12:21 pm
No new posts Syntax to create new tableBASE library Sumeendar IBM Tools 1 Tue Sep 15, 2015 6:25 pm
No new posts Illegal symbol syntax error HABBIE DB2 5 Wed Aug 26, 2015 5:58 pm
No new posts Multiple OCCURS depending on in same ... muralirajansm COBOL Programming 6 Fri Aug 21, 2015 4:23 pm


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