Hola Foro. Estoy empezando a probar el Java en mi Power6. De momento
intento llamar métodos desde un ILE, pero la primera en la frente. Me he
copiado un programa de ejemplo que muestro al final, y no me deja
compilar, porque no encuentra el fuente del /copy
El classpath lo tengo como sigue:
Variable de entorno . . . . . . > 'CLASSPATH' Valor tipo carácter
Nuevo valor . . . . . . . . . .
'/QIBM/UsrData/Java400/ext/:/QIBM/ProdData/Java400/ext/'
Tengo que tener en cuenta algo más?
Gracias
H DftActGrp(*NO) ActGrp(*CALLER)
/Copy *LibL/QRpgLeSrc,MathPr
D alpha1 C Const('2.5')
D alpha2 C Const('1.5')
D string1 S O Class(*JAVA:'java.lang.String')
D string2 S O Class(*JAVA:'java.lang.String')
D Sum S O Class(*JAVA:'java.math.BigDecimal')
D BigD1 S O Class(*JAVA:'java.math.BigDecimal')
D BigD2 S O Class(*JAVA:'java.math.BigDecimal')
D StringSum S O Class(*JAVA:'java.lang.String')
D DisplaySum S 30A Varying
* Create String objects from the alphanumeric constants
C Eval String1 = newString(alpha1)
C Eval String2 = newString(alpha2)
* Create BigDecimal Objects from the String objects. We
* could creat BigDecimal directly from a float or bigInt
* and save the String object creation step, but Sun
* recommends using Strings for data accuracy.
C Eval BigD1 = String2BigD(string1)
C Eval BigD2 = String2BigD(string2)
* Add the two BigDecimal objects. See how there are two
* parameters even though we only defined one. The first
* parm is the instance parm and the second parm is the
* one that we defined in the prototype.
C Eval Sum = add(BigD1:BigD2)
* Now convert the BigDecimal sum back to a string; then
* convert the String into aplha data for us to view.
C Eval StringSum = BigD2String(Sum)
C Eval DisplaySum = getBytes(StringSum)
* display the alpha version of the sum and end the program.
C DisplaySum Dsply
C Eval *InLr = *On
El copy book
**********************************************************************
* BigDecimal add method. It accepts a BigDecimal object
* as a parameter, and returns a BigDecimal object (the sum
* of instance class and the parm used to make the call).
**********************************************************************
D add PR O ExtProc(*JAVA:
D 'java.math.BigDecimal':
D 'add')
D Class(*JAVA:'java.math.BigDecimal')
D BigD2 O Class(*JAVA:'java.math.BigDecimal')
D Const
**********************************************************************
* BigDecimal constructor that accepts a string parameter
* and returns a BigDecimal object. Use this constructor
* rather than the double conversion as converting from a
* is more accurate according to Sun's documentation.
**********************************************************************
D String2BigD PR O ExtProc(*JAVA:
D 'java.math.BigDecimal':
D *CONSTRUCTOR)
D Class(*JAVA:'java.math.BigDecimal')
D Str O Class(*JAVA:'java.lang.String')
D Const
**********************************************************************
* getBytes - Converts a string to a byte array for use in a char field
**********************************************************************
D getBytes PR 30A ExtProc(*JAVA:
D 'java.lang.String':
D 'getBytes')
D Varying
**********************************************************************
* newString constructor that accepts a byte array
* (an alphnumeric variable in RPG speak). It
* returns a string object.
**********************************************************************
D newString PR O ExtProc(*JAVA:
D 'java.lang.String':
D *CONSTRUCTOR)
D Class(*JAVA:'java.lang.String')
D byes 30A Const Varying
*********************************************************************
* BigD2String conversion that accepts THIS
* instance of BigDecimal and returns a string object.
**********************************************************************
D BigD2String PR O ExtProc(*JAVA:
D 'java.math.BigDecimal':
D 'toString')
D Class(*JAVA:'java.lang.String') ____________________________________________________
© Publicaciones Help400, S.L. - Todos los
derechos reservados http://www.help400.es
----------------------------------------------------
Para darte de baja visita la siguente URL:
http://listas.combios.es/mailman/listinfo/forum.help400