Master Mainframe Technologies - COBOL, JCL, DB2, VSAM, CICS & More
ABEND Codes SQLCODEs File Status Interview Prep Contact
💻 COBOL

COBOL REDEFINES Clause

Intermediate 🕑 10 min read 👁 0 views

12

Code Example


## COBOL REDEFINES Clause

REDEFINES allows multiple data descriptions to share the same storage area, providing different views of the same data.

### Syntax

\`\`\`cobol
level-number data-name-1 REDEFINES data-name-2
\`\`\`

### Rules

1. Must immediately follow the redefined item
2. Must be at same level number
3. Cannot redefine item with OCCURS (but can contain OCCURS)
4. Size should not exceed original (warning) or be smaller
5. Level 01 items in FILE SECTION implicitly redefine each other
6. Cannot have VALUE clause (except level 88)

### Common Use Cases

1. **Different data types**: View numeric as alphanumeric
2. **Union types**: Different record formats
3. **Date manipulation**: Access date parts
4. **Packed/display conversion**: Different numeric formats

### Performance Note

REDEFINES uses no additional memory - it's compile-time only.