RAMESH KRISHNA REDDY mainframe discussion forum - cobol, db2,cics,jcl,file-aid,changeman,interview questions
Online Tutorials   | PREV  | TOP  | NEXT



Author : Kishore B.



COBOL REDEFINES The REDEFINES clause allows the same memory area to be described by different data items. In program if we are sure that 2 or more date names are not in use at same time then we go for redefines clause. 01 WS-NAME. 05 WS_FST-NAME PIC X(05) VALUE “John”. 05 WS_FST-NAME PIC X(05) VALUE “Mike”. 01 WS-TOTAL-NAME REDEFINES WS-NAME PIC X(10). In above example WS-TOTAL-NAME will use same memory area allocated to WS-NAME. So Ws-TOTAL-NAME will have “John Mike” 1. Level numbers of WS-DATA-NAME1 and WS-DATA-NAME2 should be same. 2. REDEFINES clause cannot be used for level numbers 66 and 88. 3. REDEFINES may not be used in a level 01 entry in the File Section. 4. Number of characters need not be the same for WS-DATA-NAME1 and WS-DATA-NAME2. Compiler generates warning if number of characters in WS-DATA-NAME2 is greater than WS-DATA-NAME2. 5. Several data items can redefine the same data item. 6. Data items redefining the storage of a data item must immediately follow the description of that data item. Difference between REDEFINES and RENAMES: RENAMES clause is used for regrouping elementary data items and gives one name to it. REDEFINES clause allow you to use different data descriptions entries to describe same memory area



Previous chapter in COBOL tutorial Starting of COBOL tutorial Next chapter in COBOL tutorial

Visit COBOL books section in this site for good books

Home | Donations | Online Tutorials | Books | Entertainment | Contactme | privacy |  sql tutorial | jcl interview questions | JCL Tutorial | JCL Tutorial - chapter1 | JCL Tutorial - chapter2 | JCL Tutorial - chapter3 | JCL Tutorial - chapter4 | JCL Tutorial - chapter5 | JCL Tutorial - chapter6 | JCL Tutorial - chapter7 | JCL Tutorial - chapter8 | JCL Tutorial - chapter9 | JCL Tutorial - chapter10 | JCL Tutorial - chapter11