Saturday, March 28, 2015

Video: IBM i Trends and Directions

This is a recording of a presentation Steve Will, chief architect of the IBM i, made to COMMON Europe yesterday (March 27 2015).

It contains a lot of interesting information about the present and the future of the IBM i operating system.

 

Update March 30, 2015

If you do not want to watch the whole video Steve Will also wrote a blog post about this on his blog that covers the same points, although not in the same detail. You can read it here.

Friday, March 27, 2015

History of IBM Redbooks

This video from IBM explains the history of their Redbooks.

You can find the IBM i/PowerSystems specific Redbooks here.

Wednesday, March 25, 2015

Getting off the RPG cycle

no rpg cycle with main and no main procedures

The cycle is still a part of RPG, and while you are not using it in your RPG programs it is still there lurking. I have always wished there was a way to be able to turn it off, and allow RPG to be linear. In recent releases this has started to happen.

With the file definitions in all free RPG it is not possible to code a file as primary or secondary, or to define matching records and level break indicators. But the cycle is still there. For example, the program below uses the cycle to read all the records from a file:

Wednesday, March 18, 2015

Char built in function added to CL

%char in clp clle and rpg

IBM i 7.2 introduced a number of new built in functions, BIFs, to CL. One of them is %CHAR, convert to character format. When I found it my first thought was this the same as the RPG %CHAR BIF.

The syntax for the two BIFs is similar:

CL :
CHGVAR VAR(&ALPHA) VALUE(%CHAR(&NBR))
RPG :
Alpha = %char(Nbr) ;

Monday, March 16, 2015

Change date from one format to another using SQL, update

converting date format using sql

I mentioned in last week's post Change date from one format to another using SQL that when I converted the alphanumeric value '022195' using SQL's timestamp_format function with the format 'MMDDYY' the result was the date '02212095', which was not what I expected.

I want to thank Chris Ringer, Birgitta Hauser, and R Flagler for the solution.

Wednesday, March 11, 2015

Change date from one format to another using SQL

converting date format using sql

This post is inspired by a question I was asked by a colleague. He wanted to create a SQL statement that would convert a MDY "date", in a six alphanumeric field in a file, to a ISO "date", in a ten alphanumeric variable.

In RPG I could simply do the following:

  test(de) *mdy0 InField ;
  if (%error) ;
    OutField = ' ' ;
  else ;
    OutField = %char(%date(InField:*mdy0):*iso) ;
  endif ;

Wednesday, March 4, 2015

Checking for Mixed Case in SQL

convert to upper case using sql

Most of the files and tables I use contain data that is only in upper case. Occasionally I have to work with files that can contain data in mixed case, both upper and lower, or data from our overseas subsidiaries that can contain special characters: accents, umlauts, circumflexes, etc. This does present me with an issue when I need to search data in those files. I mainly use SQL to search and extract from files, and while I can use a LIKE in the SQL statement it does still compare like to like, where 'A' is not the same as 'a'.

The simple solution would appear to be to convert the incoming field/column into upper case when performing the comparison, but I have Theo Kouwnehoven to thank for an ever simpler and better solution.

Monday, March 2, 2015

Leap second coming at the end of June

leap second adjustment june 30 2105

A Leap second is an extra second that is added to a day to keep UTC (Coordinated Universal Time) synchronized with "mean solar time". Leap seconds have been used 25 times since 1972 to stop the two drifting apart. The next Leap second will be added to June 30, 2015, and will mean that 23:59:60 UTC will be a valid time before changing to 00:00:00 UTC:

June 30 23:59:59
23:59:60
July 1 00:00:00

How does this effect the IBM i?