Don’t you just love project change after you have a process working, NOT! Well I was somewhat prepared for a curve and I managed to overcome and adapt very quickly.
During the weekly status phone call with MIDRetail the question of the interfaces came up. I was very happy to report that the master file interfaces were complete and running automatically. How did I do this? I have iSeries programs scheduled to create the XML documents on the Windows share, created tasks in MIDRetail, created job in MIDRetail to contain the tasks and a schedule in MIDRetail. Works great so far.
Then the hammer drops, we do not recommend using our scheduler to process jobs; comes through the speakerphone. It is not robust enough and you need to create interfaces to read the status of the jobs that run on the MS Server. The IT Manager and myself have the understanding that we were not going to start the job on the MS server from the iSeries.
After the call I took a few minutes to think about the change and realized this is a great opportunity to try some Java code I stumbled on browsing the Net. MowYourLawn.com has the code and examples of RPG to Desktop using a Java applet on the MS server and a small amount of Java code on the iSeries. I have the Java toolbox available to me on the iSeries but the MS Windows 2008 R2 Server does not have the Java VM installed. Multifaceted challenges, I like it.
MOWYOURLAWN provides an in depth look at the innards of the Java and RPGLE code, I breezed through it just to get an idea of what is happening behind the scenes.
I installed Java on the MS Server and modified the batch file to starts the listener to point to our iSeries. Welcome to 2008 R2, you cannot save a file back to the same location. I had to save to desktop and then move the file to the desired folder replacing the current file. Don’t you just love the UAC?
I run the batch file and receive error, Can not find Javaw.exe xxxxxxxxxxxxx. Hmmmmm, it has been a while since I have worked on a MS server and it took me a few minutes to remember environment variables. A quick search of Goolge and I have the Path and JAVA_HOME statements to add to the environment variables. I screwed up and forgot to add space before (x86), also log out and in to have the path set.
I run the batch file and BAM, Java applet fires up and is listing for commands. Cool!
FTP the downloaded save file to the iSeries, restore the library and add library to my library list. Created a quick test CL and ran the CL. Flipped over to the MS Server, opened MIDRetail audit and find that the store file has been updated as programmed.
Success, what a great way to finish off the week!
A pessimist is one who makes difficulties of his opportunities and an optimist is one who makes opportunities of his difficulties. ~Harry Truman