Chapter 1. Introduction to the IFS

Table of Contents
1.1. What is the Integrated File System?
1.2. What is a stream file?
1.3. What different file systems can I work with in RPG?
1.4. IFS information in the Information Center
1.5. An IFS "Hello World" Application
1.6. Looking at our example from OS/400

The purpose of this book is to teach you how to work with stream files in the Integrated File System from an ILE RPG/400 (RPG IV) program.

1.1. What is the Integrated File System?

Traditionally, we've worked with a file system on OS/400 that was made up of libraries. Within each library are objects that are assigned a specific "object type" such as a file, a program or a command. Each object type has a strictly defined layout. Files, for example, contain members, which then contain records, which contain fields. Each of these pieces is given a strict definition of what it is, how it works, and how it can be used.

By contrast, other operating systems, such as UNIX, MS-DOS and Windows use file systems where each object is simply a collection of bytes. Applications can be written to write and read these bytes as data files, but they can also view them as programs, pictures, sounds, video files, or anything else that a programmer can dream up. In other words, their contents are not strictly defined by the operating system.

At some point in it's history it was decided that OS/400 should be extended to work with these "stream files."

Some problems needed to be solved in order to do this, however, because although these file systems are all similar, they are not exactly the same. MS-DOS filenames can be 8 characters long with a 3-character "extension", and cannot contain spaces in the filename. Windows extends the MS-DOS capability by adding the ability to have a much longer file name, plus they now allow spaces. And UNIX allows spaces and long filenames, and even makes the distinction between upper & lower case letters. In other words, in Windows "MyFile.txt" and "myfile.txt" would refer to the same file, but in UNIX they refer to two different files.

In order to make OS/400 capable of working with files and folders that adhere to all of these different rules, the Integrated File System (IFS) was born. In the IFS, many different file systems can be accessed using a common interface. Special directory names are used to denote which file system you're referring to. You can even define your own file system that uses your own user-defined rules if you wish! (But, we won't be covering that in this book.)