|
This thread: http://archive.midrange.com/rpg400-l/200202/msg00206.html may be able to help you out. Also, you can do encryption and decryption in RPG using the CIPHER MI which is much faster than Java's methods. You need to have the Cryptographic Access Providers installed to do it. Scott Klement has an example of doing RC4 on his web site and there's an example of 128 bit AES in the archives (take a look at the entire thread since there's a bug in the posted code). The posted AES example doesn't use a salt value which is bad but that's easy to remedy and it also only handles one block (16 bytes) or clear text but that's also easy to remedy. Matt -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of venkatreddy puram Sent: Wednesday, January 18, 2006 11:11 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Error Calling Java Methods from RPGLE Hi Matt/David, Thank You for your responses... David, I was not able to direct the error output to stdout and stderr even after creating the source PF and overriding to it. Matt, In order to isolate that the error is not occuring in the custom java app, I codded the following simple lines and ran it as I had a strong belief that the error was occuring the Java Native interface... According to the dump the program fails when the "number" reaches 349521 Here is the code ============================================================ H Debug Option(*NoDebugIO) Thread(*Serialize) DFTACTGRP(*no) D SrvProvider S 20 Inz('SampleProvider') D User_Name S 20 Inz('username') D Pass_Word S 20 Inz('password') D AlgID S 32 Inz('88') D KeyID S 64 Inz('KKK-SPS890') D EncryptedStr S 32 D Number S 7 0 // Definition of Java constructor for the String class D StringC PR O ExtProc(*JAVA: D 'java.lang.String': D *CONSTRUCTOR) D 65535A Const Varying D Provider S O CLASS(*JAVA : 'java.lang.String' ) D User S O CLASS(*JAVA : 'java.lang.String' ) D Password S O CLASS(*JAVA : 'java.lang.String' ) D J_AlgID S O CLASS(*JAVA : 'java.lang.String' ) D J_KeyID S O CLASS(*JAVA : 'java.lang.String' ) D J_EncryptedStr S O CLASS(*JAVA : 'java.lang.String' ) //========================================================== // Mainline //========================================================== /Free //Start of MainLine Monitor; num = 0; EncryptedStr = 'yxJd9n2nYeA4Sh3zya0UrGS0G+W09pNVC4yW1BsGI6s='; Dou number = 350000 ; Provider = StringC(%Trim(SrvProvider)); User = StringC(%Trim(User_Name)); PassWord = StringC(%Trim(Pass_Word)); J_AlgID = StringC(%Trim(AlgID)); J_KeyID = StringC(%Trim(KeyID)); J_EncryptedStr = StringC(%Trim(EncryptedStr)); number += 1; EndDo; On-Error; Dump; EndMon; Return; =========================================================== VENKAT REDDY 3. Re: Error Calling Java Methods from RPGLE (venkatreddy puram) 4. Re: Error Calling Java Methods from RPGLE (David Gibbs) 5. RE: Error Calling Java Methods from RPGLE (Matt.Haas@xxxxxxxxxxx) ------------------------------ message: 3 date: Wed, 18 Jan 2006 10:45:56 -0800 from: "venkatreddy puram" <purumvenkat@xxxxxxxxxxx> subject: Re: Error Calling Java Methods from RPGLE David, Thank you for the response... I tried directing the output to stderr.txt and strout.txt. The files did get created but at the end of job failure there was nothing written to it. Is there enythig else that i should have set up... Here are the environment variables that I have set before running the program... RMVENVVAR ENVVAR(*all) LEVEL(*JOB) CHGCURDIR DIR('/') ADDENVVAR ENVVAR(PATH) + VALUE('/qibm/ProdData/java400/jdk15/bin:/us+ r/bin:') ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) + VALUE('-Djava.version=1.5!-Dos400.stdout=fi+ le:/home/VReddy/stdout.txt!-Dos400.stderr=f+ ile:/home/VReddy/stderr.txt!') ADDENVVAR ENVVAR(CLASSPATH) + VALUE('qibm/UserData:/qibm/proddata/java400+ /jdk15/bin:/QIBM/ProdData/Java400/jdk15/lib+ /security:/qibm/UserData/java400/systest:/q+ ibm/UserData/java400/uat:/qibm/UserData/jav+ a400/prod:/qibm/UserData/java400/prod/ext/l+ og4j.jar:/qibm/UserData/java400/prod/ext/xa+ lan.jar:/qibm/UserData/java400/prod/ext/xer+ cesImpl.jar:/qibm/UserData/java400/prod/ext+ /NetComponents.jar:/qibm/UserData/java400/p+ rod/ext/optional.jar:/qibm/UserData/java400+ /prod/ext/xml-apis.jar:/QIBM/ProdData/Java4+ 00/jdk15/lib/ext') Thank You Venkat Reddy ------------------------------ message: 4 date: Wed, 18 Jan 2006 12:48:49 -0600 from: David Gibbs <david@xxxxxxxxxxxx> subject: Re: Error Calling Java Methods from RPGLE venkatreddy puram wrote: > ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) + > VALUE('-Djava.version=1.5!-Dos400.stdout=fi+ > le:/home/VReddy/stdout.txt!-Dos400.stderr=f+ > ile:/home/VReddy/stderr.txt!') I generally use OVRDBF to redirect stdout & stderr to a source pf. CRTSRCPF FILE(QTEMP/STDOUT) MBR(STDOUT) CRTSRCPF FILE(QTEMP/STDERR) MBR(STDERR) OVRDBF FILE(STDOUT) TOFILE(QTEMP/STDOUT) OVRSCOPE(*JOB) OVRDBF FILE(STDERR) TOFILE(QTEMP/STDERR) OVRSCOPE(*JOB) david ------------------------------ message: 5 date: Wed, 18 Jan 2006 13:56:34 -0500 from: <Matt.Haas@xxxxxxxxxxx> subject: RE: Error Calling Java Methods from RPGLE Ventak, You may be running into a poorly written Java app that doesn't print out a stack trace when it gets an error. If that's the case, you'll have to get the Java app changed so this happens. Matt -----Original Message----- From: rpg400-l-bounces@xxxxxxxxxxxx [mailto:rpg400-l-bounces@xxxxxxxxxxxx] On Behalf Of venkatreddy puram Sent: Wednesday, January 18, 2006 1:46 PM To: rpg400-l@xxxxxxxxxxxx Subject: Re: Error Calling Java Methods from RPGLE David, Thank you for the response... I tried directing the output to stderr.txt and strout.txt. The files did get created but at the end of job failure there was nothing written to it. Is there enythig else that i should have set up... Here are the environment variables that I have set before running the program... RMVENVVAR ENVVAR(*all) LEVEL(*JOB) CHGCURDIR DIR('/') ADDENVVAR ENVVAR(PATH) + VALUE('/qibm/ProdData/java400/jdk15/bin:/us+ r/bin:') ADDENVVAR ENVVAR(QIBM_RPG_JAVA_PROPERTIES) + VALUE('-Djava.version=1.5!-Dos400.stdout=fi+ le:/home/VReddy/stdout.txt!-Dos400.stderr=f+ ile:/home/VReddy/stderr.txt!') ADDENVVAR ENVVAR(CLASSPATH) + VALUE('qibm/UserData:/qibm/proddata/java400+ /jdk15/bin:/QIBM/ProdData/Java400/jdk15/lib+ /security:/qibm/UserData/java400/systest:/q+ ibm/UserData/java400/uat:/qibm/UserData/jav+ a400/prod:/qibm/UserData/java400/prod/ext/l+ og4j.jar:/qibm/UserData/java400/prod/ext/xa+ lan.jar:/qibm/UserData/java400/prod/ext/xer+ cesImpl.jar:/qibm/UserData/java400/prod/ext+ /NetComponents.jar:/qibm/UserData/java400/p+ rod/ext/optional.jar:/qibm/UserData/java400+ /prod/ext/xml-apis.jar:/QIBM/ProdData/Java4+ 00/jdk15/lib/ext') Thank You Venkat Reddy -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-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.