0 pts.
 Logical File Question
We need to break a date field into mm dd yy so we can key on the mm. how can we do this in a logical file? thanks

Software/Hardware used:
ASKED: April 11, 2005  9:53 AM
UPDATED: April 15, 2005  2:36 PM

Answer Wiki:
Mrs. B, Can you give us an idea of what tools you have available? Thanks, :) Gene
Last Wiki Answer Submitted:  April 11, 2005  10:41 am  by  HappyGene   0 pts.
All Answer Wiki Contributors:  HappyGene   0 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _


 

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.

 0 pts.

 

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.

LMK,
:) Gene

 0 pts.

 

Hi,

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.

Anything more?

 0 pts.

 

Hi,
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.
Steve

 0 pts.

 

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:
http://publib.boulder.ibm.com/infocenter/iseries/v5r2/ic2924/index.htm

For Version 5, Release 3:
http://publib.boulder.ibm.com/infocenter/iseries/v5r3/ic2924/index.htm

Look for the Reference under +Database and +Manuals

 0 pts.

 

Sorry, I forgot they moved the DDS Reference in V5R3. You can find it under +Programming, and +DDS.

 0 pts.