Wednesday, August 20, 2014

FTP i-to-i part 1

ftp get put quote rcmd

FTP, File Transfer Protocol, is probably the most widely used way to transfer objects between computers. It should come as no surprise to you that FTP has been available since the AS400 era.

I work in an environment with 11 IBM i partitions and servers, and I can spend a lot of time moving objects between. To move objects between partitions on the same server I use the SAVRSTOBJ and SAVRSTLIB commands. To move objects from one server to another, especially if they are in different geographical locations, I use FTP.

Why FTP rather than SNDNETF or SAVRSTOBJ? In my experience when moving very large amounts of data between servers it can be several hours quicker to FTP the file rather than use the other methods.

This post is going to first of several posts explaining how to FTP a file or files from one IBM i server to another. This method is not secure and I only do this within my company's network or while part of a VPN. I do not recommend doing this in an unsecure environment, i.e. over the internet while not being part of a VPN, as it can be "sniffed" and the data compromised. If you do want to send data via an unsecure environment then use SFTP, Secure FTP.

Wednesday, August 13, 2014

Retrieve file's Column Headings using API

quslfld

In May I posted two examples of how to retrieve the Column Headings for fields in files to be used as the column headings in a CSV file in the IFS. The first example, Adding Column Headings to a file in the IFS, I used DSPFFD. I was sent an alternative method that I gave in a later post, Adding Column Headings to a file in the IFS, continued, which used SQL to extract the information from the SYSCOLUMNS table.

Shortly after the second post I received a message from David Gomes. In it he explained a third method:

Whenever there is an API available to get the data, you should be using that and not running a CL command to produce a output file to read. In this situation I would recommend using the List Fields API (QUSLFLD). This will allow you to retrieve the Field name, Column or Text descriptions for the field. Using the X-Ref tables like SYSCOLUMNS is useless if the file is in QTEMP.

As I have explained how to use a List API, like QUSLFLD, that outputs to a User Space in the post User Space introduction in this post I am just going to explain how to use QUSLFLD.

Thursday, August 7, 2014

User Spaces introduction continued

user space, quscusat

After publishing yesterday's post User Spaces introduction Sam posted a comment:

It seems you forgot one important thing: Change User Space Attribute API
Automatic extendibility. Whether or not the user space is automatically extended by the system when the end of the space is encountered.
0 The user space is not automatically extendible.
1 The user space is automatically extendible.

While I write each post I test the code I give as examples. I did not encounter an error while testing that the User Space was full. But that could be that I did not fill the 128k size I made the User Space in my example.

Perhaps I needed to use a file with more fields? Or what would happen if I created the User Space with a size of 1 byte?

Wednesday, August 6, 2014

User Spaces introduction

user space quscrtus qusdltus qusptrus

User Space is used by many IBM APIs to hold the generated results. It is similar to a data area, but can be a lot larger and will expand in size as more data is added to it. What I consider to be a drawback for using them is that they can only be accessed by API. As I want to talk about some APIs in future posts I thought it would be a good idea to give this introduction to using User Spaces first.

In this example I will be using the following User Space APIs to:

  • QUSCRTUS – Create user space
  • QUSDLTUS – Delete user space
  • QUSPTRUS – Get pointer to user space

In this example I am going to use the List Fields API, QUSLFLD, to generate a list of the fields in a file. I just chose this API at almost random to show how to use the APIs in a very simple manner to demonstrate how they work. You will probably want to add more complicated code to your use of these APIs to cope with errors, etc.

Monday, August 4, 2014

User Group: NiSUG becomes i-UG

nisug i ug user group uk

The United Kingdom based user group the National iSystems User Group, NiSUG, changed their name to match the IBM i operating system and become the i-UG.

They have also created a new web site at i-ug.co.uk, which I have replaced their old NiSUG web site with on the IBM i user group page. There is a link to the user group page at the top of every page of this web site.

Feel free to check out the user groups listed, if you know of one that is not on the list please use the Contact form to send me its details. If you find one near you I encourage you to make contact with them and attend their meetings.

Wednesday, July 30, 2014

Easy way to convert CSV file to DDS file

csv excel cpyfromimpf cpytostmf

I am sure we have all been given a Microsoft Excel spreadsheet and told to upload the data from it into IBM i files. The first thing I do with the Excel spreadsheet is to save is as a CSV file. CSV stands for comma-separated values, the data elements, or columns, can be of varying length and are separated with a comma. It could be described as an Excel file without all the special formatting. If you have a Windows PC and you right-click on a CSV file, select "Open with", and then "Notepad" the file will look like this:

First,Second,,"4,444",5.5
First field,Second field,Third field,4.4,"5,555,555"

In conversations with other IBM i folks I am finding that the "Send file to host" function of Client Access is being shut off on their IBM is as it is rightly regarded as a security risk. What can be used as an alternative?

Thursday, July 24, 2014

IBM i strategy and roadmap

ibm i commitment road map strategy

Sometimes Googling uncovers things I missed when they were originally released. This is an example: the white paper An executive guide to IBM's strategy and roadmap for its intergraded operating environment for Powers Systems was published in May 2014. In this 16 page document IBM explains their commitment to the IBM i.

In the introduction Doug Balog, General manager IBM Power Systems, explains Big Blue's commitment:

I want to assure you that IBM is committed to the IBM i platform as a vital component of our Power Systems portfolio. IBM i is key to our broader strategy of investing in enterprise systems and storage.