After an update to a 10+ year old program users started reporting that it
would not print a date until it was restarted. (The program is normally
started each night and runs all day long, printing labels as needed).
The update did not change anything within the function which is failing to
print the date.
The statement is rfmtdate( f_sellby_date, "mmm dd", f_sellby_str );
(f_sellby_date is a long, f_sellby_str is a char[8]; f_sellby_date contains a
reasonable value)
Looking up error -1212 it says "Date conversion format must contain a month,
day, and year component".
So I changed the format string to "mmm dd yy" and then null-terminated it
after the day. It works fine now.
I found 3 other programs with the same code. I checked and they were printing
correctly.
I wrote a small test program. It works fine using "mmm dd". (tested on several
machines with several variations of $DBDATE just to be sure).
I notice that later versions of Informix have a slight variation in the
finderr output for 1212 (saying month, day OR year instead of month, day AND
year).
But why is this one program suddenly failing? Or if it should fail, why did it
presumably used to work and why does my test program work?
We're using SE 7.24.UC5 on AIX 5.2. Nothing was changed in the way it was
compiled.
My test program:
EXEC SQL INCLUDE SQLCA;
int main()
{
char f_string[7];
rfmtdate( 40253, "mmm dd", f_string);
printf( "%s\\
", f_string );
}
The output from this (as expected) is "Mar 17".
I would love to know what's going on. Any ideas would be appreciated.