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

Answers were Sorted based on User's Feedback



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

Answer / nag(igate)

whenever declaring the file structure , the same storage
for the different records are redefined without againg
defining the same records, we used the redefined clause

Is This Answer Correct ?    5 Yes 0 No

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

Answer / kannan

The main use of redefines to reduce the memory allocation
for the temporary variables that is declared in WS section.
if two variables are declared in a program and if there is a
situation that the program wil use only one among that two
variables during execution depending on a condition then
redefines can be used. so that both the variable use the
same memory space and it reduces the unnecessary memory
allocation

Is This Answer Correct ?    5 Yes 0 No

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

Answer / 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

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

Answer / adarsh

redefines is used to reduce the memory usage.using redefines we can allocate the same memory to different variables.

Is This Answer Correct ?    3 Yes 0 No

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

Answer / ashok

yes when ever we face two type of records in the file in
that we use this redefines i will expline that best example
o1 salse-record
05 salse-re
o2 qua pic x(04).
o2 unit-pric pic x(08).
05 amount redefine salse-re pic x(12).

in this eaither we get qandity and price or amount
nobothar about it .

Is This Answer Correct ?    2 Yes 0 No

Post New Answer

More COBOL Interview Questions

INREC AND OUTREC? HOW TO SPLIT 5K RECORDS TO DIFFERENT FILES IN A FILE IN COBOL? RESTART IN COBOL-DB2? ISOLATION LEVELS?

0 Answers  


When is a scope terminator mandatory?

3 Answers  


)what is retrieve?

1 Answers   IBM,


I HAVE FOLLOWING DECLARATION. 02. A PIC X(10) VALUE 'XXXXXXXXXX'. 02. B REDEFINES A. 05. C PIC X(3). 05. D PIC X(3). 05. E PIC 9(3). IN MY PROG, I HAVE MOVE 1 TO E. DISPLAY A. WHAT WILL BE DISPLAYED AS A RESULT OF THIS? PLEASE EXPLAIN THE ANSWER. THANKS.

7 Answers   Amdocs,


What is the meaning of 'TALLING' verb in cobol?

5 Answers  






How do you fetch current date in normal cobol pgm and in cobol-db2 pgm?

3 Answers   Cap Gemini, CTS,


What are ISOLATION LEVELS? Where do we need to specify them?

3 Answers   EXL,


What is an in line PERFORM? When would you use it? Anything else to say about it?

4 Answers  


Minimum how many Number of Paragraphs are there in ID- Divison?

7 Answers   IBM,


Hi , I am posting some questons which are asked at interview. These may help u for ur interview... what is static and dynamic call?

2 Answers   TCS,


2 input fles: 2 flat files, with different number of records. both are having unique key for each record and already sorted in ascending order . match these files using unique key and in output only matching key value has to be written. please procide cobol logic

0 Answers  


01 text-data pic x(100). move 'xyzdbfrjjg u' to text-data. how to find the value of last index of text-data?

3 Answers   Mind Tree,


Categories