Wednesday, October 15, 2014

How I code source for SQL DDL tables

create sql table ddl using runsqlstm

I received a message from KaBrito about the post Defining SQL tables using a reference file.

Question: How would you do that in some type of a Source Control Management application?
Promote the table to production and then run the Alter table command?

With the move from DDS files to SQL DDL tables this is going to become a frequent asked question.

Monday, October 13, 2014

Modern Developers article from IBM Systems magazine

 

The web page that was originally linked to no longer exists, therefore, rendering this page obsolete.

 

Wednesday, October 8, 2014

Multiple levels of data compression in save commands

AS400 IBM i data compression rates to a save file

Addendum: There is a newer post that includes the new ZLIB save algorithm, you can read it here.


Something that was added to the SAVOBJ and SAVLIB commands in IBM i release 6.1 V5R4 was the ability to compress data more than before when saving to a save file. Previously the only options that were available for the Data Compression parameter was *DEV, *NO, and *YES. With 6.1 V5R4 three new compressions levels were added:

  • *LOW
  • *MEDIUM
  • *HIGH

Note:  These three values are not valid when saving to tape.

What is the benefit of using any of these Data Compression values?

Monday, October 6, 2014

7.1 TR9 and 7.2 TR1 announced

Technical Updates IBM i 7.1 TR9 and IBM i 7.2 7.2 coming soon

The new Technical Updates for the latest two releases of IBM i, 7.1 and 7.2, will be available on November 11, 2014.

TR9 for 7.1 includes updates to:

Thursday, October 2, 2014

Defining SQL tables using a reference file, continued

sql create table like

Yesterday I showed how to create SQL tables using a reference file. Tommaso Arcieri message me with another approach, defining a table based on another file or table.

In this example I am going to use the physical file TESTFILE as the original reference file.

  A          R TESTFILER
  A            FLD001        10
  A            FLD002         3P 0
  A            FLD003        10
  A            FLD004         5P 0
  A            FLD005         9P 2
  A            FLD006         7P 2
  A            FLD007         1
  A            FLD008         1
  A          K FLD001

This just a small file of only eight fields, so it would not be a big deal to enter each field name. But for a field with many more fields it would be a pain to do so. Fortunately the approach Tommaso showed me should be used if the original reference file has only one field or hundreds.

Wednesday, October 1, 2014

Defining SQL tables using a reference file

reference file, create table, alter table, label on column, label on table

I am old enough to have been working with IBM midrange computers before the introduction of the AS400 in 1987, see 25th anniversary of IBM i (AS400). Twenty six years ago I was a programmer on the System/36 using RPG II. I can remember the first day I started programming on the AS400 how I was blown-away by the relational database, which was not present on the System/36. The files I created could refer back to a reference master file, and I would no longer have to worry about ensuring that all the invoice number fields were the same size, etc.

With the modernization drive to replace DDS files with SQL tables how do I do the same as a reference file in SQL. All the examples I have seen show the DDL (Data Definition Language) for the SQL tables where the data type and size of the columns (fields) have been defined. In my opinion this is a step back from the beauty of the relational database.

So how can I use a reference file in SQL?

I could use the method I described in the post Creating a SQL table on the fly, but there must be a better way.

Tuesday, September 30, 2014

Redpaper: Tools and Solutions for Modernizing

Redbook IBM i tools for modernization

IBM has published a new Redpaper today called Tools and Solutions for Modernizing Your IBM i Applications, it is a companion to the earlier Redbook Modernize IBM i Applications from the Database up to the User Interface and Everything in Between, from July 2014.

It describes independent software vendor (ISV) and Business Partner tools that can be used to modernize your IBM i applications.

It includes the following chapters:

  1. Mobile, web, and client solutions
  2. Database modernization tools
  3. Security
  4. Tools for understanding and modernizing RPG and COBOL
  5. Source control and project management

You can download it, as a PDF, here.

You can find a link to its companion Redbook here.

Wednesday, September 24, 2014

How to map an IFS folder as a Windows share folder

Map an IBM i AS400 IFS folder to a Windows share folder

After reading the post Easy way to convert CSV file to DDS file Martin Coates emailed me with the following question:

How do you map a folder in the IFS and share is on the pc? I am an As400 “purist” but more and more I find programming requests overflowing into the pc domain.

In this post I will discuss how to create a folder in the IFS, and then how to share it as a folder that can be accessed by a Windows PC. If you already know how to create folders in the IFS feel free to skip to the second part.

Wednesday, September 17, 2014

Use QTEMP for your work files

rpg extfile extdesc rename qtemp

This post is inspired by a situation that I encountered a couple of weeks ago that left me flabbergasted. It started with a phone call from a department head complaining that another department was eating into his department's time to run a report. At first I was confused, and after talking to three department heads I discovered that each one has a time they can run this report. Department A can run the report with any selection criteria they desire from 8:00 – 8:59 AM, Department B can do the same from 9:00 – 9:59 AM, and Department C from 10:00 – 10:59 AM. Anyone can run the report in the afternoon, but only after calling the other departments to make sure they are not running the report at the same time.

Why was this an issue? In this job the programmer who had created it used a work file that was in a production library. Therefore, only one person could run the report at a time to ensure that only one department's data was included in the report. If two people ran the report at the same time the work file could contain mixed data from both jobs. I also found that when the job completed the work file was not cleared, still containing all of the data from the last run, wasting disk space.

The programmer who created these programs has retired so I was not able to ask the question I wanted to: Why?

Looking at library list for the jobs from this application I found that QTEMP was in the library below all of the production libraries. Could this be the reason why?

Wednesday, September 10, 2014

Accessing multiple member files in SQL

How to handle multi-member files using create alias and drop alias

I was recently asked the following question, via Facebook:

How we can read a particular member of physical file thru SQL EXEC in RPGLESQL program ?

Others suggested using "Override with Data Base File" (OVRDBF) command, which could be used. But there is a way to do this just in SQL.

Thursday, September 4, 2014

Row and Column Access Contol Redbook now available

RCAC stands for "Row and Column Access Control", which is one of the features introduced in release 7.2 to DB2 for i (SQL).

Since the release announcement I have seen many questions asking what it is and how to implement it. IBM must have seen the same and have created a new Redbook called: Row and Column Access Support in DB2 for IBM i. You can download it here.

To accompany the release of the Redbook is this brief video of Mike Cain, one of the members of the DB2 for i Center of Excellence team, giving an overview of RCAC.

Wednesday, September 3, 2014

FTP i-to-i part 3

ftp program automate

In the past two posts about this subject I discussed how to manually copy files from one IBM i to another using FTP, File Transfer Protocol. In this post I am going to demonstrate how to create a program to start FTP, execute FTP subcommands, and then produce a printed log of what happened.

The program I will show is very simple and can be used for any types FTP subcommands. In this post I will use the example I discussed in Part 2, to copy a number of files from one library on QSRV1 to another library on QSRV2, and then call the program on QSRV2 to process the copied files.