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

What is the Purpose of POINTER Phrase in STRING command in COBOL?

0 Answers   Winsol Solutions,


A paragraph PARA-X is to be executed when none of the data names A, B and C have value of 1. Which of the following will achieve this ? (a) IF A NOT = 1 OR B NOT = 1 OR C NOT = 1 PERFORM PARA-X (B) IF NOT A= 1 AND B= 1 AND C = 1 PERFORM PARA-X (C) IF A NOT =1 IF NOT B = 1 OR C= 1 PERFORM PARA-X (C) IF A NOT = 1 AND B NOT = 1 AND C NOT = 1 PERFORM PARA-X

3 Answers   TCS,


how many bytes do SPPPP999 will store?

18 Answers  


What is the mode in which you will OPEN a file for writing?

4 Answers  


Can you REWRITE a record in an ESDS file? Can you DELETE a record from it?

6 Answers   ABC, IBM, Mphasis, Wipro,






what is Reentrancy and Quasi-reentrancy?

1 Answers  


What the difference is between continue and next sentence?

0 Answers  


is this below syntax correct? CALL 'subprg' using A,B Please help

2 Answers  


HOW WE WILL SORT THE ARRAY WHICH IS GOING TO USE FOR SEARCH ALL?

2 Answers   Cap Gemini,


level number 77 is used to define a)group data b)elementary data c)redefine d)none

8 Answers   TCS,


What is the Linkage section? What is the Use and Why the parm length use alway "PARM-LENGTH PIC S9(4) or PIC S9 (4) COMP." any reason?.Please let me know any one... Cheers,Prasad

8 Answers   Syntel,


Can we use redefine clause in occurs clause?

10 Answers  


Categories