A Look at File Systems
An examination of file systems and file system commands.
The iSeries server contains several file systems, starting with the QSYS.LIB library and extending to the many different file systems found within the Integrated File System (IFS). Before examining these file systems and file-system commands, lets answer the question, "What exactly is a file system?"
According to Webopedia.com its what "an operating system or program uses to organize and keep track of files." Of course, replacing the word, "file," with the word, "object," might be more appropriate for QSYS.LIB, because everything in the traditional file system is an object. However, the other iSeries file systems don't have the same object orientation. Theyre similar to file systems on Windows or Linux systems, hierarchical file systems that are composed of directories, subdirectories and files. These files may contain program information, data information or other information, but there are no specific object types.
iSeries file systems include:
- Root (/ or "slash")
- QNTC (Windows NT-compatible)
- QDLS (Document Library System) file system
- QOpenSys (open systems)
- QSYS.LIB (traditional library)
- QOPT (optical drive)
- QFileSvr.400 (iSeries-to-iSeries)
- UDFS (User-Defined)
- NFS (Network)
- QNetWare (Novell NetWare)
File System Commands
Certain OS/400 commands are used on files in the different file systems. These commands operate on stream files, which are composed of a stream of characters. Traditional OS/400 physical files contain fixed-length records. For instance, you'd use the Copy File (CPYF) command to copy a physical file and the Copy (CPY) command to copy a stream file. Other commands used on stream file include:
- Copy to Stream File (CPYTOSTMF)
- Copy from Stream File (CPYFRMSTMF)
- Copy to Import File (CPYTOIMPF)-a stream file in import format
- Copy from Import File (CPYFRMIMPF)
By the way, stream files arent directly accessible from RPG or COBOL programs. Programs use C language file operations to access (read, write, update) stream files. These are usually implemented as prototyped procedures.
The Work with Link (WRKLNK) command is used to view IFS contents (see Figure 1). You can see other file systems in this display, such as QDLS and QNTC. The other file systems are shown as directories beneath the root directory. Also note that QIBM and QSR are directories, not file systems. In fact, paging up and down in this display would show the different files and high-level directories under the root directory.
As you can see from Figure 1, several options exist to operate on stream files in the IFS. For instance, option 2 invokes the Edit File (EDTF) command, option 5 calls the Display File (DSPF) command, option 3 invokes the CPY command, etc.
File System Descriptions
Root (/) is probably the most widely used file system (after QSYS.LIB of course). It contains important directories such as QIBM, which contains Client Access, MQSeries, the XML Toolkit and many other IBM products. Its also where most user-defined directories reside. Names in the root file system can be mixed-case, but the file system isnt case-sensitive-e.g., these two commands access the same file:
The stream file commands (CPY*) can be used on files in the root file system.
QOpenSys is like the root file system, but with one important difference: case-sensitivity. File names may be in mixed-case, and the file system is case sensitive. So these commands access two different objects:
QOpenSys also supports very long file names-up to 16 megabytes for the object name and all directory names, with each component (name) up to 255 characters. I find I don't use QOpenSys as often as the root file system.
QNTC is a unique file system. It consists of the NT servers (and associated shares) in a network. Issuing the WRKLNK '/QNTC/*' command provides a list of the NT servers in a network. Each server can then be accessed to provide access to the shared directories on that server. The building of the list of NT servers can be very slow, especially in a large network. Set environment variable QZLC_SERVERLIST to a value of 1 (ADDENVVAR ENVVAR(QZLC_SERVERLIST) VALUE('1')) to cause OS/400 to produce faster lists. To access the files on shared directories, the user ID and password must be the same on the iSeries and NT servers.
Names in QNTC can be mixed-case, but the file system isnt case-sensitive. Files accessed through QNTC are actually on NT servers, but most of the IFS commands (CPY*, etc.) may be used. QNTC can be a powerful file system if you need to access NT server data from your iSeries server.
QDLS is the folder file system, a throwback to the days of word processing and document management on AS/400 systems with software such as OfficeVision. This file system isnt used as much as in the past, and is primarily included in OS/400 for backwards-compatibility.
File names in QDLS are in 8.3 format, meaning eight characters for the name and three for the optional file extension. File names are converted to upper case, so theres no case-sensitivity.
QSYS.LIB, the traditional library file system accessible through the IFS, can be extremely handy, particularly for moving data between the IFS and a physical file. Heres an example of a command that copies a file from an NT server to a physical file on the iSeries server:
This command copies the myfile.txt file from the transfer directory on the NTServer server to the physical file MICHAEL/MYFILE.
Note the syntax of addressing objects in QSYS.LIB: /QSYS.LIB/library.LIB/file.FILE/member.MBR. The extensions (.LIB, .FILE, .MBR) are used to identify the type of objects being accessed. QSYS.LIB upper-cases names, so case-sensitivity isnt supported.
Be careful when accessing QSYS.LIB. This green screen command deletes library APLIB:
Other file systems include QOPT, which is the optical (CD-ROM) drive on the iSeries; QFileSvr.400, which enables IFS access between iSeries systems; User Defined FS, which enables directories to be mounted; Network FS, which is a UNIX construct that enables remote directories to be mounted; and QNetWare, which provides an interface to Novell NetWare servers.
All File Systems, All the Time
The different file systems that are built into OS/400 enable the iSeries server to access information with different methods and even on different systems. These file systems provide common commands and techniques for data access. Consolidation of resources is much simpler with the multiple file systems supported with OS/400.
A good resource for learning more about the file systems available in OS/400 is "Integrated File System Introduction."
Michael Ryan, i5 Business Systems edition technical editor, has more than 25 years of experience with the System i platform.
See more by Michael Ryan