Hello Java & AS/400 Expert..
I make small application from CL called java with Qshell (QSH).
java will accept 2 paramter which is passed from CL, and calculate it.
example : CL passed 2 parameter , e.g &PARM1 ='2' and &PARM2='0' to Java , then java will process with formula : strResult=&PARM1 *100 ,
my question , How CL catch strResult (java variable) and assign it value to &PARM2
bellow I include snippet code both CL ana java code
CL code (CALCULATE.CLP) :
java Code (Calculate.java)
when I debug CL, the value of &PARM2 doesn't change yet....still remain '0 '
any respond, and comment is highly appreciated
Regards,
Wahyu Komara
I make small application from CL called java with Qshell (QSH).
java will accept 2 paramter which is passed from CL, and calculate it.
example : CL passed 2 parameter , e.g &PARM1 ='2' and &PARM2='0' to Java , then java will process with formula : strResult=&PARM1 *100 ,
my question , How CL catch strResult (java variable) and assign it value to &PARM2
bellow I include snippet code both CL ana java code
CL code (CALCULATE.CLP) :
Code:
PGM DCL VAR(&PARM1) TYPE(*CHAR) LEN(1) VALUE('2') DCL VAR(&PARM2) TYPE(*CHAR) LEN(5) VALUE('0') DCL VAR(&JAVA) TYPE(*CHAR) LEN(255) CHGVAR VAR(&JAVA) VALUE('java example.Calculate ' + *CAT &PARM1 *CAT ' ' *CAT &PARM2) CHGCURDIR DIR('/home/sh30') CHKOBJ OBJ(QTEMP/DIRLIST) OBJTYPE(*FILE) MONMSG MSGID(CPF0000) EXEC(DO) CRTPF QTEMP/DIRLIST RCDLEN(5000) ENDDO OVRDBF FILE(STDOUT) TOFILE(QTEMP/DIRLIST) QSH CMD(&JAVA) DLTOVR FILE(STDOUT) ENDPGM
Code:
package example; /** * File name : Calculate.java * @author wahyu komara *Created Date : Nov 26, 2010 */ public class Calculate { private int result; public Calculate(String[] strArgs){ result=Integer.parseInt(strArgs[0]) *100; } public int getResult() { return result; } public void setResult(int result) { this.result = result; } public static void main(String args[]){ Calculate calculate=new Calculate(args); args[1]=""+calculate.getResult(); System.out.println(args[1]); } }
any respond, and comment is highly appreciated
Regards,
Wahyu Komara
Comment