Showing posts with label #powerruby. Show all posts
Showing posts with label #powerruby. Show all posts

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


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