Hello List Members,
I've just started using the new date intrinsics and I have this
intermittent problem. This is a HP Business Basic program that calls
HPDateConvert to convert from a YYMMDD to YYYYMMDD date. So I have this
date in a string and call HPDateValidate with this string and type code
25. This intrinsic returns success, good date. Then I call HPDateConvert
with the same input date string and type code 25, and output string and
type code 38. This will return -2 which means "Bad input date argument
is passed to the intrinsic". But this only happens most of the time. If
I rerun the program, and this is in the interpreter, it may fail or it
may work. It won't switch back and forth. If it doesn't work, it will
probably not work many more times. But sometimes it will work and then
works continuously after that. If I change the COM statement by just
removing the "#1", the common file, the intrinsic call will work
consistently, so far.
So what the heck is going on. There is something here I'm not seeing.
It's almost like there is an uninitialized variable in the date
intrinsic call that sometimes has the correct value. Does anyone have an
idea? Here is a program that demonstrates the failure.
TIA
John Zoltak
North American Mfg Co
----------------------------------------- here is program list
------------------------------------
! testit
10 COM Today_gregorian$[8]
20 !
30 DIM Buffer$[32]
40 DIM SHORT INTEGER Hpe_status(2), INTEGER Date_error
50 !
60 GLOBAL INTRINSIC
Hpdateconvert,Hpdateformat,Hpdatediff,Hpdateoffset,&
FNHpdatevalidate ALIAS "hpdatevalidate"
70 !
80 Buffer$=DATE$(0)
90 Buffer$=Buffer$[7;2]+Buffer$[1;2]+Buffer$[4;2]
100 !
110 Date_error=FNHpdatevalidate(25,Buffer$,-1)
120 IF Date_error<>0 THEN
130 DISP "Invalid date entered!"
140 GOTO Ask_date
150 ENDIF
160 CALL
Hpdateconvert(25,Buffer$,38,Today_gregorian$,Hpe_status(*),-1)
170 IF Hpe_status(1)<>0 THEN
180 DISP "Error in input date convert, error=";Hpe_status(1)
190 ENDIF
200 SETLEN Today_gregorian$ TO 8
210 DISP Today_gregorian$
----------------- here is sample run -------------------
HP Business BASIC/iX HP32715A.00.15 Copyright Hewlett-Packard Co.
1989
FRI, APR 24, 1998, 10:21 AM
>get testit
>run
Error in input date convert, error=-2
>run
Error in input date convert, error=-2
>run
Error in input date convert, error=-2
>mod 10
10 COM #1,Today_gregorian$[8]
ddd
10 COM Today_gregorian$[8]
>
>run
19980424
>
|