Blog
iCan

Advertisement

Dawn May

Dawn May




Bookmark and Share

May 2012

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

May 29, 2012

Display File Usage Information

Did you know that you can display file usage information for files stored in the Integrated File System? And that this usage information includes the details about jobs that are using a file? Or that you can display file system objects for a job? This has been part of the operating system for many releases (it was introduced in 5.2!), but I think it is a very little-known and seldom-used capability.

I'll use a simple example to demonstrate...

I have a stream file in the root directory named DAWNMAY and I have opened this file in edit mode in a telnet session.

Using IBM Systems Director Navigator (this capability also exists in System i Navigator), begin by opening File Systems and then opening up the Integrated File System. Navigate to the file of interest – in my case I just had to open up the Root directory to find the file. Take the Properties option.

 

Image1

 

Open the Use tab where you will find a section on Current usage. Clicking on the Show usage button will allow you to access more detailed information.

 

Image2

 

Now you can see that there is one job using that file.

 

Image3

 

Select the option that makes the Details.... button available.

 

Image4

 

And now you get the details of the job with that particular file in use:

 

Image5

 

There is a second way to approach this – and that's by starting with the job that is using the file. For example, you can open Work Management and navigate to the job of interest in whatever manner you choose (Active Jobs, Server Jobs, or whatever navigation you like). Once you have found the job you are interested in, right click on it to get to the options – take Details, Open Files, and then File System Objects.

 

Image6

 

The results list the file system objects that are in use by that job.

 

Image7

 

There are two underlying APIs that can be used to collect similar information programmatically:

 

Advertisement

May 16, 2012

Blog of Blogs, Videos and References

I'm a bit short on time this week since I'm recovering from the busy week at COMMON, so this blog is also short.

I wanted to share with you a few new blogs and videos that are available to you.

IBM has created new videos on IBM i that are out on YouTube:

There are also some relatively new bloggers out there that you should know about:

  • Mike Cain, a well-known expert on DB2 on i has a blog on …. db2 for i, which offers insight and perspectives on data management using IBM i.
  • Erwin Earley has a blog, Power Implementers Blog, for hints and tips various technologies on IBM Power Systems. Many of the blog posts deal with using IBM Systems Director with Power Systems.

There are also some new and updated Redbooks that are available:

Finally, the IBM i developerWorks site while not new, is a great resource for the latest IBM i information. Be sure to check out the Community & forums link on that developerWorks site for links to all sorts of additional blogs, forums, wikis and more.

 

Advertisement

May 09, 2012

COMMON 2012 Annual Meeting and Exposition

This week is the COMMON 2012 Annual Meeting and Exposition in Anaheim, CA. It's been a busy week of giving presentations, talking with clients during the exposition hours, attending evening social events, and general discussion among peers passionate about IBM i. I spent an hour at the IBM Systems Magazine booth where they were advertising their bloggers with pictures of heads on a stick – so Minnesotan in California!

Here are a few observations from this week: 

  • The overall mood about i seems to be positive. This is a very subjective statement, but the people I talked to weren't bemoaning marketing nor were they voicing concerns about i going away. Rather, they talked about their positive experiences with solutions on i and most questions I got were about solving technical problems. I talked to a couple people that hadn't been to COMMON in 10 years, but they were back this year.
  • When I give a presentation, I generally ask for a show of hands to see what releases are installed. My highly unscientific results show that the majority are now on 6.1 or 7.1. There are still some shops on 5.4, but the majority have moved forward
  • Several people found out about improving IFS save times by using async bring from the blog, Achieve Faster IFS Save Times Using SAV With ASYNCBRING, written early this year and were thrilled with the results that enhancement provided. It's really great to hear about how information written in this blog has helped people solve problems they were dealing with.
  • In fact, there was a discussion at the IBM i Q&A session about IBM's documentation on new features. Because IBM has delivered so much new function over the past couple years via PTFs, it's not always easy to find the documentation. This blog has been one way we're trying to communicate the new features and that will continue to be the case. The IBM i developerWorks site is also an important location for documentation on recent enhancements.
  • DisneyLand is amazingly clean. I have never seen such clean concrete!
  • Disney's attention to detail is impressive. In the hotel room you will find Micky Mouse gloved-hands that serve as light-fixture holders, Micky ears on the sink and shower faucet handles, a Micky glove with a pointing finger on the shower faucet to show which way to turn on the water instead of the usual red arrow, mirrors that are shaped like ones you might see in the animated movies, night-lights in the formation of fireworks. The music from the bed-side lamp was a bit too much for me though!

I always enjoy attending the COMMON conferences and it's been a great way to meet others with passion about IBM i.

I do want to share two additional things this week....

COMMON has published their call for presentations for the 2012 Fall Conference and Expo. New speakers are always encouraged, so if you have expertise you'd like to share, submit your session idea. The deadline for submissions is June 4th.

Finally, COMMON Europe is coming up in early June. I'll be traveling to Vienna to do some presentations there and will also attend the COMMON Europe Advisory Council (CEAC) meeting. This is the 50th anniversary of COMMON Europe.

 

 

 

Advertisement

May 01, 2012

i Can Use XML in a Relational World

This week's blog article was written by Nick Lawrence. Nick works for IBM in Rochester, Minn., on DB2 for IBM i. His responsibilities include full-text search for DB2 and SQL/XML. Thanks, Nick!

In this most recent round of announcements, IBM has included support for the XMLTABLE table function in SQL. XMLTABLE is designed to convert an XML document into a relational result set (rows and columns) using popular XPath expressions. This function has been referred to as the Swiss army knife for working with XML because it can help solve a wide variety of XML related problems.

A good tutorial of what XMLTABLE is and how it works can be found in the SQL XML Reference (a new book in the Info Center). The examples show how XMLTABLE can be used to perform a query over XML data in a DB2 column.

What may not be obvious from the documentation is that, the XML support included in DB2 for i can be of enormous help for Web-enabled applications, even when all of the data in the database is stored in a pure relational model.

Consider this example:

Suppose I have an SQL table that I created with the following SQL statement:

create table orders(
     order_id bigint generated always as identity
              (start with 1000 increment by 1),
     cust_email varchar(255),
     order_ts    timestamp,
     product     varchar(255),
     primary key (order_id));

And assume that I’ve inserted the following rows:

insert into orders (cust_email, order_ts, product)
values
('ntl@us.ibm.com',
 '2012-04-15 13:00:00',
 'Camera'),

('ntl@us.ibm.com',
 '2012-04-16 12:00:00',
 'lens'),

('ntl@us.ibm.com',
 '2012-04-01 11:00:00',
 'Book'),

('george@nowhere.com',
 '2012-04-15 13:05:00',
 'Book') ;

My application will receive a request from the Web (in XML format) that contains a customer email and a date range. The application is expected to query the table and return matching orders in an XML format.

For simplicity, let’s suppose I’ve retrieved my request XML document from the Web and stored it in a global variable:

create or replace variable  order_request xml;

set order_example.order_request = xmlparse(document
'<OrderInfoRequest>
   <CustEmail>ntl@us.ibm.com</CustEmail>
   <MinTs> 2012-04-14T00:00:00 </MinTs>
   <MaxTs> 2012-04-30T23:59:59 </MaxTs>
</OrderInfoRequest>' );

For my sample data and the request above, let’s assume a valid response needs to be structured like this:

<?xml version="1.0" encoding="UTF-8"?>
<InfoRequestResponse>
    <MatchingOrder>
        <OrderId>1000</OrderId>
        <CustEmail>ntl@us.ibm.com</CustEmail>
        <OrderTs>2012-04-15T13:00:00.000000</OrderTs>
        <Product>Camera</Product>
    </MatchingOrder>
    <MatchingOrder>
        <OrderId>1001</OrderId>
        <CustEmail>ntl@us.ibm.com</CustEmail>
        <OrderTs>2012-04-16T12:00:00.000000</OrderTs>
        <Product>lens</Product>
    </MatchingOrder>
</InfoRequestResponse>

Without the SQL/XML support in 7.1, this could be a complex task that would involve both an SQL query and some external code to deal with the XML aspects. However, this can now be accomplished with a single SQL query.

The first thing to understand is that we can join the SQL table to a result set generated by an XMLTABLE invocation.

The SQL query that follows returns only the rows that match the specifications within the provided XML OrderInfoRequest document:

select   ORDER_ID,
         CUST_EMAIL,
         ORDER_TS,
         PRODUCT
from
orders,
xmltable('OrderInfoRequest'
  passing order_example.order_request
  columns  "CustEmail"  varchar(255),
           "MinTs"      Timestamp,
           "MaxTs"      Timestamp
) info_request
where
 orders.cust_email = info_request."CustEmail" and
 orders.order_ts >= info_request."MinTs" and
 orders.order_ts <= info_request."MaxTs";

Creating the XML response document can be done by combining the above query with SQL publishing functions. Each of the rows generated by the above query must be converted into “MatchingOrder” elements. The rest of the document must then be constructed around those values.

This might seem complicated, but the trick is to construct the document “inside out,” using common table expressions and arrogations to create the inner values that are repeated.

The following query is all we need to satisfy the application’s requirement.

-- intermediate result set of
-- “MatchingOrder” Elements
with matching_orders as (
 select
  XMLELEMENT(NAME "MatchingOrder",
             XMLFOREST(ORDER_ID AS "OrderId",
                       CUST_EMAIL AS "CustEmail",
                       ORDER_TS AS "OrderTs",
                       PRODUCT AS "Product")
             ) AS ORDER
 from orders,
      xmltable('OrderInfoRequest'
               passing order_example.order_request
               columns "CustEmail" varchar(255),
                       "MinTs"     Timestamp,
                       “MaxTs"     Timestamp
               ) info_request
 Where
  orders.cust_email = info_request."CustEmail" and
  orders.order_ts >= info_request."MinTs" and  
  orders.order_ts <= info_request."MaxTs"
)

-- build InfoRequestResponse element
-- around matching orders
select
XMLSERIALIZE(
  XMLDOCUMENT(
      XMLELEMENT(NAME "InfoRequestResponse",
                 XMLAGG(matching_orders.ORDER)
      )
  ) AS CLOB(1G) CCSID 1208 INCLUDING XMLDECLARATION
 )
from matching_orders;

You may have noticed that the XML xs:dateTime is not a valid lexical format for an SQL timestamp (and vice versa). This is an annoying problem for hand-written solutions, but the SQL/XML functions handle the conversions between the XML types and SQL types automatically for us. Designing the code with SQL/XML ensures that the result is well-formed XML.

The learning curve for using these XML functions can be a little steep. But in the long run, using this support will make the process of modernizing an application to incorporate Web technologies easier. Avoiding the need to write special purpose code to include XML data in your SQL queries makes it easier to adapt and expand the scope of the application as the Web-facing components evolve.

For a more general overview on the XML data model and what it means to DB2, check out these recently published articles:

http://www.ibmsystemsmag.com/ibmi/developer/general/xml_db2_part1/

http://www.ibmsystemsmag.com/ibmi/developer/general/xml_db2_part2/

Announcement for XMLTABLE:

https://www.ibm.com/developerworks/mydeveloperworks/wikis/home/wiki/IBM%20i%20Technology%20Updates/page/XMLTABLE?lang=en

 

 

 

 

 

Advertisement

April 24, 2012

Move My i

Today is a major announcement day for IBM i with Technology Refresh 4 (TR4). Steve's “You and i” blog reviews the content of this announcement.

Last year, IBM provided support to suspend an i partition, which I previously wrote about in “Suspend my i”. 

The most significant function in IBM i TR4 is Live Partition Mobility. With Live Partition Mobility, you can take an active, running IBM i partition and move it from one frame to another frame, without disruption to your applications. I'm not going to discuss more about what mobility is and why you might want to use it, as Steve covered that in his blog. What I do want to write about is a little more detail on just what you need to accomplish this.

There are both hardware and software prerequisites:

  • POWER7 tower/rack system for both the source and destination systems
    • Firmware service pack 730_xx, 740_xx, or later
    • IBM Hardware Management Console V7R7.5.0M0, or later
  • All I/O must be virtual and supported by VIOS; it can be Virtual SCSI (VSCSI), Virtual Fibre Channel (NPIV) or Virtual Ethernet
  • The configuration must use only external storage and that storage must be accessible to both the source and destination systems
  • Both source and destination systems must be on the same Ethernet network
  • IBM i 7.1 TR4 PTF group – SF99707 level 4
  • PowerVM Enterprise Edition on both the source and target system
  • VIOS 2.2.1.5 (FP25 SP3) on both the source and target system

There are a few restrictions that are too detailed to review in this blog; the Live Partition Mobility documentation in the IBM i developerWorks site reviews the complete set of prerequisites, requirements and restrictions.

The actual move of a partition is initiated from the HMC. IBM Systems Director VMControl has relocation, which you can imagine will ultimately support IBM i as well.

In general, applications and the operating system are unaware that the partition is moved from one system to another. There are some exceptions to this, such as Collection Services; when the partition is starting to run on the target system, the Collection Services collector job will cycle the collection so correct hardware information is recorded on the target system.

There are two new work management exit points that are part of the IBM i suspend and mobility support. These exit points allow to you run a program before and after a partition is suspended or moved. (These exit points are the same, regardless of whether you are suspending a partition or moving a partition). 

            Work with Registration Information

 

 Type options, press Enter.

  5=Display exit point  8=Work with exit programs

 

              Exit

   Exit         Point

 Opt Point         Format  Registered Text

 _  QIBM_QWC_RESUME    RSMS0100   *YES   Resume system

 _  QIBM_QWC_SUSPEND   SSPS0100   *YES   Suspend system  

The suspend exit is called before the partition is suspended or moved and is called two twice. The first time it is called to check to see if the operation is allowed. The second call is to prepare for the move or suspend operation.

The resume exit is called after the move is complete or after the system has been restarted from a suspended state. Applications can use these exit points to monitor and accept or refuse move or suspend requests. Running an exit program after a move or suspend also allows an application to refresh any copies of any system-specific information, log information about mobility requests for licensing or other purposes, adjust heart beat rates or whatever actions an application may require.

For more information on these exit points, refer to the “What's New”for APIs in the IBM i 7.1 Information Center.

The following messages may be logged to the QSYSOPR message queue as part of the suspend or move request:

  • CPI09A5 - Partition suspend request in progress.
  • CPI09A6 - Partition not ready for suspend request.
  • CPI09A7 - Partition suspend request canceled.
  • CPI09A8 - Partition resumed after migration.
  • CPI09A9 - Partition resumed from hibernation.

The system serial number will change when a partition has been moved. The model and processor feature may also change.

The documentation on enhancements added to IBM i via Technology Refreshes can be found on the IBM developerWorks web site.

Other sources for documentation on Live Partition Mobility for IBM i include:

          Search for “Live Partition Mobility” to find any usage notes.

 

Advertisement