needful- redefines

This is a Mainframe COBOL forum - you can post your queries on Mainframe COBOL, VS COBOL II, COBOL/370 , Enterprise COBOL

Moderators: dbzTHEdinosauer, Moderator Group

Post Reply
samayamsasi
Member
Posts: 2
Joined: Wed Oct 18, 2006 10:08 am

needful- redefines

Post by samayamsasi » Tue Nov 07, 2006 10:49 am

Hi All,
Please clarify below questions, one intereviewer asked me

1. can i use redefining and redefined vaiables(ex: both are numeric) in one operation(ex: arthimatic) ?

2. if
01 A PIC X(10)
01 B REDEFINES A PICX(20)

how will B gets 20 bytes storage, actually A has 10 bytes only ?

this is my second question here, i didn't get the answer, i am expecting answer for this question

Thanks & Regards
SamayamSasi

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Tue Nov 07, 2006 4:23 pm

2. you can't. the compiler will flag the redefine as an error.

suggest that you RTFM.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Kgumraj
Member
Posts: 4
Joined: Thu Nov 16, 2006 8:45 pm
Location: Hyderabad

RE:needful- redefines

Post by Kgumraj » Thu Nov 16, 2006 9:23 pm

Hello,

Redefine can be given a higher value. It is built for one of this resons only. Internally there are memory that is allocated but not used this memory is used if it redefines a higher value. It doen't give compiler or runtime error. But it is not a better pratise to do the same.
With Love
Kiran G R

User avatar
Leo
Member
Posts: 13
Joined: Tue Nov 14, 2006 12:02 pm
Location: HYBD

Post by Leo » Fri Nov 17, 2006 3:48 pm

hi

i agree with what dick has pointed out , a compile error will be thrown with the message " B redefined a smaller item"

Thanks
Leo

User avatar
Leo
Member
Posts: 13
Joined: Tue Nov 14, 2006 12:02 pm
Location: HYBD

Post by Leo » Fri Nov 17, 2006 3:53 pm

1 . Yes u can

User avatar
dbzTHEdinosauer
Moderator
Posts: 981
Joined: Mon Oct 02, 2006 8:31 pm

Post by dbzTHEdinosauer » Fri Nov 17, 2006 4:09 pm

There are differences between redefining a 01 level and redefining a level greater than 01. 01's will bound on mod8, levels greater than 01 will bound at next available without the syncronized clause.

the followning link http://mvshelp.net/vbforums/showthread.php?t=23215 is an interesting discussion of redefining.
Dick Brenholtz
JCL, SQL and code in programs have an irritating habit of doing what you say,
not what you meant.

Post Reply

FREE TUTORIALS

Tutorials
Free tutorials from mainframegurukul
  • JCL Tutorial
    Covers all important JCL concepts.
  • Cobol Tutorial
    This tutorials covers all Cobol Topics from STRING to COMP-3.
  • DB2 Tutorial
    DB2 Tutorial focuses on DB2 COBOL Programming.
  • SORT Tutorial
    This Tutorial covers all important aspects of DFSORT with examples
  • CICS Tutorial
    This CICS tutorial covers CICS concepts and CICS Basics, CICS COBOL Programming.
Interview
Mainframe Interview questions



Other References
Mainframe Tools and others