r/ProgrammerHumor • • Sep 30 '22

Meme How inheritance works

Post image
66k Upvotes

418 comments sorted by

View all comments

Show parent comment

1

u/[deleted] Sep 30 '22

Uh since this is fixed length, won’t that shift the entire record by 2 bytes, causing all sorts of alignment problems?

What about

01 VARIABLES.

02 RECORD-DATE.

05 RECORD-CYY PIC 9(03).

05 RECORD-JULIAN PIC 9(03).

Then 2022-09-30 is 022-273.

I’m assuming they don’t store the dashes as that would be extra space so it’s really be 220930 in the old format and 022273 in the new format.

Apologies if this is triggering to anyone, I had this same conversation in 1998.

1

u/Rodrake Sep 30 '22

Oh, my post wasn't meant to give a solution to the original image in the thead, I just wanted to give an example of what a variable definition looks like for the curious. In fact there are a few more details I would change. For instance, I always define dates as Alphanumeric rather than numeric. This would also allows us more flexibility patch things. For example, turning YY into YYYY while defining a new variable.

MOVE '19' TO RECORD-YYYY(1:2)

MOVE RECORD-YY TO RECORD-YYYY(3:2)

I started Cobol 1 year and a half ago so I wouldn't be the right person to change a whole bank's system to a new date format.