Overlaid Packed Data In Data Structures
August 16, 2016 Jon Paris
Note: The code accompanying this article is available for download here.
Sometimes things that should be simple give us difficulty. Jon Paris recently helped a Four Hundred Guru reader to solve a problem with overlaid packed-decimal data in data structures. We’re sharing their conversation for the benefit of others.
My question has to do with overlaid packed-decimal data in a data structure. I store a date in CYMD format in a seven-digit, packed-decimal field. I am trying to extract the two-digit year from that.
Dcl-Ds cymdDate; currentDate packed(7); currentYear packed(2) overlay(currentDate:2); End-Ds;
When I set