This movie requires Flash Player 9

IBMi where i really does stand for integration…

We have been running 3 separate IBM i systems for a number of years now so that we could test the products we develop and provide some level of recovery should one of the systems have a failure. We also run a number of Linux based systems which we have used for virtualization projects and development of the PHP websites we run as well as Windows desktops and Servers. As you can imagine that burns up not only a lot of power but a lot of time to manage each of the separate environments and keep each one up to date with fixes and software patches.

Previously we never felt we had an IBMi system that could handle a Virtualized environment so we never attempted to put one in place and just kept replacing the existing systems as needed. At the end of last year we looked at getting one of the new Power7 systems to replace the old iSeries (520) we have and use it to build our dream setup of multiple partitions running on a single footprint. Unfortunately we felt IBM’s pricing policy (we pay 30% more than our US cousins for the same system due to IBM’s pricing policy for Canada. They are not the only ones that do it either as we found out so any tech solution from US base providers costs you more in Canada than it does in the US.) was out of touch with reality with the Loonie now being on par if not higher than the greenback.. So we decided to take an alternative route, after some discussion with a close friend and hardware guru we decided to beef up our existing 8203-E4A Power6 system and test out what the performance would be in a virtualized environment.

First thing we needed to do was to decide whether to run this under a HMC or go for the new Power VM Virtualization method. The Power VM seemed like a suitable option but we wanted to gain some experience with HMC and the restriction of the number of LPAR’s you could create under Power VM plus micro partitioning of the CPU sealed the deal. This meant we had to order a new copy of the PowerVM standard edition, we also added AIX Version 7 and a 3 year SWMA for each of the products. Next we needed to order a HMC and some additional disks (4 x 140GB), a Raid controller and more memory (additional 4 GB), we looked at IBM but again found the pricing to be too high for us to make it worth our while. So we found a HMC on eBay and ordered disk, Raid controller and memory for an IBM business partner in Europe (Yes it was far cheaper to order and pay delivery from Europe than to order in North America).

Once the disk and memory was installed and configured with the new Raid capabilities we set up the HMC and made it the console for all of our existing systems which replaced the old LAN console technology we had been using. All we needed now was the software to allow us to partition the systems CPU, this was where the fun started.
We placed the order before the Christmas break for all of the software in the hopes of being able to download the software and get started while there wasn’t much customer activity in the expectation it would be a pretty simple affair. 6 weeks later and we still don’t have the software. Some of that is due to our request to download the software originally but after seeing that the download was over 70GB we decided it was too much and would be far quicker to order the media. That was after it took IBM nearly a month just to get the downloads to show up on our entitlement page. Then IBM said it would take a week to deliver the media which came and went with only an update being delivered and not the actual based installation media! I have to say the invoicing department is on the ball though as we did get the invoices almost as soon as the orders were placed.

This did not stop us from doing anything though, we were installing IBMi and SuSe Linux on the system as well so we could moved ahead with that while IBM sorts out the other issues. The SuSe Linux media was easily obtained and downloaded and we already have copies of the IBMi software so we moved ahead and installed those first. The next post will be about the experiences we had while installing each of those LAPR’s and some of the problems we stumbled across especially with the lack of clear and understandable documentation for installing guest partitions under IBMi.

Hope fully IBM will get us the AIX software before we write about the other installs, but I have to say my fears about the performance hit the partitioning would have on the work we carry out was totally unfounded, it even seems to run better now than it did before and the guest partition that replaced an old 515 system is definitely faster than we could have hoped for. The older 520 and 515 will still be around as they will be our recovery systems should anything happen to the new setup but they are powered down and off line for now.

So this post started off with the heading of “IBMi where i really does stand for integration” and I am going to say we are very happy with the results so far, we do have integrated the work of 4 systems into one and seen no detrimental performance issues so far. Once we have AIX we will have our dream system all under one roof.

Chris…

Leave a Comment

New support forum for Easycom and iAMP server.

A new support forum has been created for the i5_toolkit and the new iAMP server. Th forums will be monitored by the Aura Technical team as well as the community at large. This will hopefully provide a better resource for those users of the i5 toolkit functions and help with further integration of PHP on the IBMi. If you would like a higher level of support we will be offering a support subscription service through Shield Advanced Services Ltd.

The forums can be found here

Look forward to seeing you on the forums.

Chris…

Leave a Comment

New Apache, MySQL PHP stack for IBMi called iAMP Server

Aura Equipments of France has just announced a new Apache, MySQL and PHP stack for the IBMi, the new stack has been compiled from standard open source code and is available for free download from the Aura website .

iAMP server is a fully integrated stack which runs in the PASE environment on IBMi, this means the standard Apache Server is also running in the PASE environment allowing a close connection between it and the extensions and modules provided by other parties. While you still have the option of connecting to the IBM HTTP server via a FASTCGI port you now have the option of running the entire stack in the PASE environment. Why is this important you may ask, well one of the reasons for the new stack is a growing concerns from a number of IBMi users about the slow introduction of some of the newer Apache releases on the IBMi with its Powered by Apache server. IBMi does a very good job of making the security releases available but sometimes lacks the additional features Apache provides especially in the earlier version of iOS.

Aura have built the entire stack from the freely available open source code, this means it follows the standards you will find in many of the other AMP Stacks out there for Linux and Windows. If you have your own modules you can add them to the stack in the same way as you can with other Linux and Windows stacks without any problems. Many of the restrictions found where proprietary modules are included with a stack do not exist in the iAMP server, everything is from the open source community and will work with any other modules they provide. While this release of iAMP server does not have every module available, it does have the main ones that are used by most shops. As more modules are compiled they will be added to the stack by Aura and will be supported in the same manner as the existing modules. If there is a module which is not provided and you need it before Aura gets round to making it available you have the ability to add the module yourself or may even find a compatible binary elsewhere, that’s the beauty of having a standards based open source stack.

Shield Advanced solutions will provide support for the iAMP server for North America via a fee based support contract or on a consultancy basis if required. Free community based support will be available via forums which will be dedicated to the iAMP server which is just as you get with any other AMP stack available on Linux or Windows.

One item we need to clarify is the inclusion of the i5_toolkit, this is a proprietary solution from Aura equipments and is not shipped as part of the iAMP stack. The original i5_toolkit which shipped with the Zend product will still be available to the users of the Zend product and you can update the version using the downloads available from the Aura Equipments website. However this version of the toolkit only accepts requests from the local server (Zend HTTP Server) and cannot be accessed from remote HTTP servers. Aura will continue to support the users of the i5_toolkit for FREE using the forums which are to be setup for this purpose. However for a small fee you can upgrade that support to premium level which will entitle you to full technical support from the Aura support team. Anyone who has registered with Aura will be receiving a notification which will include a special reduced rate for support for the i5_toolkit and the iAMP server. If you have not registered your copy of Easycom with Aura now would be a good time to do it!

Any new customer which requires the i5_toolkit will be offered full support for the toolkit PLUS the iAMP server for a single price, this offer will be especially important for the smaller customer who needs support for their entire stack not just the i5_toolkit. The FREE support will still be available via the forums and will be monitored by the Aura tech support team.

iAMP is a new alternative and one which customers should look into, the support costs and level of technical support you will get should make this an easy decision if you are looking at developing a web based interface to your IBMi data and objects.

If you would like to see a demo of the iAMP server in action or have any questions please feel free to contact us, this is a major step in bringing a standards based alternative AMP stack to the IBMi.

Chris…

Leave a Comment

Fetching LOB Data in DB2


We have recently had to look at the LOB data contained within a database while working with a prospect and having never done this before thought we would share the experience. The prospect has a large number of LOB fields in their database and is looking at the Easycom server as a possible solution so they asked us to help resolve a couple of issues they were having.

There first problem was the query would return no data at all, this was because they did not set the commitment control level as we had mentioned previously when we did the tests for the Display_Journal UDTF, that was a pretty easy fix and after a slight change to their code the query would run and the data would be returned to the script. That is all except for the content of the LOB columns, this would just return a garbled value or end the data display at that point. This is because the data returned by the query for an LOB column is just a pointer to the actual data which can be stored outside of the database. So we then had to run the i5_getblob() function to get the content of the LOB column. Unfortunately the sample code was wrong in the documentation so a call into Aura support put us back on the right track and we can now retrieve the LOB data without any problems. As it turns out the prototype for the function call is correct but the sample code is not.

Here is the test we set up to test the LOB support in Easycom. First we created a file with LOB columns defined, we did have a slight problem because the default journal was not defined in our library but after building the journal manually and journaling the file we saw no other issues. I created this in a STRSQL session I notice that as soon as the first file was journaled in the library consequent creates did not return the same journal issue?


CREATE TABLE CHLIB/TEST (
USERNAME VARCHAR(100) DEFAULT NULL ,
SYSNAME VARCHAR(255) DEFAULT NULL ,
TITLE VARCHAR(100) DEFAULT NULL ,
TEST_VALUE CLOB(1048576) DEFAULT NULL ,
ID NUMERIC(5, 0) DEFAULT NULL ,
YEAR NUMERIC(4, 0) DEFAULT NULL ,
TEMP_ID BIGINT DEFAULT NULL ,
TEST_VARCHAR VARCHAR(5000) DEFAULT NULL )

Next we just wanted to insert a single record so it could be tested. Again I used a STRSQL session to insert the record using this request.

INSERT INTO CHLIB/TEST
(username,sysname,title,test_value,test_varchar) VALUES
('admin1','shield3','boss','some clob text','Some varchar text')

I have a test page that I use for all of my tests that requires a signon to be carried out first and then call what ever functions I am testing. This is the function I wrote to test the LOB data returned.


function get_lob(&$conn) {
// set the transaction level for lob's
if(!i5_transaction(I5_ISOLEVEL_CHG, $conn)) {
echo("Failed to set transaction level CHG");
}
// build the query
$query = "SELECT TITLE,TEST_VALUE,SYSNAME FROM CHLIB/TEST";
// get the record
$result = i5_query($query,$conn);
if(!$result){
echo("Failed to get the data
" .$query);
$_SESSION['ErrMsg'] = "Error code: " .i5_errno($result) ." Error message: " .i5_errormsg($result);
}
$rec = i5_fetch_assoc($result);
// dump out the record data
var_dump($rec);
// get the LOB data and show
$lob_data = i5_getblob($result, 'TEST_VALUE');
echo("
LOB Data = " .$lob_data ."
");
// need to roll back to allow the transaction to be closed
i5_rollback($conn);
// close the transaction
if(!i5_transaction(I5_ISOLEVEL_NONE, $conn)) {
echo("Failed to set transaction level NONE");
}
// free the resources
i5_free_query($query);
}

Here is the output of the above

array(3) { ["TITLE"]=> string(4) “boss” ["TEST_VALUE"]=> int(256) ["SYSNAME"]=> string(7) “shield3″ }
Blob Data = some clob text

As you can see the dump of the $rec variable shows an int(256), if you ran the query in a STRSQL session you would see *POINTER for the data in this field, iNavigator SQL will resolve the pointer automatically and display the actual data immediately. Running the i5_getblob() function correctly returns the content of the pointer, you should note that you do not need to pass in $rec['TEST_VALUE'] just ‘TEST_VALUE’ for the function to work correctly.

And that was our first foray into LOB columns in DB2… Hope you found some useful information from this.

Happy PHP’ing

Chris…

Leave a Comment

Simple PHP scripts to display a List of spool files and their content

As part of the development of the JobQGenie PHP interface we needed to be able to display a list of the spool files which are generated for the job queue reload process. The i5_toolkit functions have the ability to provide all of the information we needed, you could achieve the same with the new XMLSERVICE function as well but that will require you build all of the underlying functions yourself which requires a lot more effort and skill.

We just wanted to display a list of the spool files for the current user and then have a link to another page which would display the content of the spool file. Once you understand the calls we have used you can change the code to refine the list and display just a few spool files you are interested in, but for the purposes of this exercise *CURRENT was all we needed to use. The following is the very simple code we developed, the connection and the sign-on processes are not shown but use the same code we have posted previously. You will also notice that we did not show all of the returned information from the i5_spool_list_read() function as we did not need to display or use it. If you want to know all of the data which is returned a simple var_dump() will show you.


function get_spl_list(&$conn) {

// get a list of the spool files for the current user
$HdlSpl = i5_spool_list(array(I5_USERNAME=>"*CURRENT"));
if(is_bool($HdlSpl)){
$ret = i5_errno();
print_r($ret);
}
echo("<table border=1><tr><td><label>Job Name</label></td><td><label>User Name</label></td><td><label>Job Number</label></td><td><label>Splf Number</label></td>
<td><label>OutQ Name</label></td><td><label>Pages</label></td><td><label>Spool File Size</label></td><td><label>Action</label></td></tr> ");
// read the list and display to the user
while ($ret = i5_spool_list_read($HdlSpl)){
// build the request string
$url = "dspsplf.php?name=" .urlencode($ret['SPLFNAME']) ."&jobname=" .urlencode($ret['JOBNAME']) ."&user=" .urlencode($ret['USERNAME']) ."&jobnum="
.urlencode($ret['JOBNBR']) ."&splnbr=" .urlencode($ret['SPLFNBR']);
// encode the string
$newurl = urlencode($url);
echo("<tr><td>" .$ret['JOBNAME'] ."</td><td>" .$ret['USERNAME'] ."</td><td>" .$ret['JOBNBR'] ."</td><td>" .$ret['SPLFNBR'] ."</td><td>" .$ret['OUTQLIB'] ."/" .$ret['OUTQNAME']
."</td><td>" .$ret['PAGES'] ."</td><td>" .round((($ret['SPLFSIZE']*$ret['SPLFMULT'])/1024),2) ."KB</td>
<td><a href=\"" .$url ."\" target=_blank>Display</a></td></tr>");
}
echo("</table>");
$ret = i5_spool_list_close($HdlSpl);
return 1;
}

In the above code we built a table of the spool files plus added a link to call another page which will display the content of the spool file. The output is pretty simple and has no real formatting applied, I am sure you can make this look a lot better with a bit of color and formatting, but for our purposes this will suffice for now.

One thing we had to do is encode the url to the new page, we found that some of our IBMi jobnames had a character which the browsers did not like (‘#’) I am sure there are others but his one caused us a few scratch the head moments. Initially the browser would drop everything after the ‘#’ from the $_REQUEST variable stack so we tried various endcoding of the url. If we built and encoded the entire url in a single request the browser would fail to display the content because of a repeating error, yet encoding each parameter separately allowed the request to be correctly interpreted. We are not sure why this occurs but the above solution does work so we will leave that investigation for a later time.

Here is an image of the output from our test.

Spool File List

Spool File List

Once we have the list all we wanted to do is display the data in the spool file, you could decide to move the spool file or delete it etc. but this exercise simply being able to view the data was sufficient. The i5_spool_get_data() function can be used to write the data to a file in the IFS or provide the data back to the caller as a string. We decided to take the data as a string and format the string onto the page so we did not look at the format of the output generated in the IFS file. We also converted the line return characters so the output displayed correctly in the browser, but I am sure there are other character strings which would need converting in some of the application driven spool files out there such as link transations etc. Here is the code which retrieves the spool file data and displays it to the screen.


function dsp_splf_dta(&$conn,$name,$jobname,$jobnum,$user,$splnbr,$br) {

$order = array("\r\n", "\n", "\r");
$replace = '<br />';

// Processes \r\n's first so they aren't converted twice.

$str = i5_spool_get_data($name,$jobname,$user,$jobnum,$splnbr);
$newstr = str_replace($order, $replace, $str);
echo($newstr);
return 1;
}

We have cut down the size of the data shown just to keep the size of the images to a minimum, but the entire content of the spool file is displayed to the user. Here is a sample of the output using the above code.

Spoll File data

Spool File Data

And that is all there is to it, less than 30 lines of code and you have a solution which will display all of the spool files and allow their content to be displayed.
The documentation needs an update as the order of the parameters to pass for the i5_spool_get_data() is wrong, Aura will update the documentation soon so use the following as a guide for calling the function:

string i5_spool_get_data (string spool_name,
string jobname,
string username,
int job_number,
int spool_id[, string filename] )
note: the [, string filename] denotes that the parameter is optional, if you pass in a file name the file will be used for the output from the call.

if you would like to look closer at the PHP interface capabilities we are developing or have an idea on what it can do for your own applications let us know, we are still surprised at how quickly we can turn old 5250 interfaces into browser views with a minimal amount of code and no changes to the underlying business logic.

Chris…

Comments (1)

Problem with db2_fetch_both() and DISPLAY_JOURNAL table function

In a previous post we mentioned that we had problems with the new DISPLAY_JOURNAL table function shipped in a recent DB2 update PTF for IBMi. We found the reason for that problem was a requirement to add commitment control around the SQL request due to CLOB data being returned. A working example of that code can be found here

We are now trying to get the same output using the db2_exec() function and the db2_fetch_both() function. Here is the updated code which should return the same data we are able to retrieve using the i5_toolkit functions.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type></HEAD>
<BODY>
<?php
// connect to the i5
$options = array("i5_lib"=>"chlib","cursor"=>DB2_SCROLLABLE,"autocommit"=>DB2_AUTOCOMMIT_ON);
$conn = db2_connect("","","",$options);
if (is_bool ( $conn ) && $conn == FALSE) {
	die ( "No Connection ");
	}
$ac = db2_autocommit($conn);
if ($ac == 0) {
    print "$ac -- AUTOCOMMIT is off.";
} else {
    print "$ac -- AUTOCOMMIT is on.";
}
$query = "SELECT *
              FROM table(
                DISPLAY_JOURNAL('HA4IJRN',
                              'HA4IJRN',
                               '',
                               '',
                               CAST(null as TIMESTAMP),
                               CAST(null as DECIMAL(21,0)),
                               '',
                               '',
                               '',
                               '',
                               '',
                               '',
                               '',
                               '',
                               '')
                       ) as X";
echo($query);
$result = db2_exec($conn,$query);
if(!$result) {
   die("Query failed ");
   }
$row = db2_fetch_both($result);
echo("Dumping the data");
var_dump($row);
db2_free_result($result);
db2_close($conn);
?>
</table>
</BODY>
</HTML>

Here is the output we get when the above script is run directly in the IBMi (The Easycom toolkit does not support db2_functions so it has to be run under the Zend Server, something that could change in the future?).

1 — AUTOCOMMIT is on.SELECT * FROM table( DISPLAY_JOURNAL(‘HA4IJRN’, ‘HA4IJRN’, ”, ”, CAST(null as TIMESTAMP), CAST(null as DECIMAL(21,0)), ”, ”, ”, ”, ”, ”, ”, ”, ”) ) as XDumping the databool(false)

This shows that the commitment control is set to on and the query runs OK, we just cannot get the data back using the db2_fetch_both() function? when we look into the logs we find the following.

[21-Dec-2011 16:34:44] PHP Warning: db2_fetch_both() [function.db2-fetch-both]: Fetch Failure in /www/phpproj/htdocs/db2test1.php on line 41

This is stating the function was unable to return the data due to a failure but no reason code for the failure? Its only a warning as well so why it fails is a mystery. I have trawled through all of the logs I can find with no success? I know this code is maintained by IBM and is shipped as part of Zend Server, but not sure if Zend would actually know what the problem is or if IBM should be approached? I did try all of the other db2_fetch functions against the result and they have the same issue. $result is set to true so the query should have worked, its just not returning the data for some reason. If I take the output above and start an SQL interactive session on the IBMi and run it it returns all of the data as expected. I also tried to turn off the auto commit but that did not work? Has anyone else managed to get this working other than in the i5_query function as I have shown in the previous post? I have also posted this problem on the IBM Developer forums just in case IBM or anyone else has any input to add.

If you have any input let me know.

Chris…

Leave a Comment

Preparing for new System setup

We are busy installing new disks and a Raid control on our 8203-E4A in readiness for partitioning up the system. Out aim is to develop an environment we can use to demonstrate the products we sell and how the IBMi can be used in a virtualized setting.

The system will have 1TB of disk which is a big jump from our existing 280GB which is going to help in allowing us to carve out a number of virtual partitions. Unfortunately we did not get a new Power7 this year so we are going to be sticking with our Power6 for the immediate future, if IBM decides to play ball on the pricing that could change but not today.. Still that’s another discussion, we have also installed a new HMC (that is the first one we have ever had and I must say its turning out to be a good investment) and added raid to the disks. We felt that having all of our environments running on a single system needed a bit more resilience than the famous availability of the Power Systems, so Raid was an important investment.

Our plan is to have 3 partitions on the IBMi, the first partition will be our source HA system with another partition being allocated as the target. The last partition will be a Linux partition that will be running Suse Enterprise. The Suse partition is important to allow us to set up a Linux server to server all of the websites that we develop plus provide the web interfaces for our products running in the other partitions. Today we have a Linux standalone server and Windows server running the development websites which allows us to demonstrate our in-house products and tests, once the Suse partition is set up we will migrate the setups to it and tear down the other setups.

The system is currently striping the disks in readiness to add to the ASP before we carve it up. I am told it will take about 4 hours to complete so that gave me time to blog about the plans and share our experience so far.

Installing the new 5769 feature and drives was pretty easy, but once we installed everything and tried to start it up nothing worked! Having never used a HMC before I was struggling to work out what was happening and why things would not start up. The problem was the system could not find anything, the fact that we had installed a new Raid card meant that the Load-source was no longer where it should be! I had no idea until I called a very good friend (who is a real expert on the HMC and hardware setup) who kindly pushed me in the right direction. I am sure I will be going back to him when I need to carve up the DASD and CPU ect for the partitions!
Once he built a new profile and loaded it to the HMC everything started up OK and we could add the Raid card and start Raid 5 over the disks, he did say I should let the raid be built over the unallocated disks first (they are assigned to an ASP yet) so I was glad of his expertise. His other note of caution was to make sure I did not disconnect the console once the striping had started, point taken and being observed.

Once the stripping is finished I need to go in and set up the drives to the ASP and change a couple settings for the IPL so it starts up correctly, I had no idea I could power down the partition without the hardware so after installing the HMC I was surprised to find the hardware still running after issuing a PWRDWNSYS *IMMED command!

So that is where we are at, once I get to setting up the partitions and installing the OS’s I will add more posts in the hope it helps others who walk this path..

Chris…

Leave a Comment

JobQGenie interface coming along

The new JobQGenie interface is coming along, built using PHP and the Easycom server functions we have now completed the initial page and the job list page with some neat functionality being added as we move forward.

The plan has always been to stick with a similar layout to the existing HA4i and DR4i products as far as the look and feel goes. JobQGenie has a different output requirement due to the amount of data that can be collected and require display in comparison to the other products though, with JobQGenie we have to be able to drill down to different environments to display the job data to the user. The amount of data which can be stored was out biggest concern so we had to come up with a process which allowed us to display relevant data quickly, this resulted in a paging process which allows a set number of records to be displayed at a time while allowing the user to page efficiently forwards and backwards through the data. An added complication was allowing the user to filter or sort the data based on certain attributes such as *Active jobs or Jobs which have yet to be started etc. The results are pretty impressive even if we do say so ourselves :-)

A previous post showed the job list page and the detail page, each record we store is required to build the command string which in turn allows the job to be re-submitted. This was fine but we needed to be able to display data by Environment, so we have built into an initial page a list of of the data collection processes and links to each configured environment. You should understand that in a replicated environment you could have both local and remote environments which have data collected for production applications so we need to show all environments not just those for data collected on the local system.

Here is the initial page which is available once the user has correctly signed onto the system.

Initial page after signing on to the system

Initial page

As you can see from the above we have added a number of checkpoints for the data collection processes, if any collection process is missing (not running) we identify the monitor with a red cross so it stands out against those which are running, you can see by the green ticks checks show that everything is running OK on the test system. On the right-hand side you will see a list of the environments that we have configured with a link to show the job list. When you select this link you will be provided a list of the jobs which have been collected for that environment.

JObQGenie job list

List of job data collected

This is the new joblist screen, we have paged through a couple of screens of data to show the page links at the bottom of the page. The selector list can be used to file the list and a link on each record allows the full details for the job to be shown.

The next challenge will be how to build the job string and allow the job to be submitted using the information collected, we have a number of commands available in the 5250 interface so we need to be able to call those commands using the data we have collected and display any returned information so they will be the next piece of the puzzle to build.

JobQGenie is a must for any company running a High Availability Solution, it provides the ability to capture all job data for jobs as the progress through their life cycle. Using this data the user can rebuild the job queue on the recovery system and display any affected data which requires analysis before jobs which started but did not complete can be re-submitted.

If you are interested in seeing a demo of the JobQGenie product lets us know we will be happy to oblige.

Chris…

Leave a Comment

Using the i5_job_list() function in the Easycom toolkit.


If like me you are struggling with the i5_job_list() function in the Easycom i5 toolkit here is a working function that you can use to get you started.

The problem was with the sample, once you understand the underlying API being called it is quite easy to build the function request and get the data back that you need. We were interested in using the function to get back a list of jobs that are running in the JobQGenie subsystem and match that against what should be running. Here is a working sample we created, the connection resource is passed into the function from the page we are building so it is not shown here. We have supplied plenty of sample code in previous blogs to show how to connect to the IBMi both using secure encrypted methods and non secure so if you need that information you can look through the previous posts.

If you need to see the documentation it is available here

Here is the code that worked for us.

/*
 * function to list jobs
 */

function get_jqg_jobs(&$conn)  {

$HdlSpl = i5_job_list(array(I5_JOBNAME => "*ALL", I5_USERNAME => "JOBQGENIE", I5_JOBNUMBER => "*ALL"),$conn);

if (is_bool($HdlSpl))
	trigger_error("i5_job_list error : ".i5_errormsg(), E_USER_ERROR);
echo("No error");
$continue = true;
while ($continue){
	echo("Reading joblist");
	$ret = i5_job_list_read($HdlSpl);
 	if (is_bool($ret)){
  		$continue = false;
  		break;
		}
 	if (count($ret) > 0){
  	print_r($ret[1]);echo "
"; } else { echo "Nothing to display
"; } } $ret = i5_job_list_close($HdlSpl); if (!$ret) trigger_error("i5_job_list_close error : ".i5_errormsg(), E_USER_ERROR); }

We just took the sample code from the manual and made it work for our purposes. The thing which was confusing to us was the layout as described in the manual, if we called the the function other than how we did above we had an internal server error reported back. We are not sure if the array naming is correct (I5_JOBNAME and I5_JOBNUMBER) but it worked and the function did not complain.

Here is the sample output.

Reading joblist
MONITOR4
Reading joblist
MONITOR7
Reading joblist
MONITOR14
Reading joblist
MONITOR11
Reading joblist
MONITOR1
Reading joblist
MONITOR22
Reading joblist
MONITOR2
Reading joblist
MONITOR24
Reading joblist
MONITOR21
Reading joblist
MONITOR0
Reading joblist
MONITORA
Reading joblist
MONITORB
Reading joblist

If you have any questions let us know. Have fun and happy PHP’ing…

Chris…

Leave a Comment

New PTF for HA4i released


We have placed the latest PTF (PTF05) for HA4i on the website. To download the PTF you just need to sign in and go to the product pages where the download link will be available. The following is a sample of the changes we have added to the product in this PTF, for a full list of enhancements and fixes see the Cover Letter installed with the PTF.

Reduced messaging
As the product is installed in a number of very large and active accounts we found that the message queue used by HA4i would fill pretty quickly and wrap with all of the status/diagnostic messages that are sent. While some of the diagnostic messages are important, they are only important when looking for problems in the process. As part of the update we have now removed a lot of the messages we sent such as member delete messages when the output file is cleaned up after the APYJRNCHG has run and No object saved or restored messages from the HA4iMSGQ unless HA4i is set to debug mode. Other messages such as QCMDEXC messages which had subsequent detailed messages sent and retry messages have also been removed.

New functions
We have added Email capabilities to the source system. Now you can configure and start the email manager on each system, this allows processes such as the STATUSCHK program to send emails when the target system or the link to the target system is down. A new function key to the IFS audit screen allows all errors to be re-submitted at once instead of having to select each entry individually. If a constraint restricts the submission of the request a message is sent stating the submission was not carried out.

A major addition is a new APYJRNCHG process which Reduces the locking process required each time it is called. V6R1 and above can now process the majority of the journal entries without having to be filtered and managed using the QDBRPLAY API, this now reduces the number of times the process has to lock and unlock all of the objects which are described to the journal.

Audit improvements
Auditing has had a major upgrade in a number of areas, some are related to the output of the audits such as we now mark a missing file with M instead of Y/N which states an error exists. A new logical file audit capabilities was added which audits logical files and report errors associated with the make up of the logical file such as the Based on File information or the number of members in the Logical File, access path information and indexes.

One concern may user reported was the amount of data they had to trawl through to find out the errors that had been logged so with this update we have reduced the amount of data written out to the spool and DB file by a new setting in the command which provides either *FULL output (same as before) or *ERR which identifies just those objects in error. We have also moved the output for the audits to a separate output queue so they can be found by anyone who needs them and added Filters to the file audit views to allow the display of *SRC, *LGL, *PHY *DTA (*LGL and *PHY) and *ALL which improves the data analysis.

Due to the way the APYJRNCHG works we have also updated the automated audit process to automatically retry *FILE object errors prior to running the audit against the physical files and after the existing journal receiver has been applied. This reduces the number of false positive errors where a logical file member does not exist because the underlying data member has not been created by the APYJRNCHG process. Also as part of the same update we have added a new parameter to the object audit command (AUDLIB) to determine if the Object Filter file is checked for matches before an object is audited. This will remove any object audits errors from being reported for objects which are not being replicated by HA4i.

Another concerns was how to end an audit once it had been started, if a file audit started to process a file with millions of records it could take a significant amount of time to process. There were a couple of things we added to help with this, firstly we have added a new command which will end the auditing of records after a certain number of records had been checked, next we added a new feature which allows you to set where the audit starts by either skipping an initial number of records or skipping a percentage of the total record count. This allows files which have a large number of records that are only extended (such as history files) to start auditing after skipping a percentage of the records with a full audit against the remaining records. The default audit will still skip a percentage of the records across the entire member. We have also added a new check to the file audit, It will now flag where the journal information is different or the file is no longer journaled on each system.

Object replication Improvements
A new object retry process has been developed which will cycle through failed object replication requests. Each time a request fails to be replicated it will be marked and a delay incremented between 1 and 50 seconds before each retry of the same object is processed. Each object will be retried 5 times before being marked as a failed request. if an object does not exist when the retry
is processed the object will be removed from the retry list and not marked in the error list. Objects that cannot be replicated because the library does not exist will automatically get registered as failed requests.

A new option on the RETRYOBJF command allows object retries to be re-submitted by type such *FILE or *DTAARA etc. plus *IFS for all IFS type failures. This provides the ability to manage which objects are sync’d in which order such as physical files before logical files.

Our initial take on object replication was that it would be based at the library level, if any supported object changed within the specified library it would be replicated. This worked fine for most of our customers but some had problems where objects are created and deleted constantly or were always locked. The initial solution was to add object specific entries so any object which matched would be ignored, however this was still unsuitable for some, they has so many objects being created with generic names that they could not keep adding them to the list. So we added generic name support to the Object replication filter process. The name is checked for an ‘*’ in it, if found the name up to the ‘*’ will be used to check the object request ie. TST* will filter all objects of the given type from the given library which begin with TST.

Another request was to automatically repair a failed request such as one where a command failed on the target because the object did not exist. Now if a command fails the object is located on the source and automatically replicated to the target system and the error is not logged, if the object does not exist on the source either the request is discarded.

Status & Management

While the status screens are not meant to be monitored constantly we found that some additional information would benefit the user when reviewing certain status. As part of this PTF we have added the following information to the status screens.

  • Depth of the process queue to the status for the retry manager.
  • Apply status screen shows if any object or IFS errors are logged

Finally we have added a new command which allows the status of a remote journal apply process to be retrieved from HA4i. The command can only be run from a program which allows a parameters which is passed as *CHAR 10 to be set. This allows the user to develop programs to manage the apply process when carrying out functions such as running a save on the target system.

This has been a major PTF for HA4i, not in terms of fixes but in providing more functionality and features to the user. All of the updates have been implemented as a result of customer requests and that has to be good for everyone because we are delivering what the customer requires not what we feel they need.

HA4i is an affordable option for High Availability, if you are considering a HA solution HA4i has to be part of your review process. if you need more information or would like to see a demo of the product let us know.

Chris..

Leave a Comment

Bad Behavior has blocked 221 access attempts in the last 7 days.