Wednesday, December 17, 2014

Web service call from SQLRPGLE

Yesterdays challenge is to replace a scheduled timed event with a dynamic process. Give's us an opportunity to try REST from RPGLE using new SYSTOOLS HTTPGETCLOB.

The program is simple and just prompts the Web programming to capture funds and invoice order in ERP backend. Responds with OK and if not send me an E-mail.

Very cool and once I managed to get all the special chatters in the right place works great. This can also be done in a CLLE with RUNSQL command and CREATE TABLE AS. I initially blew it in CLLE and reported to IBM could not get it working. They came back a few days later, right after I got RPGLE version working, and informed me that '+' continuation line character had a space before and that was causing SQL to fail with SQLSTT 38000. DUH!

The next step is a SOAP message so we can trade data between web and back end ERP.

I wish I had the time to learn PowerRuby. I believe I can do this with Ruby as well.

My next endeavor is JSON to link back end VAI ERP to DESK.COM. Again I think PowerRuby can help and really need to figure out how to get there.

//******************Begin sub-routines*******************************
       //********************************************************************
       // Run web service and check response
       //********************************************************************

       begsr xxxx;

       // Change Job CCSID to 37
       CmdStr = 'CHGJOB CCSID(37)';
       callp(e) ExcCmd(%trim(CmdStr) : %len(%trim(CmdStr)));

       // Call Web Service Action=doInvoicing
       Exec SQL
            SELECT data into :m_data FROM
                   (VALUES(SYSTOOLS.HTTPGETCLOB
                   ('http://xxxxxx.xxxxxxxx.com/xxx/+
                   xxxxxxx.cfm?action=doinvoicing',+
                   '<httpHeader connectTimeout="10000"> +
                   </httpHeader>'))) WS(data);

       // Change Job CCSID to system default
       CmdStr = 'CHGJOB CCSID(65535)';
       callp(e) ExcCmd(%trim(CmdStr) : %len(%trim(CmdStr)));

       // If Web service response not OK - send Email
       if m_data <> 'OK';
        exsr email_err;
       EndIf;

       endsr;

        //********************************************************************
        // Send email if failed to get response from Web
        //********************************************************************

       begsr email_err;
        // Build send email command                                                 
         CmdStr = 'SNDMAIL RECIPIENT((RICHARD xxxxxxxx@xxxxxxxx.COM))';
         CmdStr = %trim(CmdStr) + ' SENDER(QCAPIBMI xxxxxx@xxxxxxxxx.COM)';
         CmdStr = %trim(CmdStr) + ' SUBJECT(' + Quote + 'PO Receipt processed';
         CmdStr = %trim(CmdStr) + ' ***Web Capture funds not processed ***';
         CmdStr = %trim(CmdStr) + Quote + ') MESSAGE(' + Quote;
         CmdStr = %trim(CmdStr) + 'EDIARDSCF failed to receive response OK';
         CmdStr = %trim(CmdStr) + ' *** Contact WEB ***';
         CmdStr = %trim(CmdStr) + Quote + ')';

       // Send email                                                               

       callp(e) ExcCmd(%trim(CmdStr) : %len(%trim(CmdStr)));

       EndSr;




~Richard

One man's crappy software is another man's full time job. ~Jessica Gaston, 2008


Monday, December 8, 2014

Microsoft Virtual PC..Oh what fun it is to ride...

My current challenge is connecting to a customers Sonicwall with GVC client. I already have one connection using GVC. I have been supplied with full GVC installer and it's a couple of versions behind what I currently have installed. Rather than take a chance of corrupting my current setup I find it's time to set up a virtual machine. 

I started with MS Virtual PC and it has been a real challenge to get running. In the end the challenge was my lack of knowledge on what OS is supported in MS Virtual PC.

I downloaded MS Virtual PC and install went easy enough but from there the road became bumpy.  My PC is running Windows 7 Home Premium and I am suspicious is not playing with MS Virtual PC very well. I finally found an article listing compatibility and even though shows yes the foot note states no integration with host. The interface was choppy with video issues and response time not good.

Now my direction is changed to "How to upgrade MS Home Premium to Windows 7 Pro?". I found Windows Anytime Upgrade web page and followed my nose from there. 

My host PC upgraded flawlessly in about 15 minutes. $89.00 poorer, four hours of research and I am now running Windows 7 Pro on desktop. 

I then turned my attention to VM I set up based on Home Premium. Like a dummy I deleted the VM file when I found was not going to fully work. I found the deleted VM in recycle bin and restored with one mouse click. 

The real pain in setting up VM is all the MS updates that have to be applied. My host machine is up to date so did not need MS updates installed. The guest is a different story. I built it from my original Home Premium DVD. It took a couple of hours and several reboots before it was up to date. Honestly not sure how long since I let go by itself periodically visiting PC during the day while I did some household chores.

At this point I am not sure how Windows Anytime Upgrade will work with a VM. One of the initial options is "do you have key", yes I do and I pumped it in  and installer took off. After about 15 minutes VM rebooted and displayed "Failed to install upgrade". Bummer. 

Thought about it for a minute and stated don't you know who I am? I started the process over and this time I got ......


This is bad to the bone. I have access to host PC drives through integration feature which is now working flawlessly. So far I have installed Chrome, IBMi Access and Sonic Wall GVC. Connected to client site with no problem!

And now for my next trick....install and upgrade PTF's for V6R1 IBMi model 550 with three partitions via HMC remotely.

Have you best day!

~Richard

Success seems to be largely a matter of hanging on after others have let go. ~William Feather


  
   

Wednesday, December 3, 2014

As the wind blows...

My PowerRuby ambitions are forced to take a back seat for a while. Work that pays is new focus with planning for IBM I5/550 OS PTF update on three partitions and iTERA HA. Includes HMC update as well.

Also planning for new IBMi Power8 install and migration from Power6 box. The old Power6 running since 2007 only had a few problems resulting limited down time. Battery cache and one drive went bad but we never missed a beat. An unused controller card failed last week and we decided to just vary it off. Ran 24/7 with automatic IPL monthly and limited operator intervention (me). I almost finished converting nightly tape to the cloud. Need just a wee bit more disk since I have no dedup software. The new box more that doubles disk. Got to love it.

Hopefully get back to PowerRuby after x-mas. It's all loaded and ready to go. I need to update with latest PTF cumulative and groups for this box.

My first challenge is adding VPN connection to my already crowded PC. Thank fully it's Sonic Wall and unfortunately I currently only have access the the full install client with new connection parameters embedded. I do not want to take a chance and install two on same machine/OS.

Time for MS Virtual PC. Downloaded from MS and ran install and get to 93%, BAM, "Installed failed reverting configuration".  I am getting 0x80004005 error code. Can not have more than 13 interfaces, who knew? I dig into regedit and find one of the interfaces is Shrewsoft. Ha, don't need that. Uninstalled Shrewsoft and checked registry entry and find it's gone and now there are 12 interfaces.

Run MS .msi and SUCCESS! It's been a long day I'll figure out how to use it tomorrow night.

~Richard

I may not be there yet, but I'm closer than I was yesterday. ~Author Unknown



Monday, December 1, 2014

PowerRuby....installation

Over Thanksgiving weekend, while wife not watching, I downloaded PowerRuby to PC. Took a while for little over 200mb to download. Took even longer to upload to IBMi.

I discovered that IBM 5733SC1 - IBM Portable Utilities for i5/OS was not installed. Lucky for me complete OS image is stored in IFS, it's nice to have plenty of disk. 

I really like Virtual optical drive and image catalogs. Here is a good article explaining image catalogs and how to setup and use. Peace of cake -

WRKIMGCLG on command line....

Select option 12, Work with Entries....

Once DVD-ISO image is mounted select F12 and return back to work with Image Catalogs..


All you need to do now is option 8 Load.

Virtual Optical drive OPTVRT01 is now ready to use to restore licensed program.

THE IBM* PORTABLE UTILITIES FOR i5/OS* consists of a *BASE and Option 1. Both must be installed with CL commands similar to these:

RSTLICPGM LICPGM(5733SC1) DEV(OPTxx) OPTION(*BASE) RSTOBJ(*ALL) LNG(2924)

RSTLICPGM LICPGM(5733SC1) DEV(OPTxx) OPTION(1)RSTOBJ(*PGM)  

No issues, RSTLICPGM, like other steps took longer than expected. I think all told about 15 minutes.

I do need to go and get all the IBM PTF's to complete the install but that will have to wait till this coming weekend. I run full PTF update twice a year and am overdue for second update. Major rule I have is not to install PTF's on a month end weekend. Been there and got bite on ass to prove it.

Oh yeah, this is about PowerRuby.....

At this point I uploaded to IBMi following PowerRuby instuctions

No issues and went smoothly. I now have PowerRuby installed and ready for my first new rails app from scratch....

Unfortunately will have to wait. I have a bunch of side work including replacing daily tape backup with save to cloud (Carbonite) and possible V5R4 upgrade.


~Richard

When you catch bugs early, you also get fewer compound bugs. Compound bugs are two separate bugs that interact: you trip going downstairs, and when you reach for the handrail it comes off in your hand. ~Paul Graham, "The Other Road Ahead," 2001