The Integrated File System for Intelligent People
February 9, 2005 Ted Holt
Recent e-mails from several faithful readers have reminded me that I should pay more attention to the fundamentals than I do. For that reason, I’ve delayed for one month the article that I was going to run this time and have instead written about the Integrated File System from the ground up. The IFS is too important to be ignored. Next month I will cover a more advanced topic that I hope many of you will find practical and of interest.
One of these recent e-mails was from a reader who thought that IFS was just a fancy name for the folders system in which OfficeVision documents were stored. Another devoted reader sent me a Qshell script that he could not get to run properly. Since I was as busy as Wal-Mart is the day after Thanksgiving, I passed the script along to my Qshell authority, Fred Kulack of IBM, who found the problem. The faithful reader was running the script in the folders system. Fred changed the script to run in the root system of the IFS, and the script ran perfectly. I am not sure why the reader thought he had to store Qshell scripts in the folders system. Another reader was blunt: “[I’m] still waiting to see an article on the IFS.” These are not the only e-mails I’ve received about the IFS, but they are representative.
In the Beginning
It used to be that you could store any type of data in a computer system, as long as it fit on 80-column paper cards. Tape files and disk files came later, but regardless of the media, in the world of data processing, everything had to fit into fields, within records, within files. When the good people at IBM added office functions, like word processing, to the midrange systems, they were well aware that documents (letters, books, contracts, and the like) did not fit into the data-processing mold. For this reason, IBM added a file system, based on folders and documents, to the midrange systems. You can still find folders on your i5-iSeries-AS/400 machine. Type GO CMDFLR at a command line and press Enter, and you’ll find plenty of commands for working with folders and documents.
But the addition of the folders and documents file system to the library-based object system wasn’t enough for all storage needs. The folks at IBM decided to fix the problem once and for all. Or, at least, I assume that’s what they decided, because that’s what they did. In V3R1, IBM introduced a file system capable of holding any kind of data that might ever be thrown at it. Here we are at V5R3, and some folks still don’t know the Integrated File System exists.
A Framework
Maybe the Integrated File System should be called the Integrated File Systems, because the IFS is not one file system, but a collection of file systems. The IFS includes the library-based system of strongly typed objects and the folders system, as well as other file systems. Its design allows for other file systems to be added in the future. In fact, you can even design your own file system for inclusion in the IFS.
The primary file system, the one that predominates over all others, is known as the root file system. It is similar to the file system on Windows-based PCs. There is a main directory, similar to the PC hard drive’s root directory. Within this directory, you may define other directories or files.
Each of the other file systems is defined as a subdirectory within the root. This is where the IFS differs sharply from the PC’s hard drive. On a PC, each subdirectory adheres to the same rules of the root directory. In the IFS, on the other hand, each file system under the root adheres to its own rules.
To access the root file system, run the following CL commands.
cd / wrklnk
The system presents the Work with Object Links panel, which displays the contents of a directory. Look for QDLS. That’s the folders file system, the same you access with the Work with Folders (WRKFLR) command. Next look for QSYS.LIB. That’s the library system. If you type a 5 in the option blank to the left of QSYS.LIB and press Enter, you’ll see the same objects you would see if you viewed the QSYS library from the Work with Objects (WRKOBJ) and Work with Objects using PDM (WRKOBJPDM) panels.
I’m sorry to burst your bubble, but the system of objects organized into libraries is not the main file system on your AS/400, iSeries, i5, or whatever you call your machine. The root system is the main thing.
The File Systems
The IFS contains different file systems, depending on release of OS/400 or i5/OS. The V5R3 Infocenter lists 11 file systems.
- “root” (/)
- Open systems file system (QOpenSys)
- User-defined file system (UDFS)
- Library file system (QSYS.LIB)
- Independent ASP QSYS.LIB
- Document library services file system (QDLS)
- Optical File System (QOPT)
- NetWare file system (QNetWare)
- iSeries NetClient file system (QNTC)
- OS/400 File Server file system (QFileSvr.400)
- Network file system (NFS)
I’ve already told you that the folders system (QDLS) and the library file system (QSYS.LIB) are found under the root system. Notice that the CD drive (QOPT) is also part of the file system.
As I said, each file system has its own characteristics. For example, do you see QOpenSys in the list? That’s a Unix-like file system, and as such, it has case-sensitive file names. Yep, that’s right. Cat, cat, and CAT are three different animals to Unix and QOpenSys.
Interfaces to the IFS
You may access the IFS through green-screen or client-based user interfaces. Let’s look at green screens first, since you can always depend on them, even when the network’s down.
The main access point to the IFS is CL’s Work with Object Links (WRKLNK) command, which I introduced above. If you’re old enough to remember MS-DOS, you’ll see WRKLNK is similar to the DIR command. WRKLNK shows you all the files and directories within a directory. Since WRKLNK is based on the work-with standard, you can key option numbers to interact with the directory contents.
There are plenty of other CL commands designed to be used with the IFS. Rather than list them all here, please let me refer you to some menus: FILESYS, FSDIR, FSOBJ, FSSEC, CMDLNK, and CMDFILE. You can access these with the GO command.
GO FSDIR
You will find most, if not all, IFS-related commands on these menus.
Qshell provides a second and, to my taste, preferable interface to the IFS. Qshell is a Unix-like command shell that runs on i5, iSeries, and AS/400 systems. Qshell is suited to life in a directory-based world and includes many commands for manipulating IFS files. Here are some of the ones I use most often.
- ls (list directory contents)
- mv (move or rename a file or directory)
- rm (remove directory entries)
- cd (change directory)
I have written several articles and numerous tips about Qshell for this newsletter; use this site’s search link to find them. If you want to know even more, buy my book. You will not only find a lot of information about Qshell but also be feeding me, my wife, and five kids.
Client Interfaces
There are many ways to access the IFS from other systems. I will list some of them and wait for e-mail asking me why I didn’t mention others. C’est la vie.
Windows Explorer. Create a file share and drag-and-drop ’til your heart’s content.
FTP. Use the namefmt command with an argument of 1 to change to directory-based naming. Then use cd to access IFS directories.
WDSC. Working with the IFS is easy from WDSc. You can use LPEX and CODE/400 to edit files. You can even drag and drop between file systems.
iSeries Navigator. This is not my favorite, but it works.
Why IFS?
Here are a few reasons I can think of to use the IFS. There are plenty more, because people have many needs.
Use the IFS for reading and writing stream files. Stream files consist of variable-length records delimited by an end-of-line character, and are common on PC and Unix systems.
Use the IFS to store non-database objects from other systems. Graphics files, spreadsheets, and PDF files come to mind.
Use the IFS for storing Java source code. As far as I know, the Java compiler won’t read source code from a source physical file, but even if it will, the IFS is more to its tastes. Because of its case-sensitive nature, QOpenSource might be a good choice, but I have always used root.
Use the IFS for Qshell scripts. The root system is a good choice here. Qshell scripts will run from source physical files, but they run faster from the root system. As I pointed out in the introduction, Qshell scripts don’t run well at all from QDLS.
Speaking of source code, did you know that RPG’s /COPY and /INCLUDE compiler directives can read from the IFS? So far I have not found any reason to use this feature.
Let’s Get Started
Here’s a little exercise to help you get started using the IFS.
Step 1. Run the following commands from a CL command line.
cd / wrklnk
Step 2. You are looking at the root directory. Look for a directory called /home. If there’s not such a directory, create one.
md /home
Step 3. Press F3 to leave the Work with Object Links panel. Now it’s time to create your own directory under the home directory. If there is a standard in your shop for private directory names, follow it. Otherwise, I suggest you use your first initial and last name. Here’s how Joe Smith would create his directory.
md '/home/jsmith'
Step 4. Create a CSV file in your directory from a database file of your choice.
CPYTOIMPF FROMFILE(QIWS/QCUSTCDT) TOSTMF('/home/jsmith/qcustcdt.csv') STMFCODPAG(*PCASCII) RCDDLM(*CRLF)
Step 5. Use your transfer method of choice to copy the file from the IFS to your PC. I suggest FTP. Here’s part of a session from a PC-based FTP client.
quote site namefmt 1 cd /home/jsmith lcd /temp get qcustcdt.csv
Step 6. Open the PC file with a spreadsheet.
Keep it up, and you’ll be an old pro with the IFS in no time.
Click here to contact Ted Holt by e-mail.
I am already using the IFS for FTP and storing PDF files. Although using it, I don’t think I understood it as well as I do now; thank you. My question is; we have pdf files created via a third party software that are stored on the IFS. Is there anywhere I can display a pdf file on an AS/400 green screen. I’d like to code an interactive green screen and allow them to have an option to display a pick ticket. The pick ticket is already a pdf on the IFS.
Is there a command or commands to list all the files in a particular IFS folder. I would like to be able to enter say a customer # and create a table on the 400 okay Power9 listing all the files.
Thanks for sharing your knowledge. I’m trying to find the green screen methods for establishing / removing network shares. Can you please provide a link? I know how to do it using Navigator for I (Browser User Interface) but, I like to also know how to do it in the green screen. Thanks a bunch in advance.