|
Hi Shreya, This is our example. How we are using data queues. Why? Because start every time a JVM is very slow, we have a permanent JVM waiting for a data queue entry. When a data queue entry appears execute the desired funtionality using the parameters. It works fast and is easy to maintain. COBOL/CL people only have to call a CL. I hope that this can help you. If you have new questions ask me. In our case we have a COBOL/CL application that needs execute some Java components. 1. CL program that is called by the COBOL/CL application filling parameters: (we have 3 different kinds of entries/parameters... distinct key) PGM PARM(&NPEDID &NTRES &CARTI &QPIEPD &FECHA + &CMERCA &NDOS) DCL VAR(&NPEDID) TYPE(*CHAR) LEN(8) DCL VAR(&NTRES) TYPE(*CHAR) LEN(3) DCL VAR(&CARTI) TYPE(*CHAR) LEN(15) DCL VAR(&QPIEPD) TYPE(*DEC) LEN(5 0) DCL VAR(&FECHA) TYPE(*CHAR) LEN(8) DCL VAR(&CMERCA) TYPE(*CHAR) LEN(1) DCL VAR(&NDOS) TYPE(*CHAR) LEN(2) DCL VAR(&LONG) TYPE(*DEC) LEN(5 0) VALUE(49) DCL VAR(&VAR) TYPE(*CHAR) LEN(49) DCL VAR(&LITE07) TYPE(*CHAR) LEN(07) CHGVAR VAR(&LITE07) VALUE(&QPIEPD) CHGVAR VAR(&VAR) VALUE('PR001' *CAT &NPEDID *CAT + &NTRES *CAT &CARTI *CAT &LITE07 *CAT + &FECHA *CAT &CMERCA *CAT &NDOS) CALL PGM(AP0ESASTIL/CHKJVMCL) (This CL program checks if the JVM is started. If not, this CL starts JVM) CALL QSNDDTAQ PARM(JVMDTAQ AP0DSASTIL &LONG &VAR) (Add a data queue entry with an special key -PR001- to know what kind of call is) ENDPGM 2. CL that starts JVM. We can execute this in the server startup or will be started with the first CHKJVMCL call: PGM DCL VAR(&QSHCMD) TYPE(*CHAR) LEN(1000) CHGVAR VAR(&QSHCMD) VALUE('java -Djava.version=1.2 + -cp + .:/run/cfg:/run/cn:/:/QIBM/ProdData/Http/Pu+ blic/jt400/lib/jt400Access.zip:/QIBM/ProdDa+ ta/OS400/jt400/lib/jt400Native.jar + xvr.app.sip.ba.stildux.data.as400.APIProduc+ cion') QSH CMD(&QSHCMD) ENDPGM 3. Java program that waits in a infinite loop data queue entries. Depending on the key do one thing or another one with the parameters that we receive in the data queue: public static void main(String[] parametros) { // AS400 Connection AS400 as400 = new AS400(host,user,password); try { // Format PR000 register: key detection CharacterFieldDescription clave_PR000 = new CharacterFieldDescription(new AS400Text( 5,as400),"CLAVE"); RecordFormat dataFormat_PR000 = new RecordFormat(); dataFormat_PR000.addFieldDescription(clave_PR000); // Formato PR001 register: Pedidos CharacterFieldDescription clave_PR001 = new CharacterFieldDescription(new AS400Text( 5,as400),"CLAVE"); CharacterFieldDescription npedid_PR001 = new CharacterFieldDescription(new AS400Text( 8,as400),"NPEDID"); CharacterFieldDescription ntres_PR001 = new CharacterFieldDescription(new AS400Text( 3,as400),"NTRES"); CharacterFieldDescription carti_PR001 = new CharacterFieldDescription(new AS400Text(15,as400),"CARTI"); CharacterFieldDescription qpiepd_PR001 = new CharacterFieldDescription(new AS400Text( 7,as400),"QPIEPD"); CharacterFieldDescription fecha_PR001 = new CharacterFieldDescription(new AS400Text( 8,as400),"FECHA"); CharacterFieldDescription cmerca_PR001 = new CharacterFieldDescription(new AS400Text( 1,as400),"CMERCA"); RecordFormat dataFormat_PR001 = new RecordFormat(); dataFormat_PR001.addFieldDescription(clave_PR001); dataFormat_PR001.addFieldDescription(npedid_PR001); dataFormat_PR001.addFieldDescription(ntres_PR001); dataFormat_PR001.addFieldDescription(carti_PR001); dataFormat_PR001.addFieldDescription(qpiepd_PR001); dataFormat_PR001.addFieldDescription(fecha_PR001); dataFormat_PR001.addFieldDescription(cmerca_PR001); // Formato PR002 register: Articulos CharacterFieldDescription clave_PR002 = new CharacterFieldDescription(new AS400Text( 5,as400),"CLAVE"); CharacterFieldDescription carti_PR002 = new CharacterFieldDescription(new AS400Text(15,as400),"CARTI"); CharacterFieldDescription darti_PR002 = new CharacterFieldDescription(new AS400Text(56,as400),"DARTI"); CharacterFieldDescription cfami_PR002 = new CharacterFieldDescription(new AS400Text( 3,as400),"CFAMI"); CharacterFieldDescription codean_PR002 = new CharacterFieldDescription(new AS400Text(13,as400),"CODEAN"); CharacterFieldDescription indica_PR002 = new CharacterFieldDescription(new AS400Text( 1,as400),"INDICA"); RecordFormat dataFormat_PR002 = new RecordFormat(); dataFormat_PR002.addFieldDescription(clave_PR002); dataFormat_PR002.addFieldDescription(carti_PR002); dataFormat_PR002.addFieldDescription(darti_PR002); dataFormat_PR002.addFieldDescription(cfami_PR002); dataFormat_PR002.addFieldDescription(codean_PR002); dataFormat_PR002.addFieldDescription(indica_PR002); // Formato PR003register: Colores CharacterFieldDescription clave_PR003 = new CharacterFieldDescription(new AS400Text( 5,as400),"CLAVE"); CharacterFieldDescription cencod_PR003 = new CharacterFieldDescription(new AS400Text( 1,as400),"CENCOD"); CharacterFieldDescription ccolor_PR003 = new CharacterFieldDescription(new AS400Text( 3,as400),"CCOLOR"); CharacterFieldDescription dcolor_PR003 = new CharacterFieldDescription(new AS400Text(30,as400),"DCOLOR"); CharacterFieldDescription indica_PR003 = new CharacterFieldDescription(new AS400Text( 1,as400),"INDICA"); RecordFormat dataFormat_PR003 = new RecordFormat(); dataFormat_PR003.addFieldDescription(clave_PR003); dataFormat_PR003.addFieldDescription(cencod_PR003); dataFormat_PR003.addFieldDescription(ccolor_PR003); dataFormat_PR003.addFieldDescription(dcolor_PR003); dataFormat_PR003.addFieldDescription(indica_PR003); // Queue definition DataQueue dq = new DataQueue(as400,"/QSYS.LIB/DALMAU.LIB/COLA.DTAQ"); boolean Continue = true; DataQueueEntry DQData = dq.read(-1); while (Continue) { Record data = dataFormat_PR000.getNewRecord(DQData.getData()); if (((String)data.getField("CLAVE")).equalsIgnoreCase ("PR001")) { data = dataFormat_PR001.getNewRecord(DQData.getData ()); System.out.println("PR001: Pedido=" +(String)data.getField("NPEDID") +" Linea="+(String)data.getField("NTRES") +" Articulo="+(String)data.getField("CARTI") +" Piezas="+new BigDecimal ((String)data.getField("QPIEPD")) +" Fecha="+(String)data.getField("FECHA") +" Mercado="+(String)data.getField("CMERCA")); } if (((String)data.getField("CLAVE")).equalsIgnoreCase ("PR002")) { data = dataFormat_PR002.getNewRecord(DQData.getData ()); System.out.println("PR002: Articulo=" +(String)data.getField("CARTI") +" Descripción="+(String)data.getField ("DARTI") +" Familia="+(String)data.getField("CFAMI") +" Código EAN="+(String)data.getField("CODEAN") +" Indica="+(String)data.getField("INDICA")); } if (((String)data.getField("CLAVE")).equalsIgnoreCase ("PR003")) { data = dataFormat_PR003.getNewRecord(DQData.getData ()); System.out.println("PR003: Centro=" +(String)data.getField("CENCOD") +" Color="+(String)data.getField("CCOLOR") +" Descripción="+(String)data.getField ("DCOLOR") +" Indica="+(String)data.getField("INDICA")); } DQData = dq.read(-1); } } catch (Exception e) { e.printStackTrace(); } as400.disconnectService(AS400.RECORDACCESS); System.exit(0); } "Devani, Shreya" <shreya.devani@sfs- To: "'Java Programming on and around the iSeries / AS400'" <java400-l@midran uk.com> ge.com> Sent by: cc: java400-l-bounces@m Subject: RE: starting JVM is slow idrange.com 13/01/2004 11:02 Please respond to Java Programming on and around the iSeries / AS400 Hi Albert Could you please send me the details. Much appreciated Shreya -----Original Message----- From: albert_dalmau@xxxxxxxx [mailto:albert_dalmau@xxxxxxxx] Sent: 13 January 2004 09:49 To: Java Programming on and around the iSeries / AS400 Subject: Re: starting JVM is slow Hi Ashish, As start JVM was slow I'm using Data Queues: JVM is always started and waiting for parameters from a data queue. When a Cobol or CL procedure need process something put the parameters in the Data Queue and the java program process it. If you need more details I can send to you. Albert. _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l. --------------------------------------------------------------------------------------------- Registered Office: Siemens Financial Services Limited (Tel: 020-8422 7101) 160 Northolt Rd, Harrow, Middlesex (Fax: 020-8422 4402) HA2 0PG Registered No: 646166, England Web:www.siemensfinancialservices.co.uk --------------------------------------------------------------------------------------------- *************************************************** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. *************************************************** _______________________________________________ This is the Java Programming on and around the iSeries / AS400 (JAVA400-L) mailing list To post a message email: JAVA400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/java400-l or email: JAVA400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/java400-l.
As an Amazon Associate we earn from qualifying purchases.
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.