|
Simon, Thanks again. I see now that the problem I had with my CALLB version was that I was defining the paramater containing the time stamp to be converted via a data structure that contained a timestamp data type (Z). Obviously this didn't work because the compiler was seeing the data structure a RECORD data type instead of the FIXED LENGTH necessary for the API. Cheers, Peter -----Original Message----- From: Simon Coulter [mailto:shc@flybynight.com.au] Sent: Saturday, July 28, 2001 12:37 AM To: RPG400-L@midrange.com Subject: Re: Operational descriptors OE Hello Peter, You wrote: >Thanks a bunch, my problem was that I did not specify CONST. >This appears to mean that it cannot be called using CALLB. No, all the CEE APIs can be invoked via CALLB. The CONST just makes it easier to use literals and constant values. The main trick is in the OPTIONS(*VARSIZE) which causes the actual length of the parameter to be passed thus the API can determine the data type and length. The API defines the timestamp and picture string as a VSTRING which supports VARCHAR (with both 2-byte and 4-byte lengths), a fixed-length string (what I used in my example), or a null-terminated string. I don't think RPG IV can handle all those different types on a single prototype. The interesting thing is that the C-prototype defines a structure much like the one I used, however I don't see how using a structure with a length attribute will appear to the API as a true VARCHAR. Still, it works with fixed length strings and it probably works with real VARCHARs so that's fine. Here is an example (that works) using CALLB: H DFTACTGRP(*NO) D aTimestamp S 23 INZ('2001-07-26 14:00:23.123') D aPictureString S 23 INZ('YYYY-MM-DD HH:MI:SS.999') D theNbrOfSecs S 8F C CALLB(D) 'CEESECS' C PARM aTimestamp C PARM aPictureString C PARM theNbrOfSecs C PARM *OMIT C theNbrOfSecs DSPLY C SETON LR C RETURN >Incidentally, another issue arises when attempting to use the converse API >CEEDATM to reformat the seconds back to a different picture string. Since >the picture string doesn't use the % syntax >that the C runtime time format functions use, then it's not possible to >include a string like GMT in the picture because it contains one of the >formatting codes (M). This means I'll either have to insert it afterwards or >revert using the C functions. Not really an issue, just a different design goal of the API. It appears to default to returning a timestamp in the default format for the job based on the country code. Simply concatenate the 'GMT' string to the returned string. Regards, Simon Coulter. «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» «» FlyByNight Software AS/400 Technical Specialists «» «» Eclipse the competition - run your business on an IBM AS/400. «» «» «» «» Phone: +61 3 9419 0175 Mobile: +61 0411 091 400 /"\ «» «» Fax: +61 3 9419 0175 mailto: shc@flybynight.com.au \ / «» «» X «» «» ASCII Ribbon campaign against HTML E-Mail / \ «» «»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«»«» +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +--- This communication is confidential and may be legally privileged. If it is not addressed to you, you are on notice of its status. Please immediately contact us at our cost and destroy it. Please do not use, disclose, copy, distribute or retain any of it without our authority - to do so could be a breach of confidence. Thank you for your co-operation. Please contact us on (09) 356 5800 if you need assistance. +--- | This is the RPG/400 Mailing List! | To submit a new message, send your mail to RPG400-L@midrange.com. | To subscribe to this list send email to RPG400-L-SUB@midrange.com. | To unsubscribe from this list send email to RPG400-L-UNSUB@midrange.com. | Questions should be directed to the list owner/operator: david@midrange.com +---
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.