PDA

View Full Version : RPG und JNI



Sven Schneider
10-06-03, 22:02
Hallo,
das ist mein erster Versuch mit RPGIV und JNI.
Soweit funktioniert auch alles nur beim Ruf der Java-Methode "valueOf" der Klasse java.lang.String (getLongValue) bricht das Programm ab.

Wo ist Fehler ?
Danke Sven !!!



D*------------------------------------------------------------------------
D* Declaration for Java object of class BigDecimal in package java.math
D*------------------------------------------------------------------------
Dj_BigDecimalObj S O CLASS(*JAVA: 'java.math.BigDecimal')

D*----------------------------------------------------
D* Parameter field declarations for Java constructor:
D* in class BigDecimal in package java.math
D*----------------------------------------------------

D*-----------------------------------------------
D* Returned field declaration for Java method:
D* multiply in class BigDecimal
D* Java returned type is java.math.BigDecimal
D*-----------------------------------------------
D j_multiplyRet S O CLASS(*JAVA : 'java.math.BigDecimal')
D*-----------------------------------------------
D* Parameter field declarations for Java method:

D* multiply in class BigDecimal
D*-----------------------------------------------
D* Parameter field declaration for Java type: java.math.BigDecimal
D j_multiplyParm1...
D S O CLASS(*JAVA : 'java.math.BigDecimal')

D*-----------------------------------------
D* Prototype for Java constructor in class
D* BigDecimal in package java.math
D*-----------------------------------------
D j_BigDecimalCtor...
D PR O EXTPROC(*JAVA :
D 'java.math.BigDecimal' :
D *CONSTRUCTOR)
D CLASS(*JAVA : 'java.math.BigDecimal'
D )
Dj_BigDecimalParm1...
D 8F Value
D*------------------------------------------------------
D* Prototype for Java method:
D* multiply in class BigDecimal in package java.math
D*------------------------------------------------------
D j_multiplyMethod...
D PR O EXTPROC(*JAVA :
D 'java.math.BigDecimal' : 'multiply')
D CLASS(*JAVA : 'java.math.BigDecimal'
D )
D* Parameter prototype declaration for Java type: java.math.BigDecimal
D parm1 O CLASS(*JAVA : 'java.math.BigDecimal')
D CONST
D getStringValue PR O EXTPROC(*Java:'java.math.BigDecimal':
D 'toString')
D CLASS(*Java: 'java.lang.String')
D getLongValue PR 20I 0 EXTPROC(*Java:'java.lang.Long':
D 'valueOf')
D STATIC
D string O CLASS(*Java:'java.lang.String')
D CONST
D longString S 65535A
D longInteger S 20I 0

D*-------------------------------------------------------------------------
D* Prototype for procedure containing sample code for calling Java method:
D* multiply in class BigDecimal in package java.math
D*-------------------------------------------------------------------------
D CallMultiplyMethod...
D PR
D*
C CALLP CallMultiplyMethod
C eval *inlr = *ON
P*-----------------------------------------------------------
P* Procedure containing sample code for calling Java method:
P* multiply in class BigDecimal in package java.math
P*-----------------------------------------------------------
P CallMultiplyMethod...
P B
D CallMultiplyMethod...
D PI
C*--------------------------------------------
C* Instantiate object of Java class BigDecimal
C*--------------------------------------------
C IF j_BigDecimalObj = *NULL
C EVAL j_BigDecimalObj = j_BigDecimalCtor(35)
C ENDIF
C IF j_multiplyParm1= *NULL
C EVAL j_multiplyParm1 = j_BigDecimalCtor(2)
C ENDIF
C*---------------------------------
C* Call Java method:
C* multiply in class BigDecimal
C*---------------------------------
C EVAL j_multiplyRet =
C j_multiplyMethod(j_BigDecimalObj :
C j_multiplyParm1)
C eval longInteger =
C getLongValue(getStringValue(j_multiplyRet))
P CallMultiplyMethod...
P E


[Dieser Beitrag wurde von Sven Schneider am 10. Juni 2003 editiert.]