Thread: COBOL

REDEFINES - why would I want two names for the same memory?

Started by Jordan • user3 replies157 viewsLast activity 3 weeks ago
Post #1
0 votes
Jordan
Reputation
12
Posts: 32
Joined: May 2, 2026, 11:10 AM
Posted: Jul 21, 2026, 11:48 AM

Saw REDEFINES in a record layout. Same bytes described two different ways. When is that useful and when is it a footgun?

Post #2
1 votes
James
Reputation
524
Posts: 30
Joined: May 2, 2024, 8:00 AM
Posted: Jul 21, 2026, 3:48 PM

Useful when the same file record is type A or type B depending on a code in the header. One layout redefines the other.

Footgun when people redefine numerics as character and then do math, or forget which view is "current."

Post #3
0 votes
Marty
Reputation
412
Posts: 58
Joined: Aug 12, 2024, 9:14 AM
Posted: Jul 22, 2026, 12:48 PM

Also common for breaking a date PIC 9(8) into YYYY MM DD fields without MOVEing.

You must be signed in to reply to this thread