You can use format PD0 to look at "parts" of a packed-decimal field. This format ignore the high-order and low-order four bits of a field.
So, for X'01015F' you can look at the last two bytes as PD0 and you've isolated the year, and the first two bytes of PD0 and you've isolated the month.
To use PD0 in an INCLUDE/OMIT COND= with a constant, you have to specify the constant in hexadecimal.
It's only been 15 years or so, and some designers have forgotten about the problems of storing years as a 2-digit field. The ability of some humans to fail to learn from experience is unlimited.
Joined: 31 May 2004 Posts: 391 Topics: 4 Location: Richfield, MN, USA
Posted: Fri May 08, 2015 8:20 am Post subject:
The shop I worked at in the late 80s was storing a year and month (YYMM) in a 2-byte binary field on one of its files. Better to bite the bullet now than have problems down the road. _________________ ....Terry
I'm less concerned about the two-digit year than I am about the foolishness of storing the month before the year. That way you can simply test for equal, but nothing else. Putting the year first, you can test for less than and greater than, as well as equal.
And yes, attention should be paid to the full year. Program can't possibly live that long to be a problem? If "cloned" regularly (and the clones then cloned in turn), it'll easily get to the next century... even if it's shed its original skin several times.
Also, they are taking twice as much space as needed -- wasting half of it.
You can easily store a MMDDYY date in just 2 bytes -- 4 bits for month, 5 bits for day, and year in the remaining 7 bits. I worked with a system that did this. Could probably find the couple dozen lines of COBOL code that decoded this into a real date -- mostly multiplies & divides by powers of 2 and moves. And this was part of the key for this ISAM tape file. But they really saved storage space on that date.
Of course, there was about 20 bytes of FILLER at the end of the record ...
You can use format PD0 to look at "parts" of a packed-decimal field. This format ignore the high-order and low-order four bits of a field.
So, for X'01015F' you can look at the last two bytes as PD0 and you've isolated the year, and the first two bytes of PD0 and you've isolated the month.
To use PD0 in an INCLUDE/OMIT COND= with a constant, you have to specify the constant in hexadecimal.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum