If your the date value in the physical file is truly a date field (data type L) I don’t know of a way to get just the month value of the field. The substring keyword won’t work with a date field. You could build a work file and process from that or create a date file with the date and then the month, day and year split into individual fields and have a join logical keyed by the date file month. Hope this helps.
Hi Mrs. B,
Ok, I was wondering if you were using Access over Sql, VB straight to a table via ODBC. Is this Excel, perchance? Xbase? In other words, what software do you use for the data?
How you sort on the piece of a field will take a different tack depending on your platform.
If its in VB you can use Month() function pass a date o it and it will return the month of the date.
If you want year or day there are unctions like year() , date(), which will return you a date.
and if you dont know if it is a date or note its better that you check it beforing passing it to function, for that you can use isdate() function it will return true of false.
If the date is an L date-type, you could try adding the separate fields to the physical file, putting a trigger on the physical file to populate the separate fields, and then generate your logical over the separate MM field.
Here’s another one to try if your field is a true date datatype.
Specify the DATFMT on the field in your logical. The options will include the year also, but it sounds like it should give you what you’re after.
DATFMT(*MY , *YM , *MYY , *YYM) — check out the DDS Reference manual in the Information Center.
For Version 5, Release 2:
For Version 5, Release 3:
Look for the Reference under +Database and +Manuals
Sorry, I forgot they moved the DDS Reference in V5R3. You can find it under +Programming, and +DDS.