diffrence between renames and redifnes with examples
Answers were Sorted based on User's Feedback
Answer / khasim
We can regroup using RENAMES.
02 MM PIC X(2).
02 DD PIC X(2).
02 YY PIC X(2).
66 DATE RENAMES DD TRRU YY.
We can devide an Element to multiple elements using
REDEFINES.
02 DATE1 X(6).
02 DATE2 REDEFINES DATE1.
05 MM PIC X(2).
05 DD PIC X(2).
05 YY PIC X(2).
This is main defference.
Remaining things all know.
| Is This Answer Correct ? | 16 Yes | 2 No |
Answer / swathi.k
Redefines are used to reuse the storage space where as
renames are used to regroup the elementary items.
Ex:For redefines
01 A.
02 PIC X(6) VALUE 'SWATHI'.
02 REDEFINES A PIC X(2).
fOR RENAMES
01 A.
02 B PIC X(5).
02 C PIC X(5).
02 D.
03 D1 PIC X(2).
03 D2 PIC X(5).
02 E PIC X(6).
66 GROUP1 RENAMES C THRU E.
2.Redefines are coded with 0 to 49 level numbers where
as renames are declared with 66 level no.
3.pic clause is required for redefines where as pic clause
is not used for renames.
| Is This Answer Correct ? | 18 Yes | 8 No |
Answer / chaitanya chandana
redefines can use the any level no(0-49)...
but renames uses the 66 level no...
redefine may not perform subsequent to earlier data-item.
rename perform subsequent to earlier data-item.
Plz correct me if any mistake to my answer..
| Is This Answer Correct ? | 6 Yes | 4 No |
01 var1 pic s9(9)v99. 01 var2 pic x(30). procedure division. move 12345.99 to var1. move12345.99 to var2. display var1. display var2. what is the output?
What are declaratives and what are their uses in cobol?
is this below syntax correct? CALL 'subprg' using A,B Please help
What is the difference between performing a SECTION and a PARAGRAPH?
Can we move SPACES to numeric field and ZEROES to alphabetic field? If yes what are the way doing this?
can we use the two 01 level in file discription ?
01rec1. 05 a pic 999v99 value 123.12 05 b pic 99v9 value 45.9 02 rec2. 05 x pic 999v99 05 y pic 99v99 05 z pic x(3) value 'abc' if rec1 is moved to rec2 then what is the value of rec2?
in cobol perform stmt whether it first checks the condition or not
How to increase the logical record length of existing PS file?
WORKING-STORAGE SECTION. 01 VAR1 COMP-2 VALUE 0. PROCEDURE DIVISION. MOVE 10.2115 TO VAR1. DISPLAY 'VAR1 =' VAR1. GOBACK. 10.2115 is stored as .10211499999999996E 02 in OS VS Cobol 10.2115 is stored as .10211500000000000E 02 in ecobol. Any reason why?
What is the default value(s) for an initialize and what keyword allows for an override of the default?
Are you comfortable in cobol or jcl?