Hi Glenn,
Glenn Gundermann wrote:
I've seen a length of 640 being used by several people. Just wondering
why this number is popular if 5000 is the actual maximum length?
There's no limit that I know of to the length of a path name in the IFS.
(Actually, for technical reasons, there's probably a 16 mb limit.)
However, remember that the IFS is an interface to many underlying file
systems. It has to be able to handle anything required by any of the
file systems in use today, and anything that might arise in the
foreseeable future.
The individual file systems may impose shorter restrictions. For
example, the /QSYS.LIB file system has a maximum path name length of 66
chars. QDLS is 82, QNTC is 255, QOPT is 294. However, some of the
others (root, QOpenSys, NFS, QFileSvr.400) have no real limit.
The 5000 number is probably coming from the length of a TYPE(*PNAME)
field on an i5/OS *CMD object. But, that's just the limit of the
command interface, and not a limit of the IFS itself. It's conceivable
that you could create a path name in the root file system that would not
work on a CL command, because of the 5000 limit on those commands.
Likewise, the 640 limit comes from the dirent data structure. dirent is
the data structure returned by the readdir() API that reads one entry
from a directory. However, that number (640) isn't the limit of an
entire path name -- rather it's the limit of an individual object name.
Path names are made up of many object names, separated by slashes. So
they can be much larger than 640.
But, again, that 640 number is the limit of readdir(), which is intended
to work with any possible file system. The individual file systems have
their own limits. Root, QOpenSys, QNTC, UDFS and QNetWare are all
limited to 255 chars per object name. (I find it interesting that QNTC
has a total path limit that's the same as the individual object name...
heh). Some others have sharper restrictions.... QDLS is limited to 12
(8 for the object name, one for a dot, and 3 for the extension name) per
object. and QSYS.LIB is limited to 17 per object (10 for the obj name,
for a dot, 6 for the object type.)
But, anyway... Because people sometimes have to type these path names
in, they usually are kept relatively short. I wouldn't want to have to
key 16 million characters into a command line! So, in the vast, vast,
majority of the cases, using a shorter variable that only handles 640 or
5000 chars is more than enough.
As an Amazon Associate we earn from qualifying purchases.