Tuesday, November 26, 2013

Zipping files in the IFS

zip file ifs

The information that went into creating this post was provided by Al Bernard. Al is an experienced IBM i (AS400) developer and colleague. In a recent conversation he mentioned to me something he had done that I have not.

He was asked to create a download file that would be emailed to a group of people. The file was so large that the Administrator of the email servers asked if the file could be zipped, to reduce its size, and then sent. My present employer uses a third party tool to send email from the IBM i, and I will not be discussing that here. What I will be discussing is the way he copied the file to the IFS and zipped it. Then I will describe how to do the reverse, taking the zipped file and putting the data into a DDS file.

Wednesday, November 20, 2013

Position record to top of subfile

position subfile sflrcdnbr

I recently received a message asking about subfiles:

I know this is a stupid question and I have done this a million times before, but I'm just blocked now and can't figure out what is wrong. My subfile is fully loaded, it is a few pages long. Enter was pressed on a second page, so I need the same page displayed when control is passed back to the subfile. For some reason it goes back to the first page.

The questioner must be asking about a "expanding" or a "load all" type of subfile, as this would not be an issue in the "page a time" subfile.

Fortunately there is a quick, and easy, solution for this problem by the addition of one line of code to the display file's source and a just two lines to the RPGLE/RPG IV's source.

Monday, November 18, 2013

IBM i VUG presentation replay and December meeting

ibm technical release 7 presentation

The presentation given by IBM's IBM i Virtural User Group last Wednesday (November 13, 2013), called Modern RPG - a look at the new and improved free form and other modernization, can either view or download the presentation below.

VUG's next meeting is on Wednesday December 11, 2013 at 10:00 - 11 AM US Central Time, and is called IBM i 7.1 TR7 DB2 Enhancements.

Friday, November 15, 2013

TR7 available today

If like me you have been patiently waiting like a child waits for Santa Claus, today is the day Technical Refresh 7 (TR7) for IBM i 7.1 officially becomes available.

You can see what is included in this Technical Refresh in an earlier post I wrote called IBM i Technical Refresh 7.

It is available as a group PTF, MF99007, you can view the PTF Cover Letter here.

In my opinion the most anticipated part of TR7 is the changes made to RPG/free. Now the Control (H), File (F), Data Definition (D), and Procedure (P) specifications are all in free format. Input (I) and Output (O) specifications remain in fixed format.

Thursday, November 14, 2013

IBM i Virtual User Group TR7 presentation

I thoroughly enjoyed yesterday's presentation by the IBM i (AS400) Virtual User Group called Modern RPG - a look at the new and improved free form and other modernization thoughts which is available for download as a PDF here.

And tomorrow is release date for IBM i 7.1 Technical Refresh 7!

Wednesday, November 13, 2013

Generating random numbers using a C function

Having discussed in previous posts about how to generate pseudo-random numbers using the CEERAN0 API in RPG and the SQL RAND function I received an email showing me a third way to do it, using a C function.

I would like to thank Bob Schmalandt for sending me the example program upon which this post is based upon.

There are two C functions that generate a pseudo-random number, and they both work in the same way.

  • rand, is not threadsafe.
  • rand_r, is.

In my examples below I will be using rand.

Monday, November 11, 2013

A Short History of Free-Form RPG

I found an interesting post written by Hans Boldt, who was part of the team that developed RPG/free at IBM in Toronto, Canada. In it he gives us a brief glimpse into some of the decisions and processes involved in creating RPG/free.

It all started more than twenty years ago, back when RPG IV was being designed. At the time, there were two distinct schools of thought. On one side, there were people who insisted RPG should have a fully free-form syntax. On the other, were those who strongly believed that RPG should remain in its traditional fixed-form layout.

He reminds us that RPG/free is no longer new as it was released 12 years ago in V5R1, and ILE RPG/RPGLE/RPG IV 18 years ago in V3R1.

You can read it here: A Short History of Free-Form RPG

Friday, November 8, 2013

User Group: IBM's Virtual User Group

IBM has their own User Group for the IBM i community the IBM i Virtual User Group. Being "virtual" means that we can all be members.

Its home page here.

You can join its mailing list by emailing ibmivug@us.ibm.com.

They are offering a webinar on Wednesday November 13th at 10:00 AM - 11:00 US central time called "Modern RPG - a look at the NEW and Improved Free From and other Modernization thoughts".

Thursday, November 7, 2013

Renaming one field in a file using EXTFLD

In September I wrote about a problem I had encountered where I had to rename one field in a file, and not rename the other fields, in Renaming one field in a file in RPG. I achieved this using RPG's Input specification, I-spec. BlueBull posted a comment on the post explaining that I could have used the EXTFLD keyword in the Data Definition specification, D-spec, to do the same.

In this post I will show how I would use the EXTFLD to rename a field, and determine if it would fit the scenario I used in my previous post.

Tuesday, November 5, 2013

Validating numbers without TESTN

I have received an email asking me the following question:

How can I validate numbers in RPGLE /free without using testn?

I have spent a considerable amount of time dealing with data from Microsoft Excel spreadsheets that has been uploaded to the IBM i (AS400). It is easy to use the TESTN operation code to test ideally formatted "00123456", but what about "123456  " or "1,234.56  "?

Friday, November 1, 2013

User Groups: Others agree

It is always good to find others who agree with one of your opinions. This week I felt really good to find that two eminent IBM i (AS400) folks share my opinion on the importance of User Groups.

Jon Paris and Susan Gantner wrote a post on the IBMSystems Magazine blog called "Kindred Spirits in the IBM i Community".

There's a lot to be said for kindred spirits getting together. It will be no surprise to readers of our blog that we're big believers in local IBM i user groups.

I have nothing further to say except to give you the link to this post: Kindred Spirits in the IBM i Community