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
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 |
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 |
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 |
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 |
I have put two write operations in a single para for two different conditions.Will that lead to an abend or run successfully and write two records?
how would you resolve sb37 and SE37?
01 x pic s9(8) comp. How will the following value be internally allocated '18787'
What is an in-line perform ?
What is the usage of comp fields in cobol?
I have 100 records in a file.. i want to sort the records from 5 to 5o... give the syntax...
How to print 10 to 1 if the input have only 10 digit number?
hw to create 3 dimensional array & hw to access it?
what is the maximum error code in mainframe
How to execute a set of JCL statements from a COBOL program?
How to use the same COBOL program in Batch and CICS on lines? explain with an example
How to read records which is in sequential file in reverse order ? Exp. 1 2 3 4 5 . i want 5 4 3 2 1?please clear my doubt any one