|
The Convert Date and Time Format API (QWCCVTDT) is giving me a bit of any argument when trying to convert *DTS format date/time stamps. I don't have any problem with any other conversion. I've called it two ways - one works, the other doesn't - and I think they both should. The first method (which works nicely) I use a technique as follows: Into the program that calls the API I pass a pointer to the variable that has the data to be converted. Then things work as follows: InVarPtr S * (the pointer to the variable that contains the *DTS data to convert, passed into program) InVar S * Based(InVarPtr) OutVar S 17A InFmt S 10A Inz('*DTS') OutFmt S 10A Inz('*YYMD') Call 'QWCCVTDT' Parm InFmt Parm InVar Parm OutFmt Parm OutVar The above converts the *DTS value just fine. Working in a second program, it was easier just to work with the data directly, so I did what I thought would be the same thing and passed into the program a 17 long character variable containing the *DTS value. So it appears more like this: InVar S 17A (character argument passed into the program) OutVar S 17A InFmt S 10A Inz('*DTS') OutFmt S 10A Inz('*YYMD') Call 'QWCCVTDT' Parm InFmt Parm InVar Parm OutFmt Parm OutVar This method produces very bizarre dates. The date I'm converting is from a data queue message, and I'm confident that I have a valid *DTS value. In fact, I debugged the programs and took the exact variable being passed to the API in example 1 and plugged it into example 2, and it still fails. I can't figure out why. It's almost like handling the variable as a character causes a problem, when handling it as a pointer does not. I get no errors from the API, and I'm sure the *DTS value is left justified. According to the API, only the first 8 characters are used anyway if using *DTS data. The API documentation seems to imply that you can pass any length argument in, but only the first 8, 16 or 17 will be used as appropriate. For those who want to play with exact numbers, the *DTS value in this example is X'89A37F16E9B68000'. Program 1 converts this to '20050516132424' and program 2 converts the same hex value to'20410310170421' (I've dropped the milliseconds from these output values) Anyone seen anything like this with this API? Regardless of why example 1 works and example 2 doesn't, I'd like to move more toward example 2 for other internal structure reasons. So other than the confusion of why one works and the other doesn't, I'd like to know what I'm doing wrong in #2 Thanks JPW The bitterness of poor quality remains long after low pricing is forgotten! Cautillo, Leon M. This message has been sent from Foodstuffs (Auckland) Limited ("Foodstuffs"). The information contained in this message and or attachments is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any system and destroy any copies. The views and opinions expressed in this message may be those of the individual and not necessarily those of Foodstuffs, and are not given or endorsed by it. Please note that this communication does not designate an information system for the purposes of the Electronic Transactions Act 2002.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.