PDA

View Full Version : Date Problems with Character Mode DF



Brendon
30-Sep-2005, 01:20 AM
I'm trying to stop the unconverted date errors in Visual Studio, but a
character-based program I am running is not converting the dates correctly
when entering back into a date field.
I'm reading a number string and a date from a file (as well as some other
stuff) and generating orders in a database accessed by both character-mode
Dataflex terminals and also vdf-based clients.

I'm having problem either reading or writing the info which should be seen
as a date.
I've shown a small setup below to show the basic structure with the reads
held in a loop. Can anyone see the problem?

//----------------------------------------------------------
STRING ORDER_NO
DATE DATE_REQUIRED

READ ORDER_NO
READ DATE_REQUIRED

MOVE ORDER_NO TO OEMASTER.CUST_ORD_NO
MOVE DATE_REQ TO OEMASTER.DATE_REQ
//--------------------------------------------------------------

Whenever a record that was generated with the above code is found in the
Visual Studio (V11) I get an error message in the Studio re the bad dates.
Should I be doing something more like this to call a date function or
something?

MOVE DATE(DATE_REQ) TO OEMASTER.DATE_REQ

to retain the date property? If so, should I initiate the variable DATE_REQ
as a 'date' variable like shown, or as a 'string' variable which then has a
"DATE" function applied?

Thanks for any help.
Much appreciated as always.

Brendon

Bob Worsley
30-Sep-2005, 06:43 AM
Do your dates always show up in the same format?
What is that format? 2 or 4-char year? US vs some other?
Depending on the above, you might need to do some of what you've mentioned.
Normally you shouldn't need to do anything special, but that's assuming all
is perfect. <g>
Bob

"Brendon" <brendono@sewgroup.com> wrote in message
news:hydaCcYxFHA.3452@dacmail.dataaccess.com...
> I'm trying to stop the unconverted date errors in Visual Studio, but a
> character-based program I am running is not converting the dates correctly
> when entering back into a date field.
> I'm reading a number string and a date from a file (as well as some other
> stuff) and generating orders in a database accessed by both character-mode
> Dataflex terminals and also vdf-based clients.
>
> I'm having problem either reading or writing the info which should be seen
> as a date.
> I've shown a small setup below to show the basic structure with the reads
> held in a loop. Can anyone see the problem?
>
> //----------------------------------------------------------
> STRING ORDER_NO
> DATE DATE_REQUIRED
>
> READ ORDER_NO
> READ DATE_REQUIRED
>
> MOVE ORDER_NO TO OEMASTER.CUST_ORD_NO
> MOVE DATE_REQ TO OEMASTER.DATE_REQ
> //--------------------------------------------------------------
>
> Whenever a record that was generated with the above code is found in the
> Visual Studio (V11) I get an error message in the Studio re the bad dates.
> Should I be doing something more like this to call a date function or
> something?
>
> MOVE DATE(DATE_REQ) TO OEMASTER.DATE_REQ
>
> to retain the date property? If so, should I initiate the variable
DATE_REQ
> as a 'date' variable like shown, or as a 'string' variable which then has
a
> "DATE" function applied?
>
> Thanks for any help.
> Much appreciated as always.
>
> Brendon
>
>

David
3-Jan-2006, 03:53 PM
Dates in Console mode...

6 digit dates, no slashes with leading zeros will convert for you into a
date with slashes when moved into a date data type EXCEPT

year Zero will not work in a date formatted image for data entry, though it
will display, EXCEPT

Jan One of year Zero is equal to "Zero | blank | null" for DataFlex. Year
zero Dec 31 is = 365, not because it starts with day 1 on January 1, 00 but
because year Zero is a leap year, with Feb 29th.

Thus, leaving dates in strings as year 00 or even trying to work with
mm/dd/00 will not work as date data types universally.

Day "1" problem

Convert your Jan 1 00 to a non-zero year, or as a date it will be converted
to "null."

Year "0" problem

Convert your year 00 dates, Jan 2 to Dec 31 to another year, or Date
formatted images will refuse to let you enter through, though they will
display the two digit 00 year..

At the VDF end,

Century "1" problem

After you set DATE4_Status true, you will not be able to use date values 1
to 365 in anything that treats them like dates. In fact, beyond first year,
First Century dates, 0-99, are inaccessible.

Hope that helps.

Moral: Avoid first day, first year, first century.

Suggestion: tokenize your date into Month, Day, Year tokens yourself, and
map to legal dates in the range:
1/1/100 to 12/31/2500


Good luck.

David

PS. If I recall, illegal Feb 29s can also cause problems between Console
mode and VDF, and sometimes map to March 1.


"Bob Worsley" <rworsley@choosebroadspire.com> wrote in message
news:izfOxQbxFHA.2172@dacmail.dataaccess.com...
> Do your dates always show up in the same format?
> What is that format? 2 or 4-char year? US vs some other?
> Depending on the above, you might need to do some of what you've
> mentioned.
> Normally you shouldn't need to do anything special, but that's assuming
> all
> is perfect. <g>
> Bob
>
> "Brendon" <brendono@sewgroup.com> wrote in message
> news:hydaCcYxFHA.3452@dacmail.dataaccess.com...
>> I'm trying to stop the unconverted date errors in Visual Studio, but a
>> character-based program I am running is not converting the dates
>> correctly
>> when entering back into a date field.
>> I'm reading a number string and a date from a file (as well as some other
>> stuff) and generating orders in a database accessed by both
>> character-mode
>> Dataflex terminals and also vdf-based clients.
>>
>> I'm having problem either reading or writing the info which should be
>> seen
>> as a date.
>> I've shown a small setup below to show the basic structure with the reads
>> held in a loop. Can anyone see the problem?
>>
>> //----------------------------------------------------------
>> STRING ORDER_NO
>> DATE DATE_REQUIRED
>>
>> READ ORDER_NO
>> READ DATE_REQUIRED
>>
>> MOVE ORDER_NO TO OEMASTER.CUST_ORD_NO
>> MOVE DATE_REQ TO OEMASTER.DATE_REQ
>> //--------------------------------------------------------------
>>
>> Whenever a record that was generated with the above code is found in the
>> Visual Studio (V11) I get an error message in the Studio re the bad
>> dates.
>> Should I be doing something more like this to call a date function or
>> something?
>>
>> MOVE DATE(DATE_REQ) TO OEMASTER.DATE_REQ
>>
>> to retain the date property? If so, should I initiate the variable
> DATE_REQ
>> as a 'date' variable like shown, or as a 'string' variable which then has
> a
>> "DATE" function applied?
>>
>> Thanks for any help.
>> Much appreciated as always.
>>
>> Brendon
>>
>>
>
>