Google ICS Calendars and IBM i
In this series of articles, we’ve been integrating IBM i DB2 data with Google Apps for Business (GA4B). In the third article, “Google CSV Calendars and IBM i,” we generated a Google Calendar CSV file to populate a calendar with employee birthdays and vacations. In this last article of the series, we’ll use the same Employee Master table to produce an ICS file containing data that can be imported into a Google, MS Office, Yahoo, Lotus Notes or Apple calendar. The ICS format offers more flexibility to the processing of dates to import.
Creating the Employee Table Calendar Entries
Using the same scenario of creating a calendar entry for employee birthdays and generating a vacation for each employee starting on their birthday for 10 days, we’ll generate and use the ICS format this time.
The ICS (iCalendar) format is more of a markup tagged formatting than was the CSV’s column-and-row format. This offers us more control on our calendar events and more powerful integration with other calendars on multiple computers, devices and Internet-based calendar systems.
As I mentioned in a previous article, the CSV file can’t provide for an automatic repeating calendar entry instruction as can an ICS file. An example is a birth date that occurred once (i.e., you are born only once) but repeats yearly. Using a calendar RRULE instruction in an ICS entry, you code a birth date as having a frequency of yearly, thus, it will repeat every year without having to program for this again. The CSV has no such function so we had to provide multiple entries that we generate programmatically for each recurring event.
To determine the format required for an import ICS, I first created a calendar entry in our Google Calendar for a sample meeting, birthday and anniversary. Then I emailed the invite to myself, which included the ICS file as an attachment. This simple reverse engineering trick worked perfectly to provide an ICS guideline when generating our new ICS formatted calendar entries for import.
As a note of caution, each Calendar system has slightly different formatting of the ICS structure. The ICS I’m generating was I tested with MS Office, Google Calendar, Lotus Notes, Yahoo and Apple iCal to assure the coding worked on all platforms.
As was the case for CSV generations, we again chose to use SQL PL (SQL Procedure Language) as it is a quick and flexible scripting language suitable for our needs.
Like what you just read? To receive technical tips and articles directly in your inbox twice per month, sign up for the EXTRA e-newsletter here.