× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: Operational descriptors
  • From: "Simon Coulter" <shc@xxxxxxxxxxxxxxxxx>
  • Date: Fri, 27 Jul 01 22:37:03 +1000

Œ
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
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.