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
 

 

Question about COBOL Redefines clause

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

New User


Joined: 02 Dec 2005
Posts: 5

PostPosted: Fri Dec 02, 2005 3:13 pm    Post subject: Question about COBOL Redefines clause
Reply with quote

Hi

Which one is correct ?

01 IN-RECORD.
03 A PIC S9(8)V9(2) COMP-3.
03 B REDEFINES A .
05 C PIC 9(5).
05 D PIC 9(5).

01 A PIC S9(8)V9(2) COMP-3.
01 B REDEFINES A .
05 C PIC 9(5).
05 D PIC 9(5).
Back to top
View user's profile Send private message

priyesh.agrawal

Senior Member


Joined: 28 Mar 2005
Posts: 1452
Location: Chicago, IL

PostPosted: Fri Dec 02, 2005 4:12 pm    Post subject: Re: redefine question
Reply with quote

The REDEFINES clause cannot be used in a level 01 entry in the File Section.

Regards,

Priyesh.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Fri Dec 02, 2005 4:37 pm    Post subject: Re: redefine question
Reply with quote

Hi draviki

Priyesh you are right. So for your query option one is correct.

More information on REDEFINES

Allows the same area of memory to be referenced by more than one data-name with different format and sizes.

Multiple 01 levels of same FD are Implicitly Redefined

Restrictions on REDEFINES
    OCCURS and REDEFINES cannot be combined
    Qualification of data-name-2 not required
    Value Clauses only in Condition Names
    Redefinition Ceases Whenever a Level No is <= that of data-name-1 or data-name-2 is encountered
    The Size of Data-name-1 must be Less than or equal to Data-name-2
    Data item lengths and types can also be respecified within an area


Hope this helps.
Back to top
View user's profile Send private message
akashs

New User


Joined: 24 Nov 2005
Posts: 49
Location: chennai

PostPosted: Fri Dec 02, 2005 5:24 pm    Post subject: Re: redefine question
Reply with quote

hi,

Multiple 01 levels of same FD are Implicitly Redefined ?....plz explain me this one..

regards,
akashs
Back to top
View user's profile Send private message
mmwife

Super Moderator


Joined: 30 May 2003
Posts: 1592

PostPosted: Sun Dec 04, 2005 3:49 am    Post subject:
Reply with quote

He means that if you define more than 1 01 level in an FD they all define the same space that the rec was read into.

This means that you can use any dataname of any 01 level to reference the various offsets in the FD rec.

This is usually done where you have multiple rec types in a file. Each 01 would be used to access a different rec type.
Back to top
View user's profile Send private message
iknow

Active User


Joined: 22 Aug 2005
Posts: 413
Location: Colarado, US

PostPosted: Sun Dec 04, 2005 11:05 am    Post subject: Re: redefine question
Reply with quote

Hi mmwife,


That was a wonderful expalnation. Thanks for your valuable information.
Back to top
View user's profile Send private message
mk_kumar315

New User


Joined: 21 Nov 2005
Posts: 10

PostPosted: Mon Dec 05, 2005 12:41 pm    Post subject:
Reply with quote

Hi priyesh and iknow,

As for as my Knowledge, what i learnt is:

We can REDEFINE an element of 01 level,if both are at the same level and both should have the same data type.

And also REDEFINES can be used with OCCURS clause if REDEFINES is sub-ordinate to the OCCURS clause.

If Iam WRONG, Please Let Me Know.

M.K.Kumar.
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
This topic is locked: you cannot edit posts or make replies. Full Time COBOL Software Development ... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:24 am
This topic is locked: you cannot edit posts or make replies. COBOL Software Development Lead at Fi... shally Mainframe Jobs 0 Fri Jan 20, 2017 5:21 am
No new posts Executing OO COBOL program invoking J... Virendra Shambharkar COBOL Programming 2 Tue Jan 10, 2017 6:37 pm
No new posts OO COBOL compile error Virendra Shambharkar COBOL Programming 3 Tue Jan 10, 2017 6:05 pm
No new posts Need Suggestion on COBOL program vickey_dw COBOL Programming 5 Thu Jan 05, 2017 10:55 pm


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