Why we need to use redefine clause when we can define the
variable seperately... what is actual need....

Answer Posted / vaneesh

One more advantage of redefines is that we can use the same
value with different declarations.
For Example
lets say we receive input value as 'b123'. b is blank
and we want to display it as 01.23 in the spool. This can
be done with redefines as follows.

WORKING-STORAGE section
01 LEARNING
05 WS-RECIEVE-VAL PIC X(4).
05 WS-RECIEVE-RED REDEFINES WS-RECIEVE-VAL PIC 9(2)V
(2).

01 WS-FOR-DISPLAY PIC 9(2).9(2).

PROCEDURE DIVISION.

MOVE 'b123' TO WS-RECIEVE-VAL
MOVE WS-RECIEVE-RED TO WS-FOR-DISPLAY

DISPLAY WS-FOR-DISPLAY

STOP RUN.

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we redefine the field of x(200) to less than 200?

812


What do you understand by psb and acb?

659


Explain the configuration section of a cobol program with examples of syntax.

650


What is the LINKAGE SECTION used in COBOL?

885


Which mode is used to operate the sequential file?

658






What is the difference between binary search and sequential search?

634


What kind of error is trapped by on size error option?

733


What is the utilization of copybook in cobol?

648


Why do we code s9 (4) comp. Inspite of knowing comp-3 will occupy less space?

701


What is the difference between structured cobol programming and object alternativelyiented cobol?

746


How do you reference the fixed block file formats from cobol programs

695


In which area will you utilize 88 level items in cobol?

708


What is redefines clause in COBOL?

841


What is amode(24), amode(31), rmode(24) and rmode(any) (applicable to only mvsesa enterprise server) ?

666


Are you comfortable in cobol or jcl?

633