× 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.



Otto,

I do much the same using the java.util.Hashtable class (which 
java.util.Properties "extends").

Thank you for directing me to Barbara's tech-tip.  While it does demonstrate 
use of VARYING, it
doesn't qualify any performance impact using this technique.  In referencing a 
similar tip
provided by Bob Cozzi, also at mcpressonline, Bob's research indicates that 
using VARYING when
passing parameters does provide a performance gain.  Of course the 2 catches 
here are the use of
java and the fact that we are discussing a "return" field.  Bob's tech-tip 
states that, at least for
non-java return fields, even when using VARYING for the return field, the 
system still allocates
resources based on the size specified on the prototype.  I would expect the 
behavior to be the
same when prototypeing java calls, however, as the compiler is generating JNI 
calls, it is
possible some magic is performed at the lower levels.  Barabara, comments 
please?

BTW:

Going back to our earlier discussion about using direct calls to JNI's 
"NewString" function:

Following is a simple example doing just that:

<CODE>
     H THREAD(*SERIALIZE) BndDir('QC2LE') DFTACTGRP(*NO) ACTGRP(*NEW)
     D/DEFINE OS400_JVM_12
     D/DEFINE JNI_COPY_STRING_FUNCTIONS
     D/COPY qsysinc/QRPGLESRC,JNI
      ****************************************************************
      * Modified version of JNI's NewString prototype replacing parm2
      * with pointer type verses "jchar".
      ****************************************************************
     D NewStringX      PR                  LIKE(jstring)
     D                                     EXTPROC(*CWIDEN
     D                                     : JNINativeInterface.
     D                                       NewString_P)
     D env                                 LIKE(JNIEnv_P) VALUE
     D utf                             *   OPTIONS(*STRING) VALUE
     D len                                 like(jsize) value
      *
     Dprintf           PR                  EXTPROC('printf')
     D                                 *   value options(*string)
      *
     DGetStringChar    PR                  EXTPROC(*JAVA:'java.lang.String':
     D                                     'getChars')
     D SrcBegin                      10I 0 value
     D SrcEnd                        10I 0 value
     D Destination                16383c   varying options(*varsize)
     D DestBegin                     10I 0 value
      *
     DGetStringLng     PR            10I 0 EXTPROC(*JAVA:'java.lang.String':
     D                                     'length')
      *
     DgetJniEnv        PR              *
      *
     DString           S               O   CLASS(*JAVA:'java.lang.String')
     D iostring        C                   '11111111112222222222333333333-
     D                                     3AAAAAAAAAABBBBBBBBBBCCCCCCCCCC'
     DInputString      S          16383c   varying
     Dstring_long      S             10I 0
     DJNI_Error        S               O   CLASS(*JAVA:
     D                                     'java.lang.Throwable')
      *
     C                   if        JNIEnv_P = *NULL
     C                   eval      JNIEnv_P = getJniEnv()
     C                   endif
      * Convert "bytes" to "chars".
     C                   EVAL      InputString = %UCS2(iostring)
     C                   monitor
      * Note the address of InputString offset by 2.
     C                   EVAL      String = NewStringX(JNIEnv_P
     C                             :%addr(InputString)+2:%len(InputString))
     C                   on-error
     C                   EVAL      JNI_error = ExceptionOccurred(JNIEnv_P)
     C                   if        JNI_error <>  *NULL
     C                   callp     ExceptionClear(JNIEnv_P)
     C                   move      '1'           *inlr
     C                   return
     C                   endif
     C                   endmon
      *
     C                   EVAL      String_long = GetStringLng(String)
     C                   callp     Printf('String length is ' +
     C                             %char(string_long) + x'15')
      * Extract & display input string.
     C                   callp     GetStringChar(string:0:String_long:
     C                             Inputstring:0)
      *
     C                   callp     Printf(%char(InputString) + x'15')
      *
     C                   move      '1'           *inlr
     D/COPY *libl/QRPGLESRC,getJniEnv
<CODE>

Best regards,

Michael Rooney
Citigroup International     



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.