|
If you go to the downloads page on rpgiv.com you can download the API prototypes for several APIs. Here's the prototype for QWCCVTDT. D QWCCVTDT PR ExtPgm('QWCCVTDT') D inFmt 10A Const OPTIONS(*VARSIZE) D inDate 64A Const OPTIONS(*VARSIZE) D outFmt 10A Const OPTIONS(*VARSIZE) D outDate 64A OPTIONS(*VARSIZE) D api_error LikeDS(QUSEC) D OPTIONS(*VARSIZE) The other thing is you're passing in a 10-alpha field, but *DTS fields are much bigger. If you have a time in the MI_Time format that you are converting (which is a 8-byte value, use Qp0zCvtToTimeVal to convert it to a timeval struct, then add the seconds to a variable that is set to the Epoch date to get the "Z" data type value. Or just use the GetDTS() subprocedure in RPG xTools. -Bob Cozzi www.RPGxTools.com RPG xTools - Enjoy programming again. -----Original Message----- From: rpg400-l-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx [mailto:rpg400-l-bounces+cozzi=rpgiv.com@xxxxxxxxxxxx] On Behalf Of Jim Wiant Sent: Monday, February 27, 2006 7:22 PM To: RPG400-L@xxxxxxxxxxxx Subject: CWCCVTDT continued.... Ok, a more clear example. It works in a stand alone program, I have trouble when it's in a called procedure. I must be missing something. Here's the three complete programs I just ran on my system.... (excuse my crappy cut/past formatting. Always hated it) ************************************************************************ ******************************************* #1 (works) /copy *LIBL/CPYSRC,HSPECS D myInpFmt S 10A Inz('*DTS') D myInpVar S 17A Inz(x'89A37F16E9B68000') D myOutFmt S 10A Inz('*YYMD') D myOutput S 17A /copy *LIBL/CPYSRC,ERRC0100 C Call(E) 'QWCCVTDT' C Parm myInpFmt C Parm myInpVar C Parm myOutFmt C Parm myOutput C Parm ERRC0100 C MyOutput Dsply C Eval *INLR = *On ************************************************************************ ******************************************** I get the right date (DSPLY 20050516132424437) Now - parent program for a called module: ************************************************************************ ********************************************* /copy *LIBL/CPYSRC,HSPECS H DFTACTGRP(*NO) ACTGRP(*CALLER) H BNDDIR('*LIBL/FXM_BNDDIR') D FXM_Convert_Date_And_Time_Format... D PR 17A Varying D InpFmt 10A Const D InpVar 17A Const D OutFmt 10A Const D ErrorCode LikeDS(ERRC0100) /copy *LIBL/CPYSRC,ERRC0100 D myInpFmt S 10A Inz('*DTS') D myInpVar S 17A Inz(x'89A37F16E9B68000') D myOutFmt S 10A Inz('*YYMD') D myOutVar S 17A C Eval myOutVar = C FXM_Convert_Date_And_Time_Format( C myInpFmt:myInpVar:myOutFmt: C ERRC0100) C MyOutvar Dsply C Eval *INLR = *On ************************************************************************ ************************************* And the module (compiled as type *module): ************************************************************************ ************************************* /copy *LIBL/CPYSRC,ERRC0100 D FXM_Convert_Date_And_Time_Format... D PR 17A Varying D InpFmt 10A Const D InpVar 17A Const D OutFmt 10A Const D ErrorCode LikeDS(ERRC0100) P FXM_Convert_Date_And_Time_Format... P B Export D FXM_Convert_Date_And_Time_Format... D PI 17A Varying D InpFmt 10A Const D InpVar 17A Const D OutFmt 10A Const D ErrorCode LikeDS(ERRC0100) * ** Local Variables * D myInpFmt S 10A D myInpVar S 17A D myOutFmt S 10A D myOutput S 17A D myERRC0100 DS LikeDS(ERRC0100) * ** Prepare * C Clear ERRC0100 C Eval ERRC0100.ErrBytPvd = %SIZE(ERRC0100) C Eval myInpFmt = InpFmt C Eval myInpVar = InpVar C Eval myOutFmt = OutFmt C Eval myOutput = *Blanks C Call(E) 'QWCCVTDT' C Parm myInpFmt C Parm myInpVar C Parm myOutFmt C Parm myOutput C Parm ERRC0100 C Return myOutput P FXM_Convert_Date_And_Time_Format... P E ************************************************************************ ************ and the result is DSPLY 20410310170337790 - They should be doing the same thing, shouldn't they? I ran this exact code on my system just now. (I didn't even want to substitute out the copy books in the example for fear I might remove one line incorrectly or something....) *Oh - I use a lot of copy books. The contents of the copy books used are: ERRC0100 D ERRC0100 DS QUALIFIED D ErrBytPvd 10I 0 INZ(%SIZE(ERRC0100)) D ErrBytAvl 10I 0 INZ(0) D ErrExcId 7A INZ(*Blanks) D ErrRsvd 1A D ErrExcDta 512A INZ(*Blanks) HSPECS H DEBUG H DECEDIT(*JOBRUN) H OPTIMIZE(*NONE) H OPTION(*srcstmt : *nodebugio : *showcpy) H TIMFMT(*HMS) Very confused why the differences JPW 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.